DS: Fix sqrt
Vicki Pfau vi@endrift.com
Tue, 28 Feb 2017 11:44:58 -0800
1 files changed,
5 insertions(+),
5 deletions(-)
jump to
M
src/ds/ds.c
→
src/ds/ds.c
@@ -122,7 +122,7 @@ STORE_64LE(result, DS9_REG_DIV_RESULT_0, ds->memory.io9);
STORE_64LE(remainder, DS9_REG_DIVREM_RESULT_0, ds->memory.io9); } - static void _sqrt(struct mTiming* timing, void* context, uint32_t cyclesLate) { +static void _sqrt(struct mTiming* timing, void* context, uint32_t cyclesLate) { UNUSED(timing); UNUSED(cyclesLate); struct DS* ds = context;@@ -142,11 +142,11 @@ bit >>= 2;
} while (bit != 0) { - if (param >= param + bit) { - param -= param + bit; - param = (result >> 1) + bit; + if (param >= result + bit) { + param -= result + bit; + result = (result >> 1) + bit; } else { - param >>= 1; + result >>= 1; } bit >>= 2; }