diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-19 20:28:55 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-19 20:28:55 +0100 |
commit | 5d77a0178349ecac6536e0374cf689500efa22bc (patch) | |
tree | f6fcb38cd39e8f4240537233a08fdbb5c0284798 /common.h | |
parent | Improve portability (diff) | |
download | libblake-5d77a0178349ecac6536e0374cf689500efa22bc.tar.gz libblake-5d77a0178349ecac6536e0374cf689500efa22bc.tar.bz2 libblake-5d77a0178349ecac6536e0374cf689500efa22bc.tar.xz |
Optimisation for amd64
Increased major number as the ABI was broken
by insertion of padding into the BLAKE2
parameter structures (except for BLAKE2Xs)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | common.h | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -24,9 +24,38 @@ #endif #if defined(__GNUC__) -# define HIDDEN __attribute__((__visibility__("hidden"))) +# define HIDDEN __attribute__((visibility("hidden"))) +# define LIKELY(X) __builtin_expect(!!(X), 1) +# define UNLIKELY(X) __builtin_expect(!!(X), 0) +# define ASSUMING_CONSTANT(X) (__builtin_constant_p(X) && (X)) #else # define HIDDEN +# define LIKELY(X) X +# define UNLIKELY(X) X +# define ASSUMING_CONSTANT(X) 0 +# if defined(__has_builtin) +# if __has_builtin(__builtin_expect) +# undef LIKELY +# undef UNLIKELY +# define LIKELY(X) __builtin_expect(!!(X), 1) +# define UNLIKELY(X) __builtin_expect(!!(X), 0) +# endif +# if __has_builtin(__builtin_constant_p) +# undef ASSUMING_CONSTANT +# define ASSUMING_CONSTANT(X) (__builtin_constant_p(X) && (X)) +# endif +# endif +#endif +#if defined(__has_builtin) +# define HAS_BUILTIN(X) __has_builtin(X) +#else +# define HAS_BUILTIN(X) 0 +#endif + +#if defined(__x86_64__) || defined(__i386__) +# define LITTLE_ENDIAN +#else +# error Endian is unknown #endif #define A 10 |