diff --git a/libr/core/disasm.c b/libr/core/disasm.c index 7cc3cfd1dc..ce56a5705a 100644 --- a/libr/core/disasm.c +++ b/libr/core/disasm.c @@ -1814,21 +1814,21 @@ static void ds_instruction_mov_lea(RDisasmState *ds, int idx) { } static st64 revert_cdiv_magic(st64 magic) { - short s; - st64 E; const st64 N = ST64_MAX; - st64 candidate; + st64 E, candidate; + short s; + if (llabs (magic) < 0xFFFFFF) { return 0; } - if (llabs (magic) > 0xFFFFFFFF) { + if (llabs (magic) > UT32_MAX) { return 0; } if (magic < 0) { - magic += 1L << 31; + magic += 1LL << 32; } - for (s = 0; s < 16; ++s) { - E = 1L << (32 + s); + for (s = 0; s < 16; s++) { + E = 1LL << (32 + s); candidate = (E + magic - 1) / magic; if ( (N * magic) >> (32 + s) == (N / candidate) ) { return candidate;