DivideBy5
function · cmath · unreached
- Address
0x455ca0· 30 bytes, up to0x455cbd- Signature
uint32_t __fastcall (uint32_t n)- Meaning
- Returns n divided by 5 through shifts and adds, exact for small n
- Confidence
- verified, proof two
- Finding
- cmath/scalars#division-by-constants
Finding: Division by constants in cmath: scalars
0x455c60(a, b) returns in eax the high dword of the signed product of ecx and edx, and ecx
the sign of that dword. 0x455c80(n) is ⌊n/3⌋ for unsigned n (n·0xaaaaaaab >> 33), exact for every
n. 0x455c90(n) is the high dword of n·0x55555556, signed: ⌊n/3⌋, one lower for a negative multiple
of 3. Four routines divide by 5 and 9 with shifts: 0x455ca0 is ⌊n/5⌋ for n below 84194565,
0x455cc0 is ⌈n/5⌉ for n from −671088644 to 352630020, 0x455ce0 is ⌊n/9⌋ for n below
603979776, and 0x455d00 is ⌈n/9⌉ for n from −301989896 to 301989879. Outside those ranges the
results differ from the exact quotient.
The derivation is in the doc.
Callers 0
None by a direct call or jump.
Callees 0
None by a direct call or jump.
Calls and jumps by a bare address, from tables/calls.tsv.