include/SDL_cpuinfo.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 11 Feb 2011 22:37:15 -0800
changeset 5262 b530ef003506
parent 5259 6a65c1fc07af
child 5263 e1122f31fec5
permissions -rw-r--r--
Happy 2011! :)
slouken@739
     1
/*
slouken@739
     2
    SDL - Simple DirectMedia Layer
slouken@5262
     3
    Copyright (C) 1997-2011 Sam Lantinga
slouken@739
     4
slouken@739
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@739
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@739
     9
slouken@739
    10
    This library is distributed in the hope that it will be useful,
slouken@739
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@739
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@739
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@739
    18
slouken@739
    19
    Sam Lantinga
slouken@739
    20
    slouken@libsdl.org
slouken@739
    21
*/
slouken@739
    22
slouken@1895
    23
/**
slouken@3407
    24
 *  \file SDL_cpuinfo.h
slouken@3407
    25
 *  
slouken@3407
    26
 *  CPU feature detection for SDL.
slouken@1895
    27
 */
slouken@739
    28
slouken@739
    29
#ifndef _SDL_cpuinfo_h
slouken@739
    30
#define _SDL_cpuinfo_h
slouken@739
    31
slouken@1402
    32
#include "SDL_stdinc.h"
slouken@1402
    33
slouken@739
    34
#include "begin_code.h"
slouken@739
    35
/* Set up for C function definitions, even when using C++ */
slouken@739
    36
#ifdef __cplusplus
slouken@1895
    37
/* *INDENT-OFF* */
slouken@739
    38
extern "C" {
slouken@1895
    39
/* *INDENT-ON* */
slouken@739
    40
#endif
slouken@739
    41
slouken@5116
    42
/* This is a guess for the cacheline size used for padding.
slouken@5116
    43
 * Most x86 processors have a 64 byte cache line.
slouken@5116
    44
 * The 64-bit PowerPC processors have a 128 byte cache line.
slouken@5116
    45
 * We'll use the larger value to be generally safe.
slouken@5115
    46
 */
slouken@5116
    47
#define SDL_CACHELINE_SIZE  128
slouken@5115
    48
slouken@3407
    49
/**
slouken@3579
    50
 *  This function returns the number of CPU cores available.
slouken@3579
    51
 */
slouken@3579
    52
extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
slouken@3579
    53
slouken@3579
    54
/**
slouken@5120
    55
 *  This function returns the L1 cache line size of the CPU
slouken@5120
    56
 *
slouken@5120
    57
 *  This is useful for determining multi-threaded structure padding
slouken@5120
    58
 *  or SIMD prefetch sizes.
slouken@5120
    59
 */
slouken@5120
    60
extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
slouken@5120
    61
slouken@5120
    62
/**
slouken@3407
    63
 *  This function returns true if the CPU has the RDTSC instruction.
slouken@745
    64
 */
slouken@1426
    65
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
slouken@745
    66
slouken@3407
    67
/**
slouken@3407
    68
 *  This function returns true if the CPU has MMX features.
slouken@739
    69
 */
slouken@1426
    70
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
slouken@739
    71
slouken@3407
    72
/**
slouken@3407
    73
 *  This function returns true if the CPU has SSE features.
slouken@739
    74
 */
slouken@1426
    75
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
slouken@739
    76
slouken@3407
    77
/**
slouken@3407
    78
 *  This function returns true if the CPU has SSE2 features.
slouken@785
    79
 */
slouken@1426
    80
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
slouken@785
    81
slouken@3407
    82
/**
slouken@5259
    83
 *  This function returns true if the CPU has SSE3 features.
slouken@778
    84
 */
slouken@5259
    85
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
slouken@5259
    86
slouken@5259
    87
/**
slouken@5259
    88
 *  This function returns true if the CPU has SSE4 features.
slouken@5259
    89
 */
slouken@5259
    90
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE4(void);
slouken@5259
    91
slouken@778
    92
slouken@739
    93
/* Ends C function definitions when using C++ */
slouken@739
    94
#ifdef __cplusplus
slouken@1895
    95
/* *INDENT-OFF* */
slouken@739
    96
}
slouken@1895
    97
/* *INDENT-ON* */
slouken@739
    98
#endif
slouken@739
    99
#include "close_code.h"
slouken@739
   100
slouken@739
   101
#endif /* _SDL_cpuinfo_h */
slouken@1895
   102
slouken@1895
   103
/* vi: set ts=4 sw=4 expandtab: */