diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-02-12 14:14:19 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-02-12 14:14:19 +0100 |
commit | b8045562e10fa117cd6724613a32344fa4d5c1bf (patch) | |
tree | 33d09ea0c0e6d7c2a7a9715a6b355cf4ae79acc8 /c | |
parent | c version: add inclusion guard (diff) | |
download | sha3sum-b8045562e10fa117cd6724613a32344fa4d5c1bf.tar.gz sha3sum-b8045562e10fa117cd6724613a32344fa4d5c1bf.tar.bz2 sha3sum-b8045562e10fa117cd6724613a32344fa4d5c1bf.tar.xz |
c version: instead of defining restrict as empty if not WITH_C99, define restrict_ as restrict if WITH_C99
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'c')
-rw-r--r-- | c/sha3.c | 14 | ||||
-rw-r--r-- | c/sha3.h | 7 |
2 files changed, 11 insertions, 10 deletions
@@ -275,7 +275,7 @@ static_inline long sha3_lb(long x) * @param A The current state * @param rc Round constant */ -static void sha3_keccakFRound(llong* restrict A, llong rc) +static void sha3_keccakFRound(llong* restrict_ A, llong rc) { llong da, db, dc, dd, de; @@ -336,7 +336,7 @@ static void sha3_keccakFRound(llong* restrict A, llong rc) * * @param A The current state */ -static void sha3_keccakF(llong* restrict A) +static void sha3_keccakF(llong* restrict_ A) { long i; if (nr == 24) @@ -382,7 +382,7 @@ static void sha3_keccakF(llong* restrict A) * @param off The offset in the message * @return Lane */ -static_inline llong sha3_toLane(byte* restrict message, long msglen, long rr, long ww, long off) +static_inline llong sha3_toLane(byte* restrict_ message, long msglen, long rr, long ww, long off) { llong rc = 0; long n = min(msglen, rr), i; @@ -401,7 +401,7 @@ static_inline llong sha3_toLane(byte* restrict message, long msglen, long rr, lo * @param off The offset in the message * @return Lane */ -static_inline llong sha3_toLane64(byte* restrict message, long msglen, long rr, long off) +static_inline llong sha3_toLane64(byte* restrict_ message, long msglen, long rr, long off) { long n = min(msglen, rr); return ((off + 7 < n) ? ((llong)(message[off + 7] & 255) << 56) : 0L) | @@ -424,7 +424,7 @@ static_inline llong sha3_toLane64(byte* restrict message, long msglen, long rr, * @param outlen The length of the padded message (out parameter) * @return The message padded */ -static_inline byte* sha3_pad10star1(byte* restrict msg, long len, long r, long* restrict outlen) +static_inline byte* sha3_pad10star1(byte* restrict_ msg, long len, long r, long* restrict_ outlen) { byte* message; @@ -581,7 +581,7 @@ extern void sha3_dispose() * @param msg The partial message * @param msglen The length of the partial message */ -extern void sha3_update(byte* restrict msg, long msglen) +extern void sha3_update(byte* restrict_ msg, long msglen) { long rr = r >> 3; long ww = w >> 3; @@ -659,7 +659,7 @@ extern void sha3_update(byte* restrict msg, long msglen) * @param withReturn Whether to return the hash instead of just do a quick squeeze phrase and return {@code null} * @return The hash sum, or {@code null} if <tt>withReturn</tt> is {@code false} */ -extern byte* sha3_digest(byte* restrict msg, long msglen, boolean withReturn) +extern byte* sha3_digest(byte* restrict_ msg, long msglen, boolean withReturn) { byte* message; byte* _msg; @@ -24,12 +24,13 @@ #ifdef WITH_C99 #include <inttypes.h> + #define restrict_ restrict #define byte int_fast8_t #define boolean int_fast8_t #define llong int_fast64_t #define ullong uint_fast64_t #else - #define restrict /* introduced in C99 */ + #define restrict_ /* introduced in C99 */ #define byte char #define boolean char #if __x86_64__ || __ppc64__ @@ -64,7 +65,7 @@ extern void sha3_dispose(void); * @param msg The partial message * @param msglen The length of the partial message */ -extern void sha3_update(byte* restrict msg, long msglen); +extern void sha3_update(byte* restrict_ msg, long msglen); /** @@ -75,7 +76,7 @@ extern void sha3_update(byte* restrict msg, long msglen); * @param withReturn Whether to return the hash instead of just do a quick squeeze phrase and return {@code null} * @return The hash sum, or {@code null} if <tt>withReturn</tt> is {@code false} */ -extern byte* sha3_digest(byte* restrict msg, long msglen, boolean withReturn); +extern byte* sha3_digest(byte* restrict_ msg, long msglen, boolean withReturn); /** |