Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
compiler.h File Reference
#include <stddef.h>
#include "portability_macros.h"

Go to the source code of this file.

Macros

#define INLINE_KEYWORD
 
#define FORCE_INLINE_ATTR
 
#define WIN_CDECL
 
#define UNUSED_ATTR
 
#define FORCE_INLINE_TEMPLATE   static INLINE_KEYWORD FORCE_INLINE_ATTR UNUSED_ATTR
 
#define HINT_INLINE   FORCE_INLINE_TEMPLATE
 
#define MEM_STATIC   static /* this version may generate warnings for unused static functions; disable the relevant warning */
 
#define FORCE_NOINLINE   static
 
#define TARGET_ATTRIBUTE(target)
 
#define BMI2_TARGET_ATTRIBUTE   TARGET_ATTRIBUTE("lzcnt,bmi,bmi2")
 
#define PREFETCH_L1(ptr)
 
#define PREFETCH_L2(ptr)
 
#define CACHELINE_SIZE   64
 
#define PREFETCH_AREA(p, s)
 
#define DONT_VECTORIZE
 
#define LIKELY(x)
 
#define UNLIKELY(x)
 
#define ZSTD_UNREACHABLE   do { assert(0); } while (0)
 
#define STATIC_BMI2   0
 
#define ZSTD_HAS_C_ATTRIBUTE(x)
 
#define ZSTD_HAS_CPP_ATTRIBUTE(x)
 
#define ZSTD_FALLTHROUGH
 
#define ZSTD_ALIGNOF(T)
 
#define ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
 

Functions

MEM_STATIC ZSTD_ALLOW_POINTER_OVERFLOW_ATTR ptrdiff_t ZSTD_wrappedPtrDiff (unsigned char const *lhs, unsigned char const *rhs)
 
MEM_STATIC ZSTD_ALLOW_POINTER_OVERFLOW_ATTR unsigned char constZSTD_wrappedPtrAdd (unsigned char const *ptr, ptrdiff_t add)
 
MEM_STATIC ZSTD_ALLOW_POINTER_OVERFLOW_ATTR unsigned char constZSTD_wrappedPtrSub (unsigned char const *ptr, ptrdiff_t sub)
 
MEM_STATIC unsigned char * ZSTD_maybeNullPtrAdd (unsigned char *ptr, ptrdiff_t add)
 

Macro Definition Documentation

◆ BMI2_TARGET_ATTRIBUTE

#define BMI2_TARGET_ATTRIBUTE   TARGET_ATTRIBUTE("lzcnt,bmi,bmi2")

◆ CACHELINE_SIZE

#define CACHELINE_SIZE   64

◆ DONT_VECTORIZE

#define DONT_VECTORIZE

◆ FORCE_INLINE_ATTR

#define FORCE_INLINE_ATTR

◆ FORCE_INLINE_TEMPLATE

#define FORCE_INLINE_TEMPLATE   static INLINE_KEYWORD FORCE_INLINE_ATTR UNUSED_ATTR

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

#define HINT_INLINE   FORCE_INLINE_TEMPLATE

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

#define INLINE_KEYWORD

◆ LIKELY

#define LIKELY ( x)
Value:
(x)

◆ 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; \
for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
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) /* disabled */

◆ PREFETCH_L2

#define PREFETCH_L2 ( ptr)
Value:
do { (void)(ptr); } while (0) /* disabled */

◆ STATIC_BMI2

#define STATIC_BMI2   0

◆ TARGET_ATTRIBUTE

#define TARGET_ATTRIBUTE ( target)

◆ UNLIKELY

#define UNLIKELY ( x)
Value:
(x)

◆ UNUSED_ATTR

#define UNUSED_ATTR

◆ WIN_CDECL

#define 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

#define ZSTD_FALLTHROUGH

◆ ZSTD_HAS_C_ATTRIBUTE

#define ZSTD_HAS_C_ATTRIBUTE ( x)
Value:
0

◆ ZSTD_HAS_CPP_ATTRIBUTE

#define ZSTD_HAS_CPP_ATTRIBUTE ( x)
Value:
0

◆ ZSTD_UNREACHABLE

#define ZSTD_UNREACHABLE   do { assert(0); } while (0)

Function Documentation

◆ 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()

MEM_STATIC ZSTD_ALLOW_POINTER_OVERFLOW_ATTR unsigned char const * ZSTD_wrappedPtrAdd ( unsigned char const * ptr,
ptrdiff_t add )

Helper function to perform a wrapped pointer add without triggering UBSAN.

Returns
ptr + add with wrapping

◆ ZSTD_wrappedPtrDiff()

MEM_STATIC ZSTD_ALLOW_POINTER_OVERFLOW_ATTR ptrdiff_t ZSTD_wrappedPtrDiff ( unsigned char const * lhs,
unsigned char const * rhs )

Helper function to perform a wrapped pointer difference without trigging UBSAN.

Returns
lhs - rhs with wrapping

◆ ZSTD_wrappedPtrSub()

MEM_STATIC ZSTD_ALLOW_POINTER_OVERFLOW_ATTR unsigned char const * ZSTD_wrappedPtrSub ( unsigned char const * ptr,
ptrdiff_t sub )

Helper function to perform a wrapped pointer subtraction without triggering UBSAN.

Returns
ptr - sub with wrapping