From d0b589749ad9af2f3e0590e415bef3e2830ef1f5 Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Fri, 22 Jan 2016 21:18:52 -0700 Subject: [PATCH] Force FieldT alignment --- tinysnark/src/arith.rs | 6 +++++- tinysnark/src/lib.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tinysnark/src/arith.rs b/tinysnark/src/arith.rs index bf106af..31d7815 100644 --- a/tinysnark/src/arith.rs +++ b/tinysnark/src/arith.rs @@ -12,9 +12,13 @@ extern "C" { fn tinysnark_fieldt_add(a: FieldT, b: FieldT) -> FieldT; } +#[derive(Copy, Clone, Debug)] +#[repr(simd)] +struct EightBytes(u64); + #[derive(Copy, Clone, Debug)] #[repr(C)] -pub struct FieldT([u8; 32]); +pub struct FieldT([u8; 32], [EightBytes; 0]); impl FieldT { #[inline(always)] diff --git a/tinysnark/src/lib.rs b/tinysnark/src/lib.rs index 83084cf..7c90b9f 100644 --- a/tinysnark/src/lib.rs +++ b/tinysnark/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(box_syntax)] +#![feature(box_syntax, repr_simd)] #![allow(improper_ctypes)] //#![cfg_attr(test, feature(test))] extern crate libc;