Cpu.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /******************************************************************************
  2. Use 'Cpu' to check your cpu capabilities.
  3. /******************************************************************************/
  4. enum CPU_FLAG // CPU Flags
  5. {
  6. CPU_MMX =0x001, // if MMX is supported
  7. CPU_3DNOW =0x002, // if 3DNow is supported
  8. CPU_SSE =0x004, // if SSE is supported
  9. CPU_SSE2 =0x008, // if SSE 2 is supported
  10. CPU_SSE3 =0x010, // if SSE 3 is supported
  11. CPU_SSE4_1=0x020, // if SSE 4.1 is supported
  12. CPU_SSE4_2=0x040, // if SSE 4.2 is supported
  13. CPU_AVX =0x080, // if AVX is supported
  14. CPU_AVX2 =0x100, // if AVX 2 is supported
  15. CPU_AES =0x200, // if AES is supported
  16. };
  17. /******************************************************************************/
  18. struct CPU // Central Processing Unit
  19. {
  20. // get
  21. Int threads()C {return _threads;} // number of hardware threads
  22. UInt flag ()C {return _flag ;} // get CPU_FLAG
  23. C Str8& name ()C {return _name ;} // get cpu name
  24. #if EE_PRIVATE
  25. static void set();
  26. #endif
  27. #if !EE_PRIVATE
  28. private:
  29. #endif
  30. Int _threads;
  31. UInt _flag;
  32. Str8 _name;
  33. CPU();
  34. }extern
  35. Cpu;
  36. /******************************************************************************/
  37. inline Int Elms(C CPU &cpu) {return cpu.threads();}
  38. /******************************************************************************/