src/cpuinfo/SDL_cpuinfo.c
changeset 1402 d910939febfa
parent 1361 19418e4422cb
child 1426 ef9a9064bff2
equal deleted inserted replaced
1401:1819fd069e89 1402:d910939febfa
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    18 
    19     Sam Lantinga
    19     Sam Lantinga
    20     slouken@libsdl.org
    20     slouken@libsdl.org
    21 */
    21 */
       
    22 #include "SDL_config.h"
    22 
    23 
    23 /* CPU feature detection for SDL */
    24 /* CPU feature detection for SDL */
    24 
    25 
    25 #include "SDL.h"
    26 #include "SDL.h"
    26 #include "SDL_cpuinfo.h"
    27 #include "SDL_cpuinfo.h"
    28 #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
    29 #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
    29 #include <signal.h>
    30 #include <signal.h>
    30 #include <setjmp.h>
    31 #include <setjmp.h>
    31 #endif
    32 #endif
    32 
    33 
    33 #if MACOSX
    34 #ifdef __MACOSX__
    34 #include <sys/sysctl.h> /* For AltiVec check */
    35 #include <sys/sysctl.h> /* For AltiVec check */
    35 #endif
    36 #endif
    36 
    37 
    37 #define CPU_HAS_RDTSC	0x00000001
    38 #define CPU_HAS_RDTSC	0x00000001
    38 #define CPU_HAS_MMX	0x00000002
    39 #define CPU_HAS_MMX	0x00000002
   305 }
   306 }
   306 
   307 
   307 static __inline__ int CPU_haveAltiVec()
   308 static __inline__ int CPU_haveAltiVec()
   308 {
   309 {
   309 	volatile int altivec = 0;
   310 	volatile int altivec = 0;
   310 #if MACOSX
   311 #ifdef __MACOSX__
   311 	int selectors[2] = { CTL_HW, HW_VECTORUNIT }; 
   312 	int selectors[2] = { CTL_HW, HW_VECTORUNIT }; 
   312 	int hasVectorUnit = 0; 
   313 	int hasVectorUnit = 0; 
   313 	size_t length = sizeof(hasVectorUnit); 
   314 	size_t length = sizeof(hasVectorUnit); 
   314 	int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0); 
   315 	int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0); 
   315 	if( 0 == error )
   316 	if( 0 == error )