Merge pull request #60 from gavofyork/tinykeccak_c99
Fixing tinykeccak to compile with c99 mode
This commit is contained in:
commit
9d75452a17
@ -147,5 +147,5 @@ fn break_it() {
|
|||||||
let h: Bytes = FromHex::from_hex("f84d0589010efbef67941f79b2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").unwrap();
|
let h: Bytes = FromHex::from_hex("f84d0589010efbef67941f79b2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").unwrap();
|
||||||
let r: Rlp = Rlp::new(&h);
|
let r: Rlp = Rlp::new(&h);
|
||||||
let u: U256 = r.val_at(1);
|
let u: U256 = r.val_at(1);
|
||||||
assert_eq!(format!("{}", u), "0x10efbef67941f79b2");
|
assert_eq!(format!("{}", u), "19526463837540678066");
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,9 @@ static inline void keccakf(void* state) {
|
|||||||
uint64_t b[5] = {0};
|
uint64_t b[5] = {0};
|
||||||
uint64_t t = 0;
|
uint64_t t = 0;
|
||||||
uint8_t x, y;
|
uint8_t x, y;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (int i = 0; i < 24; i++) {
|
for (i = 0; i < 24; i++) {
|
||||||
// Theta
|
// Theta
|
||||||
FOR5(x, 1,
|
FOR5(x, 1,
|
||||||
b[x] = 0;
|
b[x] = 0;
|
||||||
@ -96,7 +97,7 @@ static inline void keccakf(void* state) {
|
|||||||
|
|
||||||
#define _(S) do { S } while (0)
|
#define _(S) do { S } while (0)
|
||||||
#define FOR(i, ST, L, S) \
|
#define FOR(i, ST, L, S) \
|
||||||
_(for (size_t i = 0; i < L; i += ST) { S; })
|
_({size_t i; for (i = 0; i < L; i += ST) { S; }})
|
||||||
#define mkapply_ds(NAME, S) \
|
#define mkapply_ds(NAME, S) \
|
||||||
static inline void NAME(uint8_t* dst, \
|
static inline void NAME(uint8_t* dst, \
|
||||||
const uint8_t* src, \
|
const uint8_t* src, \
|
||||||
|
Loading…
Reference in New Issue
Block a user