bit_rshift
function · lua · primitive
- Address
0x7fac70· 85 bytes, up to0x7facc4- Signature
int __fastcall (lua_State *L)- Meaning
- Pushes argument 1 shifted right logically by argument 2
- Confidence
- verified, proof one
- Finding
- lua/libs#bit-library
Finding: Bit library in lua: the libraries
The client's bit library works on the low 32 bits of __ftol, a truncation toward zero to a
64-bit integer (eax is read, edx ignored).
bnot inverts, band, bor and bxor combine every argument, lshift, rshift and arshift
shift argument 1 by the count in argument 2 (masked to five bits), mod takes the remainder of
argument 1 by argument 2. The results are pushed as unsigned numbers, except arshift and the
remainder, which are signed. mod tests only the low dword of the divisor, so 0, 0.5 and 2^32 all answer 1
divided by argument 2.
| function | name | decided by |
|---|---|---|
0x7faa50 | bit_bnot | __ftol (0x7faa63), not eax (0x7faa68), high word zeroed (0x7faa6d), fild qword |
0x7faa90 | bit_band | loop over lua_gettop arguments (0x7faac0), and edx,eax (0x7faad1), high word 0 (0x7faae1) |
0x7fab10 | bit_bor | the same loop with or |
0x7fab90 | bit_bxor | the same loop with xor |
0x7fac10 | bit_lshift | count from argument 2 (0x7fac18), value from argument 1 (0x7fac29), shl eax,cl (0x7fac3e), high word 0 (0x7fac40) |
0x7fac70 | bit_rshift | the same with shr eax,cl (0x7fac9e) and high word 0 (0x7faca0) |
0x7facd0 | bit_arshift | the same with sar eax,cl (0x7facfc), pushed as a signed integer by fild dword (0x7fad06) |
0x7fad20 | bit_mod | divisor from __ftol (0x7fad2d) tested (0x7fad32); zero divides 1.0 by lua_tonumber (0x7fad42) |
0x7fad70 | bit_mod_remainder | cdq; idiv edi (0x7fad9a, 0x7fad9b), remainder edx pushed (0x7fadab) |
The derivation is in the doc.
Callers 0
None by a direct call or jump.
Callees 3
- __ftol crt
- lua_pushnumber lua
- luaL_checknumber lua
Calls and jumps by a bare address, from tables/calls.tsv.