OpenTTD Source
20241108-master-g80f628063a
|
Functions related to bit mathematics. More...
Go to the source code of this file.
Data Structures | |
struct | SetBitIterator< Tbitpos, Tbitset > |
Iterable ensemble of each set bit in a value. More... | |
struct | SetBitIterator< Tbitpos, Tbitset >::Iterator |
Macros | |
#define | SETBITS(x, y) ((x) |= (y)) |
Sets several bits in a variable. More... | |
#define | CLRBITS(x, y) ((x) &= ~(y)) |
Clears several bits in a variable. More... | |
Functions | |
template<typename T > | |
constexpr static debug_inline uint | GB (const T x, const uint8_t s, const uint8_t n) |
Fetch n bits from x, started at bit s. More... | |
template<typename T , typename U > | |
constexpr T | SB (T &x, const uint8_t s, const uint8_t n, const U d) |
Set n bits in x starting at bit s to d. More... | |
template<typename T , typename U > | |
constexpr T | AB (T &x, const uint8_t s, const uint8_t n, const U i) |
Add i to n bits of x starting at bit s. More... | |
template<typename T > | |
constexpr debug_inline bool | HasBit (const T x, const uint8_t y) |
Checks if a bit in a value is set. More... | |
template<typename T > | |
constexpr T | SetBit (T &x, const uint8_t y) |
Set a bit in a variable. More... | |
template<typename T > | |
constexpr T | ClrBit (T &x, const uint8_t y) |
Clears a bit in a variable. More... | |
template<typename T > | |
constexpr T | ToggleBit (T &x, const uint8_t y) |
Toggles a bit in a variable. More... | |
template<typename T > | |
constexpr T | AssignBit (T &x, const uint8_t y, bool value) |
Assigns a bit in a variable. More... | |
template<typename T > | |
constexpr uint8_t | FindFirstBit (T x) |
Search the first set bit in a value. More... | |
template<typename T > | |
constexpr uint8_t | FindLastBit (T x) |
Search the last set bit in a value. More... | |
template<typename T > | |
constexpr T | KillFirstBit (T value) |
Clear the first bit in an integer. More... | |
template<typename T > | |
constexpr uint | CountBits (T value) |
Counts the number of set bits in a variable. More... | |
template<typename T > | |
constexpr bool | HasExactlyOneBit (T value) |
Test whether value has exactly 1 bit set. More... | |
template<typename T > | |
constexpr bool | HasAtMostOneBit (T value) |
Test whether value has at most 1 bit set. More... | |
static uint32_t | BSWAP32 (uint32_t x) |
Perform a 32 bits endianness bitswap on x. More... | |
static uint16_t | BSWAP16 (uint16_t x) |
Perform a 16 bits endianness bitswap on x. More... | |
Functions related to bit mathematics.
Definition in file bitmath_func.hpp.
#define CLRBITS | ( | x, | |
y | |||
) | ((x) &= ~(y)) |
Clears several bits in a variable.
This macro clears several bits in a variable. The bits to clear are provided by a value. The new value is also returned.
x | The variable to clear some bits |
y | The value with set bits for clearing them in the variable |
Definition at line 166 of file bitmath_func.hpp.
#define SETBITS | ( | x, | |
y | |||
) | ((x) |= (y)) |
Sets several bits in a variable.
This macro sets several bits in a variable. The bits to set are provided by a value. The new value is also returned.
x | The variable to set some bits |
y | The value with set bits for setting them in the variable |
Definition at line 136 of file bitmath_func.hpp.
|
constexpr |
Add i to n bits of x starting at bit s.
This adds the value of i on n bits of x starting at bit s. The parameters x, s, i are similar to GB. Besides, \ a x must be a variable as the result are saved there. An overflow does not affect the following bits of the given bit window and is simply ignored.
x | The variable to add some bits at some position |
s | The start position of the addition |
n | The size/window for the addition |
i | The value to add at the given start position in the given window. |
Definition at line 83 of file bitmath_func.hpp.
Referenced by IncHouseConstructionTick(), and IncreaseRoadWorksCounter().
|
constexpr |
Assigns a bit in a variable.
This function assigns a single bit in a variable. The variable is changed and the value is also returned. Parameter y defines the bit to assign and starts at the LSB with 0.
x | The variable to assign the bit |
y | The bit position to assign |
value | The new bit value |
Definition at line 200 of file bitmath_func.hpp.
Referenced by CmdSetVehicleVisibility(), VehicleOrderSaver::Restore(), SetCrossingBarred(), SetCrossingReservation(), SetDepotReservation(), SetDockingTile(), SetHasSignals(), SetNonFloodingWaterTile(), SetRailStationReservation(), SetStationTileBlocked(), SetStationTileHavePylons(), SetStationTileHaveWires(), SetTrackReservation(), and SetTunnelBridgeReservation().
|
inlinestatic |
Perform a 16 bits endianness bitswap on x.
x | the variable to bitswap |
Definition at line 379 of file bitmath_func.hpp.
|
inlinestatic |
Perform a 32 bits endianness bitswap on x.
x | the variable to bitswap |
Definition at line 364 of file bitmath_func.hpp.
Referenced by AddGrfInfo(), NewGRFInspectWindow::DrawMainPanelWidget(), FormatLabel(), NewGRFProfiler::GetOutputFilename(), GraphicsSetLoadConfig(), GraphicsSetSaveConfig(), HandleNode(), HandleSavegameLoadCrash(), HasGRFConfig(), IsGoodGRFConfigList(), LoadNewGRFSound(), PickerSaveConfig(), ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(), ShowMissingContentWindow(), and SurveyGrfs().
|
constexpr |
Clears a bit in a variable.
This function clears a bit in a variable. The variable is changed and the value is also returned. Parameter y defines the bit to clear and starts at the LSB with 0.
x | The variable to clear the bit |
y | The bit position to clear |
Definition at line 151 of file bitmath_func.hpp.
Referenced by AircraftHandleDestTooFar(), RoadStop::AllocateBay(), RoadStop::AllocateDriveThroughBay(), ChangeOwnershipOfCompanyItems(), GroundVehicle< T, Type >::ClearArticulatedPart(), GroundVehicle< T, Type >::ClearEngine(), GroundVehicle< T, Type >::ClearFreeWagon(), GroundVehicle< T, Type >::ClearFrontEngine(), GroundVehicle< T, Type >::ClearMultiheaded(), ClearSingleBridgeMiddle(), ClearSnow(), GroundVehicle< T, Type >::ClearWagon(), CmdAutofillTimetable(), CopyGRFConfigList(), DEFINE_POOL_METHOD(), DisableEngineForCompany(), Vehicle::HandlePathfindingResult(), RoadStop::MakeDriveThrough(), MapSpriteMappingRecolour(), PrepareUnload(), ReadSpriteLayout(), FreeUnitIDGenerator::ReleaseID(), RemoveFirstTrack(), RemoveFirstTrackdir(), SetGroupFlag(), StationHandleBigTick(), ToggleInvisibilityWithTransparency(), TryPathReserve(), UpdateTownGrowth(), GroundVehicle< T, Type >::UpdateZPositionAndInclination(), and VehicleEnterDepot().
|
constexpr |
Counts the number of set bits in a variable.
value | the value to count the number of bits in. |
Definition at line 262 of file bitmath_func.hpp.
Referenced by AfterLoadCompanyStats(), CalculateCompanyAssetValue(), CmdConvertRail(), DrawRoadTypeCatenary(), RailTypeScopeResolver::GetRandomBits(), RoadTypeScopeResolver::GetRandomBits(), and CYapfFollowShipT< Types >::GetRandomTrackdir().
|
constexpr |
Search the first set bit in a value.
When no bit is set, it returns 0.
x | The value to search. |
Definition at line 213 of file bitmath_func.hpp.
Referenced by CYapfBaseT< Types >::AddMultipleNodes(), HousePickerCallbacks::FillUsedItems(), FindFirstTrack(), FindFirstTrackdir(), FreeUnitIDGenerator::NextID(), CYapfOriginTileT< Types >::PfSetStartupNodes(), RemoveFirstTrack(), RemoveFirstTrackdir(), TrackBitsToTrack(), HousePickerCallbacks::UpdateSavedItems(), and YapfRoadVehicleChooseTrack().
|
constexpr |
Search the last set bit in a value.
When no bit is set, it returns 0.
x | The value to search. |
Definition at line 232 of file bitmath_func.hpp.
|
staticconstexpr |
Fetch n bits from x, started at bit s.
This function can be used to fetch n bits from the value x. The s value set the start position to read. The start position is count from the LSB and starts at 0
. The result starts at a LSB, as this isn't just an and-bitmask but also some bit-shifting operations. GB(0xFF, 2, 1) will so return 0x01 (0000 0001) instead of 0x04 (0000 0100).
x | The value to read some bits. |
s | The start position to read some bits. |
n | The number of bits to read. |
Definition at line 32 of file bitmath_func.hpp.
Referenced by Buffer::AppendUtf8(), AreCompanyManagerFaceBitsValid(), BmpRead1(), BmpRead24(), BmpRead4(), BmpRead8(), BuildObject(), ChangeTrainDirRandomly(), CheckPartialPixelZ(), CmdBuildObjectArea(), CmdClearArea(), CmdLevelLand(), ConvertFromOldCompanyManagerFace(), DecodeMonitorCargoType(), DecodeMonitorCompany(), Disaster_CoalMine_Init(), DisasterTick_Submarine(), DrawCommonTileSeq(), DrawSpriteToRgbaBuffer(), AIInfo::DummyConstructor(), FormatLabel(), AI::GameLoop(), GetBridgeAxis(), GetBridgeType(), GetCleanHouseType(), GetCleanIndustryGfx(), GetClearCounter(), GetClearDensity(), StoryPageButtonData::GetColour(), GetCompanyManagerFaceBits(), GetCompanyManagerFaceSprite(), Order::GetConditionComparator(), Order::GetConditionVariable(), GetCrossingRoadAxis(), StoryPageButtonData::GetCursor(), GetCustomRoadStopSpecIndex(), Order::GetDepotActionType(), Order::GetDepotOrderType(), GetDisallowedRoadDirections(), GetDistanceFromNearbyHouse(), GetFeatureIndex(), GetFeatureNum(), GetFieldType(), GetGlobalVariable(), GetHouseBuildingStage(), GetHouseConstructionTick(), GetHouseProcessingTime(), GetHouseTriggers(), GetIndustryConstructionCounter(), GetIndustryConstructionStage(), GetIndustryTriggers(), GetLiftDestination(), GetLiftPosition(), Order::GetLoadType(), GetLockDirection(), GetLockPart(), Waypoint::GetNewGRFVariable(), Order::GetNonStopType(), GetPresentSignals(), GetRailDepotDirection(), GetRailReservationTrackBits(), GetRailType(), RailTypeScopeResolver::GetRandomBits(), RoadTypeScopeResolver::GetRandomBits(), GetRawClearGround(), GetRoadDepotDirection(), GetRoadside(), GetRoadWaypointRoadside(), VehicleResolverObject::GetScope(), GetShipDepotAxis(), GetShipDepotPart(), GetSignalStates(), GetStationTileRandomBits(), GetStationType(), Order::GetStopLocation(), GetTileOwner(), GetTrackBits(), GetTreeCount(), GetTreeDensity(), GetTreeGround(), GetTreeGrowth(), GetTropicZone(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), Order::GetType(), Order::GetUnloadType(), GRFParameterInfo::GetValue(), GetVarFileType(), VehicleScopeResolver::GetVariable(), IndustriesScopeResolver::GetVariable(), TownScopeResolver::GetVariable(), GetVarMemType(), StoryPageButtonData::GetVehicleType(), GetWaterClass(), GetWaterTileType(), HandleAutoSignalPlacement(), HandleCrashedAircraft(), RoadStop::HasFreeBay(), IncHouseConstructionTick(), IncreaseRoadWorksCounter(), IsBridgeAbove(), IsCustomRoadStopSpecIndex(), MirrorRoadBits(), MoveWaypointsToBaseStations(), OrdersWindow::OnInvalidateData(), TimetableWindow::OnInvalidateData(), PlaceTree(), Packet::PrepareToSend(), ResetRestoreAllTransparency(), RotateRoadBits(), ScaleAllCompanyManagerFaceBits(), SeedChance(), Packet::Send_uint32(), Packet::Send_uint64(), SetHouseType(), SetIndustryGfx(), VehicleListIdentifier::UnpackIfValid(), Utf8Decode(), Utf8EncodedCharLen(), StoryPageButtonData::ValidateColour(), StoryPageButtonData::ValidateCursor(), and StoryPageButtonData::ValidateVehicleType().
|
constexpr |
Test whether value has at most 1 bit set.
value | the value to test. |
Definition at line 290 of file bitmath_func.hpp.
Referenced by GetNewCargoTypeForReplace(), MaskWireBits(), and Vehicle::NeedsServicing().
|
constexpr |
Checks if a bit in a value is set.
This function checks if a bit inside a value is set or not. The y value specific the position of the bit, started at the LSB and count from 0
.
x | The value to check |
y | The position of the bit to check, started from the LSB |
Definition at line 103 of file bitmath_func.hpp.
Referenced by AddArticulatedParts(), NewGRFWindow::AddGRFToActive(), LinkGraph::AddNode(), AfterLoadRoadStops(), AircraftHandleDestTooFar(), RoadStop::AllocateBay(), AnimationBase< Tbase, Tspec, Tobj, Textra, GetCallback, Tframehelper >::AnimateTile(), TimetableWindow::BuildArrivalDepartureList(), BuildObject(), PickerWindow::BuildPickerClassList(), PickerWindow::BuildPickerTypeList(), RefitWindow::BuildRefitList(), CompanyStationsWindow::BuildStationsList(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CanStationTileHavePylons(), CanStationTileHaveWires(), CargoAndEngineFilter(), ChangeIndustryProduction(), ChangeOwnershipOfCompanyItems(), CheckAutoreplaceValidity(), CheckBuildableTile(), CheckIfIndustryTilesAreFree(), RoadStop::Entry::CheckIntegrity(), BuildRailStationWindow::CheckSelectedSize(), ChooseShipTrack(), CmdAlterGroup(), CmdAutoreplaceVehicle(), CmdBuyCompany(), CmdForceTrainProceed(), CmdReverseTrainDirection(), CmdSetVehicleOnTime(), CmdStartStopVehicle(), CargoesField::ConnectCargo(), ConvertFromOldCompanyManagerFace(), ConvertOldMultiheadToNew(), BaseConsist::CopyConsistPropertiesFrom(), CountArticulatedParts(), Train::Crash(), NetworkAuthenticationServerHandler::Create(), DisasterTick_Helicopter_Rotors(), DisasterTick_Submarine(), DisasterTick_Ufo(), DisasterTick_Zeppeliner(), TownAuthorityWindow::DrawActions(), TimetableWindow::DrawArrivalDeparturePanel(), DrawBridgeMiddle(), DrawCommonTileSeq(), IndustryViewWindow::DrawInfo(), TownAuthorityWindow::DrawRatings(), EngineReplacement(), FillNewGRFVehicleCache(), WaypointPickerCallbacks::FillUsedItems(), RoadWaypointPickerCallbacks::FillUsedItems(), FindDeletedWaypointCloseTo(), FindGRFConfig(), FindJoiningWaypoint(), FindTrainOnTrackEnum(), Train::GetAccelerationStatus(), GetAcceptanceMask(), GetBestFittingSubType(), GetCanalSpriteOffset(), GetCargoSubtypeText(), GetCargoSuffix(), HousePickerCallbacks::GetClassName(), GetCompanyRailTypes(), GetCompanyRoadTypes(), RoadStop::GetEntry(), GetFoundation_Town(), GetIfStopIsForType(), GetIncompatibleRefitOrderIdForAutoreplace(), GetIndustryProbabilityCallback(), Airport::GetNumHangars(), GetRailReservationTrackBits(), GetRailStationAxis(), GetRailTypes(), GetRoadTypes(), GetSingleSignalState(), GetTLG(), CompanyInfrastructureWindow::GetTotalMaintenanceCost(), HousePickerCallbacks::GetTypeName(), BaseGraphWindow::GetValuesInterval(), StationScopeResolver::GetVariable(), GRFLoadConfig(), GroundSpritePaletteTransform(), HandleBankruptcyTakeover(), Vehicle::HandlePathfindingResult(), LinkRefresher::HandleRefit(), HandleSavegameLoadCrash(), HasCPUIDFlag(), HasCrossingReservation(), HasDepotReservation(), HasGrfMiscBit(), HasPowerOnRail(), HasPowerOnRoad(), HasRailCatenary(), HasRailTypeAvail(), GoodsEntry::HasRating(), HasRoadCatenary(), HasStationReservation(), HasTrack(), HasTrackdir(), HasTunnelBridgeReservation(), HasTunnelBridgeSnowOrDesert(), IndustryTemporarilyRefusesCargo(), IsArticulatedEngine(), Vehicle::IsArticulatedPart(), IsArticulatedVehicleRefittable(), IsBridge(), IsCompatibleRail(), IsCrossingBarred(), NWidgetCore::IsDisabled(), IsDockingTile(), Engine::IsEnabled(), GroundVehicle< T, Type >::IsEngine(), IsEngineBuildable(), IsEngineRefittable(), RoadStop::IsEntranceBusy(), ObjectSpec::IsEverAvailable(), RoadStop::IsFreeBay(), GroundVehicle< T, Type >::IsFreeWagon(), IsGoodGRFConfigList(), Engine::IsHidden(), NWidgetCore::IsHighlighted(), IsHouseCompleted(), IsIndustryCompleted(), IsInvisibilitySet(), IsLoggableGrfConfig(), NWidgetCore::IsLowered(), GroundVehicle< T, Type >::IsMultiheaded(), IsNonFloodingWaterTile(), IsOnSnow(), IsRoadWaypointOnSnowOrDesert(), IsSignalPresent(), IsSnowTile(), IsStationAvailable(), IsStationTileBlocked(), IsTransparencySet(), IsTunnel(), IsValidCompanyManagerFace(), GroundVehicle< T, Type >::IsWagon(), RoadStop::Leave(), LiftHasDestination(), MapSpriteMappingRecolour(), MarkTrainAsStuck(), MonitorMonitorsIndustry(), MoveWaypointsToBaseStations(), Vehicle::NeedsServicing(), NetworkAfterNewGRFScan(), NetworkAutoCleanCompanies(), NewVehicleAvailable(), NewGRFWindow::OnInvalidateData(), TownAuthorityWindow::OnInvalidateData(), VehicleListWindow::OnInvalidateData(), SelectCompanyManagerFaceWindow::OnPaint(), TownAuthorityWindow::OnPaint(), SignList::OwnerVisibilityFilter(), ParamSet(), PerformStationTileSlopeCheck(), LinkRefresher::PredictNextOrder(), PrepareUnload(), Rail90DegTurnDisallowed(), RailNoLevelCrossings(), ReadSpriteLayout(), RoadStop::Entry::Rebuild(), RefitVehicle(), RoadNoLevelCrossing(), ScaleAllCompanyManagerFaceBits(), ServerNetworkGameSocketHandler::SendNewGRFCheck(), BuildVehicleWindow::SetCargoFilterArray(), SetYearEngineAgingStops(), ShowDropDownMenu(), ShowMissingContentWindow(), ShowNewGrfVehicleError(), Vehicle::ShowVisualEffect(), SlReadSimpleGamma(), SpriteLayoutPaletteTransform(), SubtractMoneyFromAnyCompany(), SurveyGrfs(), TileLoop_Water(), TownDirectoryWindow::TownRatingSorter(), TownTickHandler(), TrackOverlapsTracks(), TrainController(), TriggerObjectAnimation(), TriggerObjectTileAnimation(), TriggerRoadStopRandomisation(), TriggerWatchedCargoCallbacks(), TryPathReserve(), OrdersWindow::UpdateAutoRefitState(), UpdateCompanyGroupLiveries(), Train::UpdateDeltaXY(), UpdateObjectColours(), OskWindow::UpdateOskState(), UpdateTownGrowthRate(), Vehicle::UpdateVisualEffect(), GroundVehicle< T, Type >::UpdateZPosition(), Utf8Decode(), VehicleExitDir(), VehicleLengthChanged(), VerifyAutoreplaceRefitForOrders(), WaypointWindow::WaypointWindow(), and RoadStop::~RoadStop().
|
constexpr |
Test whether value has exactly 1 bit set.
value | the value to test. |
Definition at line 278 of file bitmath_func.hpp.
|
constexpr |
Clear the first bit in an integer.
This function returns a value where the first bit (from LSB) is cleared. So, 110100 returns 110000, 000001 returns 000000, etc.
value | The value to clear the first bit |
Definition at line 250 of file bitmath_func.hpp.
Referenced by CYapfBaseT< Types >::AddMultipleNodes(), ExtendTrainReservation(), CYapfOriginTileT< Types >::PfSetStartupNodes(), TrackBitsToTrack(), and TracksOverlap().
|
constexpr |
Set n bits in x starting at bit s to d.
This function sets n bits from x which started as bit s to the value of d. The parameters x, s and n works the same as the parameters of GB. The result is saved in x again. Unused bits in the window provided by n are set to 0 if the value of d isn't "big" enough. This is not a bug, its a feature.
x | The variable to change some bits |
s | The start position for the new bits |
n | The size/window for the new bits |
d | The actually new bits to save in the defined position. |
Definition at line 58 of file bitmath_func.hpp.
Referenced by ClearEnginesHiddenFlagOfCompany(), EncodeCargoIndustryMonitor(), EncodeCargoTownMonitor(), RoadStop::Enter(), HaltLift(), MakeBridgeRamp(), MakeField(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeWater(), MoveBuoysToWaypoints(), ResetIndustryConstructionStage(), SetClearCounter(), SetClearDensity(), SetCompanyManagerFaceBits(), Order::SetConditionComparator(), Order::SetConditionVariable(), SetCustomRoadStopSpecIndex(), Order::SetDepotActionType(), Order::SetDepotOrderType(), SetDisallowedRoadDirections(), RoadStop::SetEntranceBusy(), SetFieldType(), SetHouseCompleted(), SetHouseProcessingTime(), SetHouseTriggers(), SetHouseType(), SetIndustryConstructionCounter(), SetIndustryConstructionStage(), SetIndustryGfx(), SetIndustryTriggers(), SetLiftDestination(), SetLiftPosition(), Order::SetLoadType(), Order::SetNonStopType(), SetPresentSignals(), SetRailDepotExitDirection(), SetRailType(), SetRoadDepotExitDirection(), SetRoadside(), SetRoadWaypointRoadside(), SetSignalStates(), SetStationTileRandomBits(), Order::SetStopLocation(), GRFConfig::SetSuitablePalette(), SetTileOwner(), SetTileType(), SetTrackBits(), SetTrackReservation(), SetTreeGroundDensity(), SetTreeGrowth(), SetTropicZone(), SetTunnelBridgeSnowOrDesert(), Order::SetUnloadType(), GRFParameterInfo::SetValue(), StoryPageButtonData::SetVehicleType(), SetWaterClass(), SetWaterTileType(), TerminateRoadWorks(), and UpdateStationAcceptance().
|
constexpr |
Set a bit in a variable.
This function sets a bit in a variable. The variable is changed and the value is also returned. Parameter y defines the bit and starts at the LSB with 0.
x | The variable to set a bit |
y | The bit position to set |
Definition at line 121 of file bitmath_func.hpp.
Referenced by AddAcceptedCargoSetMask(), AircraftHandleDestTooFar(), CalculateRefitMasks(), CalculateRoadStopCost(), ChangeOwnershipOfCompanyItems(), ChangeTownRating(), CmdAutofillTimetable(), CargoesField::ConnectCargo(), ConvertFromOldCompanyManagerFace(), ConvertOldMultiheadToNew(), BaseConsist::CopyConsistPropertiesFrom(), CopyGRFConfigList(), DEFINE_POOL_METHOD(), DrawCommonTileSeq(), EnableEngineForCompany(), EncodeCargoIndustryMonitor(), RoadStop::Enter(), RoadStop::FreeBay(), GetAcceptanceMask(), GetAvailableVehicleCargoTypes(), GetCompanyRailTypes(), GetCompanyRoadTypes(), GetCountAndDistanceOfClosestInstance(), GetEmptyMask(), GetMaskOfAllowedCurrencies(), Airport::GetNumHangars(), GetRailTypes(), GetRoadTypes(), GRFLoadConfig(), GRFUnsafe(), HandleBankruptcyTakeover(), Vehicle::HandlePathfindingResult(), InitializeSortedCargoSpecs(), IsEngineRefittable(), IsGoodGRFConfigList(), LookupManyOfMany(), RoadStop::MakeDriveThrough(), MakeSnow(), MapSpriteMappingRecolour(), MarkTrainAsStuck(), NetworkAutoCleanCompanies(), GraphLegendWindow::OnInvalidateData(), PrepareUnload(), ReadGRFSpriteOffsets(), GroundVehicle< T, Type >::SetArticulatedPart(), SetBridgeMiddle(), GroundVehicle< T, Type >::SetEngine(), GroundVehicle< T, Type >::SetFreeWagon(), GroundVehicle< T, Type >::SetFrontEngine(), SetGroupFlag(), SetIndustryCompleted(), SetLiftDestination(), GroundVehicle< T, Type >::SetMultiheaded(), SmallMapWindow::SetOverlayCargoMask(), GroundVehicle< T, Type >::SetWagon(), ShowNewGrfVehicleError(), ToggleInvisibilityWithTransparency(), TownActionBuildStatue(), TriggerRoadStopRandomisation(), TriggerWatchedCargoCallbacks(), GroundVehicle< T, Type >::UpdateZPositionAndInclination(), and FreeUnitIDGenerator::UseID().
|
constexpr |
Toggles a bit in a variable.
This function toggles a bit in a variable. The variable is changed and the value is also returned. Parameter y defines the bit to toggle and starts at the LSB with 0.
x | The variable to toggle the bit |
y | The bit position to toggle |
Definition at line 181 of file bitmath_func.hpp.
Referenced by BaseConsist::CopyConsistPropertiesFrom(), ToggleInvisibility(), ToggleRoadWaypointOnSnowOrDesert(), ToggleSnow(), ToggleTransparency(), and ToggleTransparencyLock().