mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-01 10:38:51 +00:00
Refix CDIV deoptimization
This commit is contained in:
parent
f96f00d62d
commit
3bbb4d098b
@ -1814,21 +1814,21 @@ static void ds_instruction_mov_lea(RDisasmState *ds, int idx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static st64 revert_cdiv_magic(st64 magic) {
|
static st64 revert_cdiv_magic(st64 magic) {
|
||||||
short s;
|
|
||||||
st64 E;
|
|
||||||
const st64 N = ST64_MAX;
|
const st64 N = ST64_MAX;
|
||||||
st64 candidate;
|
st64 E, candidate;
|
||||||
|
short s;
|
||||||
|
|
||||||
if (llabs (magic) < 0xFFFFFF) {
|
if (llabs (magic) < 0xFFFFFF) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (llabs (magic) > 0xFFFFFFFF) {
|
if (llabs (magic) > UT32_MAX) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (magic < 0) {
|
if (magic < 0) {
|
||||||
magic += 1L << 31;
|
magic += 1LL << 32;
|
||||||
}
|
}
|
||||||
for (s = 0; s < 16; ++s) {
|
for (s = 0; s < 16; s++) {
|
||||||
E = 1L << (32 + s);
|
E = 1LL << (32 + s);
|
||||||
candidate = (E + magic - 1) / magic;
|
candidate = (E + magic - 1) / magic;
|
||||||
if ( (N * magic) >> (32 + s) == (N / candidate) ) {
|
if ( (N * magic) >> (32 + s) == (N / candidate) ) {
|
||||||
return candidate;
|
return candidate;
|
||||||
|
Loading…
Reference in New Issue
Block a user