Skip to content

Commit deab3c5

Browse files
committed
more change
1 parent 98217cb commit deab3c5

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/_string_tools/slice_packed_field.nr

Lines changed: 3 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)
@@ -777,11 +763,12 @@ pub fn slice_fields<let InputFields: u32, let OutputFields: u32>(
777763
let mut path: [Field; OutputFields] = [0; OutputFields];
778764
path[0] = (1 - path_valid_output[0] as Field);
779765
for i in 1..OutputFields {
780-
path[i] = path_valid_output[i - 1] as Field - path_valid_output[i] as Field * path_valid_output[i - 1] as Field;
766+
path[i] = path_valid_output[i - 1] as Field
767+
- path_valid_output[i] as Field * path_valid_output[i - 1] as Field;
781768
}
782769

783770
for i in 0..OutputFields {
784-
result[i] = (last_limb - result[i]) * path[i]+ result[i];
771+
result[i] = (last_limb - result[i]) * path[i] + result[i];
785772
}
786773
result
787774
}

0 commit comments

Comments
 (0)