@@ -138,17 +138,17 @@ SECP256K1_INLINE static void secp256k1_ecmult_table_get_ge_lambda(secp256k1_ge *
138138 }
139139}
140140
141- #define ECMULT_TABLE_GET_GE_STORAGE ( r , pre ,n , w ) do { \
142- VERIFY_CHECK(((n) & 1) == 1); \
143- VERIFY_CHECK((n) >= -((1 << ((w) -1)) - 1)); \
144- VERIFY_CHECK((n) <= ((1 << ((w) -1)) - 1)); \
145- if ((n) > 0) { \
146- secp256k1_ge_from_storage((r) , &( pre)[((n) -1)/2]); \
147- } else { \
148- secp256k1_ge_from_storage((r) , &( pre) [(-(n) -1)/2]); \
149- secp256k1_fe_negate(&((r) ->y), &((r) ->y), 1); \
150- } \
151- } while(0)
141+ SECP256K1_INLINE static void secp256k1_ecmult_table_get_ge_storage ( secp256k1_ge * r , const secp256k1_ge_storage * pre , int n , int w ) {
142+ VERIFY_CHECK ((n & 1 ) == 1 );
143+ VERIFY_CHECK (n >= - ((1 << (w - 1 )) - 1 ));
144+ VERIFY_CHECK (n <= ((1 << (w - 1 )) - 1 ));
145+ if (n > 0 ) {
146+ secp256k1_ge_from_storage (r , & pre [( n - 1 )/2 ]);
147+ } else {
148+ secp256k1_ge_from_storage (r , & pre [(- n - 1 )/2 ]);
149+ secp256k1_fe_negate (& (r -> y ), & (r -> y ), 1 );
150+ }
151+ }
152152
153153/** Convert a number to WNAF notation. The number becomes represented by sum(2^i * wnaf[i], i=0..bits),
154154 * with the following guarantees:
@@ -322,11 +322,11 @@ static void secp256k1_ecmult_strauss_wnaf(const struct secp256k1_strauss_state *
322322 }
323323 }
324324 if (i < bits_ng_1 && (n = wnaf_ng_1 [i ])) {
325- ECMULT_TABLE_GET_GE_STORAGE (& tmpa , secp256k1_pre_g , n , WINDOW_G );
325+ secp256k1_ecmult_table_get_ge_storage (& tmpa , secp256k1_pre_g , n , WINDOW_G );
326326 secp256k1_gej_add_zinv_var (r , r , & tmpa , & Z );
327327 }
328328 if (i < bits_ng_128 && (n = wnaf_ng_128 [i ])) {
329- ECMULT_TABLE_GET_GE_STORAGE (& tmpa , secp256k1_pre_g_128 , n , WINDOW_G );
329+ secp256k1_ecmult_table_get_ge_storage (& tmpa , secp256k1_pre_g_128 , n , WINDOW_G );
330330 secp256k1_gej_add_zinv_var (r , r , & tmpa , & Z );
331331 }
332332 }
0 commit comments