@@ -327,44 +327,6 @@ global tail_path_multipliers_chunk0: [Field; 32] = [
327327 0x00 ,
328328];
329329
330- global LIMB_VALID_PATH : [Field ; 35 ] = [
331- 0x000000000 , // 0 0 0 0 0 0 0 0 0
332- 0x000000001 , // 0 0 0 0 0 0 0 0 1
333- 0x000000003 , // 0 0 0 0 0 0 0 1 1
334- 0x000000007 , // 0 0 0 0 0 0 1 1 1
335- 0x000000008 , // 0 0 0 0 0 1 1 1 1
336- 0x000000010 , // 0 0 0 0 1 0 0 0 0
337- 0x000000020 , // 0 0 0 1 0 0 0 0 0
338- 0x000000040 , // 0 0 1 0 0 0 0 0 0
339- 0x000000080 , // 0 1 0 0 0 0 0 0 0
340- 0x000000100 , // 1 0 0 0 0 0 0 0 0
341- 0x000000200 , // 0 0 0 0 0 0 0 1 0
342- 0x000000400 , // 0 0 0 0 0 0 1 0 0
343- 0x000000800 , // 0 0 0 0 0 1 0 0 0
344- 0x000001000 , // 0 0 0 0 1 0 0 0 0
345- 0x000002000 , // 0 0 0 1 0 0 0 0 0
346- 0x000004000 , // 0 0 1 0 0 0 0 0 0
347- 0x000008000 , // 0 1 0 0 0 0 0 0 0
348- 0x000010000 , // 0 0 0 0 0 0 0 0 1
349- 0x000020000 , // 0 0 0 0 0 0 0 1 0
350- 0x000040000 , // 0 0 0 0 0 0 1 0 0
351- 0x000080000 , // 0 0 0 0 0 1 0 0 0
352- 0x000100000 , // 0 0 0 0 1 0 0 0 0
353- 0x000200000 , // 0 0 0 1 0 0 0 0 0
354- 0x000400000 , // 0 0 1 0 0 0 0 0 0
355- 0x000800000 , // 0 1 0 0 0 0 0 0 0
356- 0x001000000 , // 0 0 0 0 0 0 0 0 1
357- 0x002000000 , // 0 0 0 0 0 0 0 1 0
358- 0x004000000 , // 0 0 0 0 0 0 1 0 0
359- 0x008000000 , // 0 0 0 0 0 1 0 0 0
360- 0x010000000 , // 0 0 0 0 1 0 0 0 0
361- 0x020000000 , // 0 0 0 1 0 0 0 0 0
362- 0x040000000 , // 0 0 1 0 0 0 0 0 0
363- 0x080000000 , // 0 1 0 0 0 0 0 0 0
364- 0x100000000 ,
365- 0x200000000 ,
366- ];
367-
368330// these path variables describe the location of a limb in an array
369331// e.g. LAST_LIMB_PATH[5] produces 2^{5-1},
370332// which is decomposed into 1 0 0 0 0, and the decompositions turned into an array M
@@ -607,7 +569,7 @@ unconstrained fn __divmod(numerator: Field, denominator: Field) -> (Field, Field
607569 * we know the quotient will fit into a 14 bit range check which will save us some fractional gates
608570 **/
609571fn divmod_31 (numerator : Field ) -> (Field , Field ) {
610- //@ Safety: we check the bit lengths of qf and rf and their relation to the numerator with assertions later
572+ // Safety: we check the bit lengths of qf and rf and their relation to the numerator with assertions later
611573 let (quotient , remainder ) = unsafe { __divmod (numerator , 31 ) };
612574
613575 let qf = quotient as Field ;
@@ -642,7 +604,7 @@ unconstrained fn decompose(val: Field) -> [Field; 16] {
642604pub fn get_last_limb_path <let OutputFields : u32 >(last_limb_index : Field ) -> [Field ; OutputFields ] {
643605 // 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)
644606 let path = LAST_LIMB_PATH [last_limb_index + 1 ]; // 2
645- //@ Safety: check the comments below
607+ // Safety: check the comments below
646608 let path_valid_bits = unsafe { decompose (path ) };
647609 let mut path_valid_sum : Field = 0 ;
648610 let mut path_valid_output : [Field ; OutputFields ] = [0 ; OutputFields ];
@@ -663,7 +625,7 @@ pub fn get_last_limb_path<let OutputFields: u32>(last_limb_index: Field) -> [Fie
663625 * @details cost 46 gates
664626 **/
665627pub fn slice_field (f : Field , num_bytes : Field ) -> (Field , Field ) {
666- //@ Safety: we check the bit lengths of the chunks with assertions later
628+ // Safety: we check the bit lengths of the chunks with assertions later
667629 let chunks = unsafe { __slice_field (f , num_bytes ) };
668630 chunks [0 ].assert_max_bit_size ::<8 >(); // 1.25 gates
669631 chunks [1 ].assert_max_bit_size ::<16 >(); // 1.5 gates
@@ -868,7 +830,7 @@ mod test {
868830 // let start_byte = 26;
869831 let num_bytes = 0 ;
870832 let start_byte : u32 = 0 ;
871- //@ Safety: this is a test
833+ // Safety: this is a test
872834 let mut expected_slices : [Field ; 3 ] =
873835 unsafe { build_slices_for_test (text , start_byte , num_bytes ) };
874836 let result_slices : [Field ; 3 ] =
@@ -901,19 +863,18 @@ mod test {
901863 let num_bytes = byte_sizes [i ];
902864 for j in 0 ..18 {
903865 let start_byte : u32 = byte_positions [j ];
866+ // Safety: this is a test
904867 let mut expected_slices : [Field ; 3 ] =
905- //@Safety: this is a test
906868 unsafe { build_slices_for_test (text , start_byte , num_bytes ) };
907869 let result_slices : [Field ; 3 ] =
908- //@Safety: this is a test
909- unsafe { slice_fields (slices , start_byte as Field , num_bytes as Field ) };
870+ slice_fields (slices , start_byte as Field , num_bytes as Field );
910871 assert (result_slices == expected_slices );
911872 }
912873
913874 for j in 0 ..18 {
914875 let start_byte : u32 = text .len () - num_bytes - byte_positions [j ];
915876 let mut expected_slices : [Field ; 3 ] =
916- //@ Safety: this is a test
877+ // Safety: this is a test
917878 unsafe { build_slices_for_test (text , start_byte , num_bytes ) };
918879 let result_slices : [Field ; 3 ] =
919880 slice_fields (slices , start_byte as Field , num_bytes as Field );
0 commit comments