Simple Graphics Library 1.0.0.0
Runtime-independent image processing primitives
Loading...
Searching...
No Matches
Compiler portability

Source-level abstraction over supported compiler extensions. More...

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

Source-level abstraction over supported compiler extensions.

Macro Definition Documentation

◆ SGL_PREFETCH_RW_READ

#define SGL_PREFETCH_RW_READ   (0)

Read intent passed to SGL_PREFETCH.

Prefetch contract

byte_distance is the look-ahead offset from address, not a byte count to load. The caller must keep address + byte_distance within the same allocated object. A distance of zero prefetches address itself. Prefetch is an optional performance hint and unsupported compilers keep this API as a no-op. rw and locality must be compile-time constants for GCC and Clang.

Definition at line 31 of file sgl-compiler.h.