#include <stddef.h>
#include "portability_macros.h"
Go to the source code of this file.
◆ BMI2_TARGET_ATTRIBUTE
◆ CACHELINE_SIZE
#define CACHELINE_SIZE 64 |
◆ DONT_VECTORIZE
◆ FORCE_INLINE_ATTR
#define FORCE_INLINE_ATTR |
◆ FORCE_INLINE_TEMPLATE
FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant parameters. They must be inlined for the compiler to eliminate the constant branches.
◆ FORCE_NOINLINE
#define FORCE_NOINLINE static |
◆ HINT_INLINE
HINT_INLINE is used to help the compiler generate better code. It is not used for "templates", so it can be tweaked based on the compilers performance.
gcc-4.8 and gcc-4.9 have been shown to benefit from leaving off the always_inline attribute.
clang up to 5.0.0 (trunk) benefit tremendously from the always_inline attribute.
◆ INLINE_KEYWORD
◆ LIKELY
◆ MEM_STATIC
#define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ |
◆ PREFETCH_AREA
#define PREFETCH_AREA |
( |
| p, |
|
|
| s ) |
Value: do { \
const char* const _ptr = (const char*)(p); \
size_t const _size = (size_t)(s); \
size_t _pos; \
PREFETCH_L2(_ptr + _pos); \
} \
} while (0)
#define CACHELINE_SIZE
Definition compiler.h:131
◆ PREFETCH_L1
#define PREFETCH_L1 |
( |
| ptr | ) |
|
Value:do { (void)(ptr); } while (0)
◆ PREFETCH_L2
#define PREFETCH_L2 |
( |
| ptr | ) |
|
Value:do { (void)(ptr); } while (0)
◆ STATIC_BMI2
◆ TARGET_ATTRIBUTE
#define TARGET_ATTRIBUTE |
( |
| target | ) |
|
◆ UNLIKELY
◆ UNUSED_ATTR
◆ WIN_CDECL
On MSVC qsort requires that functions passed into it use the __cdecl calling conversion(CC). This explicitly marks such functions as __cdecl so that the code will still compile if a CC other than __cdecl has been made the default.
◆ ZSTD_ALIGNOF
#define ZSTD_ALIGNOF |
( |
| T | ) |
|
Value:(sizeof(void*) < sizeof(T) ? sizeof(void*) : sizeof(T))
◆ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
#define ZSTD_ALLOW_POINTER_OVERFLOW_ATTR |
Zstd relies on pointer overflow in its decompressor. We add this attribute to functions that rely on pointer overflow.
◆ ZSTD_FALLTHROUGH
◆ ZSTD_HAS_C_ATTRIBUTE
#define ZSTD_HAS_C_ATTRIBUTE |
( |
| x | ) |
|
◆ ZSTD_HAS_CPP_ATTRIBUTE
#define ZSTD_HAS_CPP_ATTRIBUTE |
( |
| x | ) |
|
◆ ZSTD_UNREACHABLE
◆ ZSTD_maybeNullPtrAdd()
MEM_STATIC unsigned char * ZSTD_maybeNullPtrAdd |
( |
unsigned char * | ptr, |
|
|
ptrdiff_t | add ) |
Helper function to add to a pointer that works around C's undefined behavior of adding 0 to NULL.
- Returns
ptr + add
except it defines NULL + 0 == NULL
.
◆ ZSTD_wrappedPtrAdd()
Helper function to perform a wrapped pointer add without triggering UBSAN.
- Returns
- ptr + add with wrapping
◆ ZSTD_wrappedPtrDiff()
Helper function to perform a wrapped pointer difference without trigging UBSAN.
- Returns
- lhs - rhs with wrapping
◆ ZSTD_wrappedPtrSub()
Helper function to perform a wrapped pointer subtraction without triggering UBSAN.
- Returns
- ptr - sub with wrapping