mpreduce: Don't stop bit scanner too early.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 4 Apr 2006 16:17:45 +0000 (17:17 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 4 Apr 2006 16:17:45 +0000 (17:17 +0100)
The code generation decomposition pass stopped too early, and failed to
note a change in the next-to-top bit.

mpreduce.c
tests/mpreduce

index 52e86a1..02ce2cf 100644 (file)
@@ -105,7 +105,7 @@ int mpreduce_create(mpreduce *r, mp *p)
   st = Z;
 #endif
 
-  for (i = 0, mp_scan(&sc, p); i < d  - 1 && mp_step(&sc); i++) {
+  for (i = 0, mp_scan(&sc, p); i < d && mp_step(&sc); i++) {
     switch (st | mp_bit(&sc)) {
       case  Z | 1: st = Z1; break;
       case Z1 | 0: st =  Z; op = MPRI_SUB; goto instr;
index 9a74b99..4caad8b 100644 (file)
@@ -3,6 +3,8 @@
 # Tests for efficient reduction
 
 reduce {
+  0xc000 0x16cb3 0xacb3;
+
   0x72e2c37447f8bca34c4a39b130ea8e5c9a7d8b54564aa88ea773
   0x367aa8f5ba9ac4e8e2ea198b8af2c3b3081deab392ffc05715783b245a62a6fa
   0x08e8c03ebf398c63d71d8fd7ca4ece12367a8dde180ca650afb6;