comment out linear search for now, it seems broken
@@ -100,6 +100,10 @@ impl Wire {
fn _unrank(inp: u128, q: u16) -> Vec<u16> {
let mut x = inp;
let ndigits = util::digits_per_u128(q);
+ // let mut npaths_tab = vec![1; ndigits];
+ // for i in 1..ndigits {
+ // npaths_tab[i] = npaths_tab[i - 1] * q as u128;
+ // }
let npaths_tab = npaths_tab::lookup(q);
x %= npaths_tab[ndigits - 1] * q as u128;
@@ -112,18 +116,18 @@ impl Wire {
// ds[i] = d as u16;
// x -= d * npaths;
- if q < 16 {
- // linear search
- let mut acc = 0;
- for j in 0..q {
- acc += npaths;
- if acc >= x {
- x -= acc - npaths;
- ds[i] = j;
- break;
- }
- }
- } else {
+ // if q < 16 {
+ // // linear search
+ // let mut acc = 0;
+ // for j in 0..q {
+ // acc += npaths;
+ // if acc >= x {
+ // x -= acc - npaths;
+ // ds[i] = j;
+ // break;
+ // }
+ // }
+ // } else {
// binary search
let mut low = 0;
let mut high = q;
@@ -143,7 +147,7 @@ impl Wire {
low = cur;
}
}
- }
+ // }
}
ds
}
