Simple Graphics Library 1.0.0.0
Runtime-independent image processing primitives
Loading...
Searching...
No Matches
sgl-compiler.h File Reference

Portable compiler attributes, branch hints, and prefetch helpers. More...

Go to the source code of this file.

Macros

#define SGL_PREFETCH_RW_READ   (0)
 Read intent passed to SGL_PREFETCH.
 
#define SGL_PREFETCH_RW_WRITE   (1)
 Write intent passed to SGL_PREFETCH.
 
#define SGL_PREFETCH_LOCALITY_NON_TEMPORAL   (0)
 Prefetched data is unlikely to be reused.
 
#define SGL_PREFETCH_LOCALITY_LOW   (1)
 Prefetched data has low temporal locality.
 
#define SGL_PREFETCH_LOCALITY_MODERATE   (2)
 Prefetched data has moderate temporal locality.
 
#define SGL_PREFETCH_LOCALITY_HIGH   (3)
 Prefetched data has high temporal locality.
 
#define SGL_ALWAYS_INLINE   inline
 Requests compiler-enforced inlining.
 
#define SGL_NOINLINE
 Prevents compiler inlining.
 
#define SGL_RESTRICT
 Declares a non-aliasing pointer contract.
 
#define SGL_ALIGNED(n)
 Requests alignment of n bytes.
 
#define SGL_PACKED
 Requests packed aggregate layout.
 
#define SGL_NORETURN
 Marks a function that never returns.
 
#define SGL_DEPRECATED(message)
 Marks an API deprecated with message.
 
#define SGL_WARN_UNUSED_RESULT
 Warns when a function result is ignored.
 
#define SGL_LIKELY(expression)   (!!(expression))
 Marks expression as the expected branch outcome.
 
#define SGL_UNLIKELY(expression)   (!!(expression))
 Marks expression as an unexpected branch outcome.
 
#define SGL_FALLTHROUGH
 Marks intentional switch fallthrough.
 
#define SGL_UNREACHABLE()   ((void)0)
 Declares the current control path unreachable.
 
#define SGL_CPU_RELAX()   ((void)0)
 Emits a target-specific spin-wait hint.
 
#define SGL_PREFETCH(address, byte_distance, rw, locality)    ((void)(address), (void)(byte_distance), (void)(rw), (void)(locality))
 Prefetches the address at byte_distance using rw and locality.
 
#define SGL_PREFETCH_READ(address, byte_distance)
 Prefetches a high-locality read at byte_distance from address.
 
#define SGL_PREFETCH_WRITE(address, byte_distance)
 Prefetches a high-locality write at byte_distance from address.
 
#define SGL_UNUSED(value)   ((void)(value))
 Evaluates value and explicitly discards it.
 

Detailed Description

Portable compiler attributes, branch hints, and prefetch helpers.

Definition in file sgl-compiler.h.