NLMISC::CCpuInfo___ Struct Reference

#include <cpu_info.h>


Detailed Description

This helps to know wether cpu has some features such as mmx, sse ...
Author:
Nicolas Vizerie

Nevrax France

Date:
2001

Definition at line 41 of file cpu_info.h.

Static Public Member Functions

bool hasCPUID (void)
bool hasMMX (void)
bool hasSSE (void)


Member Function Documentation

bool NLMISC::CCpuInfo___::hasCPUID void   )  [static]
 

test wether the cpuid instruction is supported (always false on non intel architectures)

Definition at line 108 of file cpu_info.cpp.

References uint32.

00109 {
00110         #ifdef NL_OS_WINDOWS
00111                  uint32 result;
00112                  __asm
00113                  {
00114                          pushad
00115                          pushfd                                         
00116                          //      If ID bit of EFLAGS can change, then cpuid is available
00117                          pushfd
00118                          pop  eax                                       // Get EFLAG
00119                          mov  ecx,eax
00120                          xor  eax,0x200000                      // Flip ID bit
00121                          push eax
00122                          popfd                                          // Write EFLAGS
00123                          pushfd      
00124                          pop  eax                                       // read back EFLAG
00125                          xor  eax,ecx                           
00126                          je   noCpuid                           // no flip -> no CPUID instr.
00127                          
00128                          popfd                                          // restore state
00129                          popad
00130                          mov  result, 1
00131                          jmp  CPUIDPresent
00132                 
00133                         noCpuid:
00134                          popfd                                      // restore state
00135                          popad
00136                          mov result, 0
00137                         CPUIDPresent:    
00138                  }
00139                  return result == 1;
00140         #else
00141                  return false;
00142         #endif
00143 }

bool NLMISC::CCpuInfo___::hasMMX void   )  [static]
 

helps to know wether the processor features mmx instruction set This is initialized at started, so its fast (always false on not 0x86 architecture ...)

Definition at line 144 of file cpu_info.cpp.

References NLMISC::HasMMX.

00144 { return HasMMX; }

bool NLMISC::CCpuInfo___::hasSSE void   )  [static]
 

helps to know wether the processor has streaming SIMD instructions (the OS must supports it) This is initialized at started, so its fast (always false on not 0x86 architecture ...)

Definition at line 145 of file cpu_info.cpp.

References NLMISC::HasSSE.

00145 { return HasSSE; }


The documentation for this struct was generated from the following files:
Generated on Tue Mar 16 13:07:09 2004 for NeL by doxygen 1.3.6