Browse Source

We only need one leaf correction flag bit per level, not one per word per level

Ian Goldberg 1 year ago
parent
commit
864d5a2e7c
2 changed files with 8 additions and 11 deletions
  1. 5 6
      rdpf.hpp
  2. 3 5
      rdpf.tcc

+ 5 - 6
rdpf.hpp

@@ -75,12 +75,11 @@ struct RDPF : public DPF {
     // leaf_info[d-i].
     std::vector<LeafInfo> li;
 
-    // The leaf correction flag bits for the LWIDTH leaf words at each
-    // leaf level.  The bit for leaf word j of level i (for an
-    // incremental DPF of max depth m) is leaf_cfbits[j] & (1<<(m-i)).
-    // For a normal (not incremental) RDPF, it's the same, but therefore
-    // only the low bit of each of these LWIDTH words gets used.
-    std::array<value_t,LWIDTH> leaf_cfbits;
+    // The leaf correction flag bits for each leaf level.  The bit for
+    // level i (for an incremental DPF of max depth m) is leaf_cfbits &
+    // (1<<(m-i)).  For a normal (not incremental) RDPF, it's the same,
+    // but therefore only the low bit gets used.
+    value_t leaf_cfbits;
 
     // If we're saving the expansion, put it here
     std::vector<LeafNode> expansion;

+ 3 - 5
rdpf.tcc

@@ -195,11 +195,9 @@ inline typename RDPF<WIDTH>::LeafNode RDPF<WIDTH>::descend_to_leaf(
     if (flag) {
         LeafNode CW = li[0].leaf_cw;
         LeafNode CWR = CW;
-        for (nbits_t j=0;j<LWIDTH;++j) {
-            bit_t cfbit = !!(leaf_cfbits[j] &
-                (value_t(1)<<(maxdepth-parentdepth)));
-            CWR[j] ^= lsb128_mask[cfbit];
-        }
+        bit_t cfbit = !!(leaf_cfbits &
+            (value_t(1)<<(maxdepth-parentdepth)));
+        CWR[0] ^= lsb128_mask[cfbit];
         prgout ^= (whichchild ? CWR : CW);
     }
     return prgout;