Skip to content

Commit a9f97fb

Browse files
committed
more change
1 parent 98217cb commit a9f97fb

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/_string_tools/slice_packed_field.nr

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -594,20 +594,6 @@ fn divmod_31(numerator: u16) -> (u16, u16) {
594594
(quotient, remainder)
595595
}
596596

597-
/**
598-
* @brief converts a 16 bit value into 16 fake bools (Field elements that are 0 or 1)
599-
**/
600-
unconstrained fn decompose(val: Field) -> [Field; 16] {
601-
let mut r: [Field; 16] = [0; 16];
602-
603-
let mut it = val as u32;
604-
for i in 0..16 {
605-
r[i] = (it & 1) as Field;
606-
it >>= 1;
607-
}
608-
r
609-
}
610-
611597
// 5 gates?
612598
pub fn get_last_limb_path<let OutputFields: u32>(last_limb_index: Field) -> [u1; OutputFields] {
613599
// TODO we offset by 1 explain why (0 byte length produces 0 - 1 which = invalid array index. we just add 1 and increase array length by 1 to compensate)
@@ -736,9 +722,9 @@ pub fn slice_fields<let InputFields: u32, let OutputFields: u32>(
736722
// 1, 48
737723
let combined = previous * tail_shift + head;
738724
// 1, 49
739-
result[i] = combined * (slice_valid as Field);
725+
result[i] = if slice_valid == 1 { combined } else { 0 };
740726
// 2, 51
741-
previous = (tail - previous) * (slice_valid as Field) + previous;
727+
previous = if slice_valid == 1 { tail } else { previous };
742728
}
743729

744730
// 2, 130.5

0 commit comments

Comments
 (0)