Add additional alignment assertions.

This commit is contained in:
Sean Bowe 2016-08-09 00:39:50 -06:00
parent 2102573efd
commit a487c8a2d8
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
1 changed files with 6 additions and 0 deletions

View File

@ -52,8 +52,14 @@ lazy_static! {
/// This must be called before anything in this module is used.
pub fn initialize() {
use std::mem::align_of;
let mut l = INIT_LOCK.lock().unwrap();
assert_eq!(align_of::<Fr>(), align_of::<libc::uint64_t>());
assert_eq!(align_of::<G1>(), align_of::<libc::uint64_t>());
assert_eq!(align_of::<G2>(), align_of::<libc::uint64_t>());
assert_eq!(align_of::<Gt>(), align_of::<libc::uint64_t>());
if !*l {
unsafe { libsnarkwrap_init(); }
*l = true;