@@ -113,8 +113,22 @@ macro_rules! pippenger_mult_impl {
113
113
ret
114
114
}
115
115
116
+ #[ inline]
116
117
pub fn mult( & self , scalars: & [ u8 ] , nbits: usize ) -> $point {
117
- let npoints = self . points. len( ) ;
118
+ self . as_slice( ) . mult( scalars, nbits)
119
+ }
120
+
121
+ #[ inline]
122
+ pub fn add( & self ) -> $point {
123
+ self . as_slice( ) . add( )
124
+ }
125
+ }
126
+
127
+ impl MultiPoint for [ $point_affine] {
128
+ type Output = $point;
129
+
130
+ fn mult( & self , scalars: & [ u8 ] , nbits: usize ) -> $point {
131
+ let npoints = self . len( ) ;
118
132
let nbytes = ( nbits + 7 ) / 8 ;
119
133
120
134
if scalars. len( ) < nbytes * npoints {
@@ -124,8 +138,7 @@ macro_rules! pippenger_mult_impl {
124
138
let pool = mt:: da_pool( ) ;
125
139
let ncpus = pool. max_count( ) ;
126
140
if ncpus < 2 || npoints < 32 {
127
- let p: [ * const $point_affine; 2 ] =
128
- [ & self . points[ 0 ] , ptr:: null( ) ] ;
141
+ let p: [ * const $point_affine; 2 ] = [ & self [ 0 ] , ptr:: null( ) ] ;
129
142
let s: [ * const u8 ; 2 ] = [ & scalars[ 0 ] , ptr:: null( ) ] ;
130
143
131
144
unsafe {
@@ -178,7 +191,7 @@ macro_rules! pippenger_mult_impl {
178
191
}
179
192
let grid = & grid[ ..] ;
180
193
181
- let points = & self . points [ ..] ;
194
+ let points = & self [ ..] ;
182
195
let sz = unsafe { $scratch_sizeof( 0 ) / 8 } ;
183
196
184
197
let mut row_sync: Vec <AtomicUsize > = Vec :: with_capacity( ny) ;
@@ -262,13 +275,13 @@ macro_rules! pippenger_mult_impl {
262
275
ret
263
276
}
264
277
265
- pub fn add( & self ) -> $point {
266
- let npoints = self . points . len( ) ;
278
+ fn add( & self ) -> $point {
279
+ let npoints = self . len( ) ;
267
280
268
281
let pool = mt:: da_pool( ) ;
269
282
let ncpus = pool. max_count( ) ;
270
283
if ncpus < 2 || npoints < 384 {
271
- let p: [ * const _; 2 ] = [ & self . points [ 0 ] , ptr:: null( ) ] ;
284
+ let p: [ * const _; 2 ] = [ & self [ 0 ] , ptr:: null( ) ] ;
272
285
let mut ret = <$point>:: default ( ) ;
273
286
unsafe { $add( & mut ret, & p[ 0 ] , npoints) } ;
274
287
return ret;
@@ -295,7 +308,7 @@ macro_rules! pippenger_mult_impl {
295
308
if work >= npoints {
296
309
break ;
297
310
}
298
- p[ 0 ] = & self . points [ work] ;
311
+ p[ 0 ] = & self [ work] ;
299
312
if work + chunk > npoints {
300
313
chunk = npoints - work;
301
314
}
@@ -345,7 +358,7 @@ pippenger_mult_impl!(
345
358
blst_p1s_tile_pippenger,
346
359
blst_p1_add_or_double,
347
360
blst_p1_double,
348
- p1_multi_scalar ,
361
+ p1_multi_point ,
349
362
blst_p1_generator,
350
363
blst_p1_mult,
351
364
blst_p1s_add,
@@ -361,7 +374,7 @@ pippenger_mult_impl!(
361
374
blst_p2s_tile_pippenger,
362
375
blst_p2_add_or_double,
363
376
blst_p2_double,
364
- p2_multi_scalar ,
377
+ p2_multi_point ,
365
378
blst_p2_generator,
366
379
blst_p2_mult,
367
380
blst_p2s_add,
0 commit comments