return u64;
}
+// Return the absolute value of a BIGNUM as a 64-bit unsigned integer.
+// Requires that BIGNUM fits into 64 bits.
+inline static uint64 BN_ext_get_uint64(const BIGNUM* bn) {
+ uint64 r;
+#ifdef IS_LITTLE_ENDIAN
+ S2_CHECK_EQ(BN_bn2lebinpad(bn, reinterpret_cast<unsigned char*>(&r),
+ sizeof(r)), sizeof(r));
+#elif IS_BIG_ENDIAN
+ S2_CHECK_EQ(BN_bn2binpad(bn, reinterpret_cast<unsigned char*>(&r),
+ sizeof(r)), sizeof(r));
+#else
+#error one of IS_LITTLE_ENDIAN or IS_BIG_ENDIAN should be defined!
+#endif
+ return r;
+}
+
static int BN_ext_count_low_zero_bits(const BIGNUM* bn) {
return BN_count_low_zero_bits(bn);
}