Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/scalar_low_impl.h
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { | SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { | ||||
return *a == *b; | return *a == *b; | ||||
} | } | ||||
static SECP256K1_INLINE void secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scalar *a, int flag) { | static SECP256K1_INLINE void secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scalar *a, int flag) { | ||||
uint32_t mask0, mask1; | uint32_t mask0, mask1; | ||||
VG_CHECK_VERIFY(r, sizeof(*r)); | |||||
mask0 = flag + ~((uint32_t)0); | mask0 = flag + ~((uint32_t)0); | ||||
mask1 = ~mask0; | mask1 = ~mask0; | ||||
*r = (*r & mask0) | (*a & mask1); | *r = (*r & mask0) | (*a & mask1); | ||||
} | } | ||||
#endif /* SECP256K1_SCALAR_REPR_IMPL_H */ | #endif /* SECP256K1_SCALAR_REPR_IMPL_H */ |