scalar: use newly introduced secp256k1_{read,write}_be64 helpers (4x64 impl.)
This commit is contained in:
1 parent
67214f5f7d
commit
740528caad
2 files changed
+32
-8
No files matched your search
+24
@@ -353,4 +353,28 @@ SECP256K1_INLINE static void secp256k1_write_be32(unsigned char* p, uint32_t x)
|
||||
p[0] = x >> 24;
|
||||
}
|
||||
|
||||
/* Read a uint64_t in big endian */
|
||||
SECP256K1_INLINE static uint64_t secp256k1_read_be64(const unsigned char* p) {
|
||||
return (uint64_t)p[0] << 56 |
|
||||
(uint64_t)p[1] << 48 |
|
||||
(uint64_t)p[2] << 40 |
|
||||
(uint64_t)p[3] << 32 |
|
||||
(uint64_t)p[4] << 24 |
|
||||
(uint64_t)p[5] << 16 |
|
||||
(uint64_t)p[6] << 8 |
|
||||
(uint64_t)p[7];
|
||||
}
|
||||
|
||||
/* Write a uint64_t in big endian */
|
||||
SECP256K1_INLINE static void secp256k1_write_be64(unsigned char* p, uint64_t x) {
|
||||
p[7] = x;
|
||||
p[6] = x >> 8;
|
||||
p[5] = x >> 16;
|
||||
p[4] = x >> 24;
|
||||
p[3] = x >> 32;
|
||||
p[2] = x >> 40;
|
||||
p[1] = x >> 48;
|
||||
p[0] = x >> 56;
|
||||
}
|
||||
|
||||
#endif /* SECP256K1_UTIL_H */
|
||||
Reference in new issue
Block a user