Define uint128_t only once in private/common.h

This commit is contained in:
Frank Denis 2017-10-21 19:59:16 +02:00
parent 58fc2dcf5b
commit 3d374fe8a9
5 changed files with 10 additions and 23 deletions

View File

@ -25,14 +25,6 @@
#include "runtime.h"
#include "utils.h"
#ifdef HAVE_TI_MODE
# if defined(__SIZEOF_INT128__)
typedef unsigned __int128 uint128_t;
# else
typedef unsigned uint128_t __attribute__((mode(TI)));
# endif
#endif
static blake2b_compress_fn blake2b_compress = blake2b_compress_ref;
static const uint64_t blake2b_IV[8] = {

View File

@ -3,11 +3,7 @@
and 128 bit addition
*/
#if defined(__SIZEOF_INT128__)
typedef unsigned __int128 uint128_t;
#else
typedef unsigned uint128_t __attribute__((mode(TI)));
#endif
#include "private/common.h"
#define MUL(out, x, y) out = ((uint128_t) x * y)
#define ADD(out, in) out += in
@ -23,8 +19,6 @@ typedef unsigned uint128_t __attribute__((mode(TI)));
# define POLY1305_NOINLINE
#endif
#include "private/common.h"
#define poly1305_block_size 16
/* 17 + sizeof(unsigned long long) + 8*sizeof(unsigned long long) */

View File

@ -19,12 +19,6 @@
typedef __m128i xmmi;
# if defined(__SIZEOF_INT128__)
typedef unsigned __int128 uint128_t;
# else
typedef unsigned uint128_t __attribute__((mode(TI)));
# endif
# if defined(_MSC_VER)
# define POLY1305_NOINLINE __declspec(noinline)
# elif defined(__GNUC__)

View File

@ -29,13 +29,12 @@
#include "../scalarmult_curve25519.h"
#include "curve25519_donna_c64.h"
#include "private/common.h"
#include "utils.h"
typedef uint8_t u8;
typedef uint64_t limb;
typedef limb felem[5];
/* Special gcc mode for 128-bit integers */
typedef unsigned uint128_t __attribute__((mode(TI)));
/* Sum two numbers: output += in */
static inline void

View File

@ -7,6 +7,14 @@
#define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1])
#ifdef HAVE_TI_MODE
# if defined(__SIZEOF_INT128__)
typedef unsigned __int128 uint128_t;
# else
typedef unsigned uint128_t __attribute__((mode(TI)));
# endif
#endif
#define ROTL32(X, B) rotl32((X), (B))
static inline uint32_t
rotl32(const uint32_t x, const int b)