sdlGetSimdAlignment function

int sdlGetSimdAlignment()

Report the alignment this system needs for SIMD allocations.

This will return the minimum number of bytes to which a pointer must be aligned to be compatible with SIMD instructions on the current machine. For example, if the machine supports SSE only, it will return 16, but if it supports AVX-512F, it'll return 64 (etc). This only reports values for instruction sets SDL knows about, so if your SDL build doesn't have SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and not 64 for the AVX-512 instructions that exist but SDL doesn't know about. Plan accordingly.

\returns the alignment in bytes needed for available, known SIMD instructions.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_aligned_alloc \sa SDL_aligned_free

extern SDL_DECLSPEC size_t SDLCALL SDL_GetSIMDAlignment(void)

Implementation

int sdlGetSimdAlignment() {
  final sdlGetSimdAlignmentLookupFunction =
      libSdl3.lookupFunction<Uint32 Function(), int Function()>(
          'SDL_GetSIMDAlignment');
  return sdlGetSimdAlignmentLookupFunction();
}