@@ -33,12 +33,6 @@ impl SampleScalarsStaticLengthKMalloc {
33
33
. try_into ( )
34
34
. unwrap ( )
35
35
}
36
-
37
- pub ( crate ) fn scalars_kmalloc_name ( & self ) -> String {
38
- let num_elements_to_sample = self . num_elements_to_sample ;
39
- let extra_capacity = self . extra_capacity ;
40
- format ! ( "scalars_kmalloc_{num_elements_to_sample}_{extra_capacity}" )
41
- }
42
36
}
43
37
44
38
impl BasicSnippet for SampleScalarsStaticLengthKMalloc {
@@ -60,6 +54,10 @@ impl BasicSnippet for SampleScalarsStaticLengthKMalloc {
60
54
fn code ( & self , library : & mut Library ) -> Vec < LabelledInstruction > {
61
55
assert_eq ! ( 10 , tip5:: RATE , "Code assumes Tip5's RATE is 10" ) ;
62
56
assert_eq ! ( 3 , EXTENSION_DEGREE , "Code assumes extension degree 3" ) ;
57
+ assert ! (
58
+ self . extra_capacity + self . num_elements_to_sample > 0 ,
59
+ "Must allocate positive number of words"
60
+ ) ;
63
61
let num_squeezes =
64
62
SampleScalarsStaticLengthDynMalloc :: num_squeezes ( self . num_elements_to_sample ) ;
65
63
@@ -73,8 +71,7 @@ impl BasicSnippet for SampleScalarsStaticLengthKMalloc {
73
71
let entrypoint = self . entrypoint ( ) ;
74
72
let squeeze_repeatedly_static_number =
75
73
library. import ( Box :: new ( SqueezeRepeatedlyStaticNumber { num_squeezes } ) ) ;
76
- let scalars_pointer =
77
- library. pub_kmalloc ( self . num_words_to_allocate ( ) , self . scalars_kmalloc_name ( ) ) ;
74
+ let scalars_pointer = library. kmalloc ( self . num_words_to_allocate ( ) ) ;
78
75
79
76
triton_asm ! (
80
77
{ entrypoint} :
@@ -182,8 +179,8 @@ pub(crate) mod tests {
182
179
183
180
#[ proptest]
184
181
fn verify_agreement_with_tip5_sample_scalars (
185
- #[ strategy( 0_usize ..500 ) ] num_elements_to_sample : usize ,
186
- #[ strategy( 0_usize ..500 ) ] extra_capacity : usize ,
182
+ #[ strategy( 1_usize ..500 ) ] num_elements_to_sample : usize ,
183
+ #[ strategy( 1_usize ..500 ) ] extra_capacity : usize ,
187
184
#[ strategy( arb( ) ) ] mut sponge : Tip5 ,
188
185
) {
189
186
let snippet = SampleScalarsStaticLengthKMalloc {
0 commit comments