altos: Make 64x16 mul a bit faster
authorKeith Packard <keithp@keithp.com>
Wed, 22 May 2013 21:38:19 +0000 (14:38 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 26 Aug 2013 05:24:01 +0000 (22:24 -0700)
the unsigned 32x32 multiply really does work, just use it

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

index 1fe717dcd6ca16fab19db928b3aa179448eb8a62..8e3caa24f83192c47b800f053dc683ff94c70c5d 100644 (file)
@@ -86,11 +86,11 @@ void ao_mul64(ao_int64_t *r, int32_t a, int32_t b) {
 
        if (a < 0) {
                a = -a;
 
        if (a < 0) {
                a = -a;
-               negative = 1;
+               negative = ~0;
        }
        if (b < 0) {
                b = -b;
        }
        if (b < 0) {
                b = -b;
-               negative = !negative;
+               negative = ~negative;
        }
        ao_umul64(r, a, b);
        if (negative)
        }
        ao_umul64(r, a, b);
        if (negative)
@@ -98,12 +98,7 @@ void ao_mul64(ao_int64_t *r, int32_t a, int32_t b) {
 }
 
 void ao_umul64_16(ao_int64_t *r, ao_int64_t *a, uint16_t b) {
 }
 
 void ao_umul64_16(ao_int64_t *r, ao_int64_t *a, uint16_t b) {
-       uint32_t        low = a->low;
-       ao_umul64(r, (uint32_t) low >> 1, (uint32_t) b << 1);
-       if (low & 1) {
-               if ((uint32_t) (r->low += b) < (uint32_t) b)
-                       r->high++;
-       }
+       ao_umul64(r, a->low, b);
        r->high += a->high * b;
 }
 
        r->high += a->high * b;
 }