Mercurial > sdl-ios-xcode
changeset 5122:b3f075368b1f
Added API function to get CPU cache line size.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 27 Jan 2011 20:46:45 -0800 |
parents | edd0f0617be4 |
children | 87f452305db4 |
files | include/SDL_cpuinfo.h src/cpuinfo/SDL_cpuinfo.c |
diffstat | 2 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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();