Add a secp256k1_i128_to_u64 function.
This commit is contained in:
@@ -170,8 +170,14 @@ static SECP256K1_INLINE void secp256k1_i128_rshift(secp256k1_int128 *r, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
static SECP256K1_INLINE uint64_t secp256k1_i128_to_u64(const secp256k1_int128 *a) {
|
||||
return a->lo;
|
||||
}
|
||||
|
||||
static SECP256K1_INLINE int64_t secp256k1_i128_to_i64(const secp256k1_int128 *a) {
|
||||
return (int64_t)a->lo;
|
||||
/* Verify that a represents a 64 bit signed value by checking that the high bits are a sign extension of the low bits. */
|
||||
VERIFY_CHECK(a->hi == -(a->lo >> 63));
|
||||
return (int64_t)secp256k1_i128_to_u64(a);
|
||||
}
|
||||
|
||||
static SECP256K1_INLINE void secp256k1_i128_from_i64(secp256k1_int128 *r, int64_t a) {
|
||||
|
||||
Reference in New Issue
Block a user