Ordo  0.3.4
Symmetric Cryptography Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
implementation.h
Go to the documentation of this file.
1 /*===-- internal/implementation.h---------------------*- INTERNAL -*- H -*-===*/
13 /*===----------------------------------------------------------------------===*/
14 
15 #ifndef ORDO_IMPLEMENTATION_H
16 #define ORDO_IMPLEMENTATION_H
17 
18 /*===----------------------------------------------------------------------===*/
19 
20 #if !(defined(ORDO_INTERNAL_ACCESS) && defined(ORDO_STATIC_LIB))
21  #if !(defined(BUILDING_ORDO) || defined(BUILDING_ordo))
22  #error "This header is internal to the Ordo library."
23  #endif
24 #endif
25 
26 /* Internal function namespacing to prevent static name conflicts. */
27 
28 #define rol16 ordo_rol16_internal
29 #define ror16 ordo_ror16_internal
30 #define rol32 ordo_rol32_internal
31 #define ror32 ordo_ror32_internal
32 #define rol64 ordo_rol64_internal
33 #define ror64 ordo_ror64_internal
34 #define smin ordo_smin_internal
35 #define smax ordo_smax_internal
36 #define pswap8 ordo_pswap8_internal
37 #define pswap16 ordo_pswap16_internal
38 #define pswap32 ordo_pswap32_internal
39 #define pswap64 ordo_pswap64_internal
40 #define pad_check ordo_pad_check_internal
41 #define xor_buffer ordo_xor_buffer_internal
42 #define inc_buffer ordo_inc_buffer_internal
43 
44 /*===----------------------------------------------------------------------===*/
45 
47 #include "ordo/misc/endianness.h"
48 #include "ordo/common/error.h"
49 #include "ordo/common/query.h"
50 #include "ordo/internal/alg.h"
51 #include "ordo/internal/sys.h"
52 
53 #include <stdlib.h>
54 #include <string.h>
57 /*===----------------------------------------------------------------------===*/
58 
59 #ifdef OPAQUE
60  #undef OPAQUE
61 #endif
62 
63 #if defined(__clang__)\
64  || defined(__INTEL_COMPILER)\
65  || defined(__GNUC__)\
66  || defined(__MINGW32__)
67  #define ALIGN(x) __attribute__((aligned(x)))
68 #elif defined(_MSC_VER)
69  #define ALIGN(x) __declspec(align(x))
70 #endif
71 
72 #if defined(__clang__) || defined(__INTEL_COMPILER)
73  #define HOT_CODE __attribute__((hot))
74  #define COLD_CODE __attribute__((cold))
75 #elif defined(__GNUC__) || defined(__MINGW32__)
76  #define GCC_VERSION (__GNUC__ * 10000 \
77  + __GNUC_MINOR__ * 100 \
78  + __GNUC_PATCHLEVEL__)
79 
80  #if GCC_VERSION >= 40300 /* >= v4.3 support needed */
81  #define HOT_CODE __attribute__((hot))
82  #define COLD_CODE __attribute__((cold))
83  #else
84  #define HOT_CODE
85  #define COLD_CODE
86  #endif
87 
88  #undef GCC_VERSION
89 #elif defined(_MSC_VER)
90  #define HOT_CODE
91  #define COLD_CODE
92 #endif
93 
94 /*===----------------------------------------------------------------------===*/
95 
96 #endif
Utility.
Internal, Utility
Utility.
Utility.
Internal, Utility