12#ifndef __DECAF_COMMON_H__
13#define __DECAF_COMMON_H__ 1
26#if DOXYGEN || defined(__attribute__)
27#define __attribute__(x)
33# define __attribute__(x)
34# define __attribute(x)
35# define __restrict__ __restrict
37# define DECAF_API_VIS __declspec(dllexport)
39# define DECAF_API_VIS __declspec(dllimport)
46#define DECAF_API_VIS __attribute__((visibility("default")))
47#define DECAF_API_IMPORT
51#define DECAF_NOINLINE __attribute__((noinline))
52#define DECAF_INLINE inline __attribute__((always_inline,unused))
53#define DECAF_WARN_UNUSED __attribute__((warn_unused_result))
54#define DECAF_NONNULL __attribute__((nonnull))
56#if defined (__clang_major__) && __clang_major__ >= 3 \
57 || defined (__GNUC__) && __GNUC__ >= 5 \
58 || defined (__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 5
59#define DECAF_DEPRECATED(msg) __attribute__ ((deprecated(msg)))
61#define DECAF_DEPRECATED(msg) __attribute__ ((deprecated))
72#ifndef DECAF_WORD_BITS
73 #if (defined(__ILP64__) || defined(__amd64__) || defined(__x86_64__) || (((__UINT_FAST32_MAX__)>>30)>>30))
74 #define DECAF_WORD_BITS 64
76 #define DECAF_WORD_BITS 32
80#if DECAF_WORD_BITS == 64
86#elif DECAF_WORD_BITS == 32
93#error "Only supporting DECAF_WORD_BITS = 32 or 64 for now"
98#if DECAF_WORD_BITS == 64
105#elif DECAF_WORD_BITS == 32
113#error "Only supporting DECAF_WORD_BITS = 32 or 64 for now"
151) DECAF_NONNULL DECAF_WARN_UNUSED;
int64_t decaf_dsword_t
Signed double-word size for internal computations.
Definition: common.h:91
void DECAF_API_VIS decaf_bzero(void *data, size_t size) DECAF_NONNULL
Overwrite data with zeros.
int32_t decaf_sword_t
Signed word size for internal computations.
Definition: common.h:88
decaf_bool_t DECAF_API_VIS decaf_memeq(const void *data1, const void *data2, size_t size) DECAF_NONNULL DECAF_WARN_UNUSED
Compare two buffers, returning DECAF_TRUE if they are equal.
#define DECAF_WORD_BITS
The number of bits in a word.
Definition: common.h:76
uint64_t decaf_dword_t
Double-word size for internal computations.
Definition: common.h:90
uint32_t decaf_bool_t
"Boolean" type, will be set to all-zero or all-one (i.e.
Definition: common.h:89
uint32_t decaf_word_t
Word size for internal computations.
Definition: common.h:87
decaf_error_t
Another boolean type used to indicate success or failure.
Definition: common.h:120
@ DECAF_FAILURE
The operation failed.
Definition: common.h:122
@ DECAF_SUCCESS
The operation succeeded.
Definition: common.h:121