# HG changeset patch # User Sam Lantinga # Date 1296190005 28800 # Node ID b3f075368b1fbcbcfcfa5289a4bf848c03c49c1e # Parent edd0f0617be4a3cc6a093084d3744b0a2ca48a11 Added API function to get CPU cache line size. diff -r edd0f0617be4 -r b3f075368b1f include/SDL_cpuinfo.h --- a/include/SDL_cpuinfo.h Thu Jan 27 20:37:54 2011 -0800 +++ b/include/SDL_cpuinfo.h Thu Jan 27 20:46:45 2011 -0800 @@ -52,6 +52,14 @@ extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); /** + * This function returns the L1 cache line size of the CPU + * + * This is useful for determining multi-threaded structure padding + * or SIMD prefetch sizes. + */ +extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); + +/** * This function returns true if the CPU has the RDTSC instruction. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); diff -r edd0f0617be4 -r b3f075368b1f src/cpuinfo/SDL_cpuinfo.c --- a/src/cpuinfo/SDL_cpuinfo.c Thu Jan 27 20:37:54 2011 -0800 +++ b/src/cpuinfo/SDL_cpuinfo.c Thu Jan 27 20:46:45 2011 -0800 @@ -304,7 +304,7 @@ static int SDL_CPUCount = 0; int -SDL_GetCPUCount() +SDL_GetCPUCount(void) { if (!SDL_CPUCount) { #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) @@ -335,7 +335,7 @@ /* Oh, such a sweet sweet trick, just not very useful. :) */ static const char * -SDL_GetCPUType() +SDL_GetCPUType(void) { static char SDL_CPUType[13]; @@ -366,7 +366,7 @@ } static const char * -SDL_GetCPUName() +SDL_GetCPUName(void) { static char SDL_CPUName[48]; @@ -437,8 +437,8 @@ return SDL_CPUName; } -static int -SDL_GetCPUCacheLineSize() +int +SDL_GetCPUCacheLineSize(void) { const char *cpuType = SDL_GetCPUType();