MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / fastSquareRoot

Function fastSquareRoot

src/Math/src/Vector.cpp:118–125  ·  view source on GitHub ↗

0x004BE368

Source from the content-addressed store, hash-verified

116 }
117 // 0x004BE368
118 uint16_t fastSquareRoot(uint32_t distance)
119 {
120 uint8_t i = 10;
121 for (; distance >= 4096; --i, distance >>= 2)
122 ;
123
124 return Data::kFastSquareRootTable[(distance & 0xFFE) >> 1] >> i;
125 }
126}

Callers 6

TESTFunction · 0.85
distance2DFunction · 0.85
distance3DFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68