altos: 8051 64 * 16 multiply function was broken for negative 64-bit
authorKeith Packard <keithp@keithp.com>
Sat, 3 May 2014 17:58:31 +0000 (10:58 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 9 May 2014 03:44:10 +0000 (20:44 -0700)
It was jumping around the actual multiply when the 64-bit argument was negative.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/kernel/ao_int64.c

index aa23dbe0f9cc27d37ff7a821cb20ec8f5c64105f..ca75751b21d6625219e033ba01392d3e9c56aa52 100644 (file)
@@ -17,8 +17,6 @@
 
 #include <ao_int64.h>
 
-__pdata ao_int64_t *__data ao_64r, *__data ao_64a, *__data ao_64b;
-
 void ao_plus64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, __pdata ao_int64_t *b) __FATTR {
        __LOCAL uint32_t        t;
 
@@ -151,8 +149,8 @@ void ao_mul64_64_16(__ARG ao_int64_t *r, __ARG ao_int64_t *a, __ARG uint16_t b)
                ao_neg64(&ap, a);
                a = &ap;
                negative++;
-       } else
-               ao_umul64_64_16(r, a, b);
+       }
+       ao_umul64_64_16(r, a, b);
        if (negative)
                ao_neg64(r, r);
 }