diff options
| author | vincent.del.medico <vincent.del.medico@gmail.com> | 2011-06-10 13:49:11 +0000 |
|---|---|---|
| committer | vincent.del.medico <vincent.del.medico@gmail.com> | 2011-06-10 13:49:11 +0000 |
| commit | c59675818b54f267574c79b79f59bb5f23edbdd9 (patch) | |
| tree | 18fd65cf4a8bd25b3728de10f6f5673a9682eb00 | |
| parent | 5248e45183ab45805fa7a302cb7deb633cdfb7a5 (diff) | |
| download | libfixmath-c59675818b54f267574c79b79f59bb5f23edbdd9.tar.gz | |
Fixed issue 12 in fix16_div when FIXMATH_NO_64BIT defined
| -rw-r--r-- | libfixmath/fix16.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libfixmath/fix16.c b/libfixmath/fix16.c index de9bbf1..1ea4ff5 100644 --- a/libfixmath/fix16.c +++ b/libfixmath/fix16.c @@ -116,6 +116,7 @@ fix16_t fix16_div(fix16_t inArg0, fix16_t inArg1) { uint32_t n_lo = (inArg0 % inArg1);
uint32_t n_hi = (n_lo >> 16);
n_lo <<= 16;
+ uint32_t n_lo_orig = n_lo;
uint32_t i, arg;
for(i = 1, arg = inArg1; ((n_lo | arg) & 1) == 0; i <<= 1) {
@@ -123,6 +124,7 @@ fix16_t fix16_div(fix16_t inArg0, fix16_t inArg1) { n_hi = (n_hi >> 1);
arg >>= 1;
}
+ n_lo = n_lo_orig;
uint32_t res = 0;
if(n_hi) {
|
