@@ -327,44 +327,6 @@ global tail_path_multipliers_chunk0: [Field; 32] = [
327
327
0x00 ,
328
328
];
329
329
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
-
368
330
// these path variables describe the location of a limb in an array
369
331
// e.g. LAST_LIMB_PATH[5] produces 2^{5-1},
370
332
// 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
607
569
* we know the quotient will fit into a 14 bit range check which will save us some fractional gates
608
570
**/
609
571
fn 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
611
573
let (quotient , remainder ) = unsafe { __divmod (numerator , 31 ) };
612
574
613
575
let qf = quotient as Field ;
@@ -642,7 +604,7 @@ unconstrained fn decompose(val: Field) -> [Field; 16] {
642
604
pub fn get_last_limb_path <let OutputFields : u32 >(last_limb_index : Field ) -> [Field ; OutputFields ] {
643
605
// 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)
644
606
let path = LAST_LIMB_PATH [last_limb_index + 1 ]; // 2
645
- //@ Safety: check the comments below
607
+ // Safety: check the comments below
646
608
let path_valid_bits = unsafe { decompose (path ) };
647
609
let mut path_valid_sum : Field = 0 ;
648
610
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
663
625
* @details cost 46 gates
664
626
**/
665
627
pub 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
667
629
let chunks = unsafe { __slice_field (f , num_bytes ) };
668
630
chunks [0 ].assert_max_bit_size ::<8 >(); // 1.25 gates
669
631
chunks [1 ].assert_max_bit_size ::<16 >(); // 1.5 gates
@@ -868,7 +830,7 @@ mod test {
868
830
// let start_byte = 26;
869
831
let num_bytes = 0 ;
870
832
let start_byte : u32 = 0 ;
871
- //@ Safety: this is a test
833
+ // Safety: this is a test
872
834
let mut expected_slices : [Field ; 3 ] =
873
835
unsafe { build_slices_for_test (text , start_byte , num_bytes ) };
874
836
let result_slices : [Field ; 3 ] =
@@ -901,19 +863,18 @@ mod test {
901
863
let num_bytes = byte_sizes [i ];
902
864
for j in 0 ..18 {
903
865
let start_byte : u32 = byte_positions [j ];
866
+ // Safety: this is a test
904
867
let mut expected_slices : [Field ; 3 ] =
905
- //@Safety: this is a test
906
868
unsafe { build_slices_for_test (text , start_byte , num_bytes ) };
907
869
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 );
910
871
assert (result_slices == expected_slices );
911
872
}
912
873
913
874
for j in 0 ..18 {
914
875
let start_byte : u32 = text .len () - num_bytes - byte_positions [j ];
915
876
let mut expected_slices : [Field ; 3 ] =
916
- //@ Safety: this is a test
877
+ // Safety: this is a test
917
878
unsafe { build_slices_for_test (text , start_byte , num_bytes ) };
918
879
let result_slices : [Field ; 3 ] =
919
880
slice_fields (slices , start_byte as Field , num_bytes as Field );
0 commit comments