2121#include " wwdebug.h"
2222#include " thread.h"
2323#pragma warning (disable : 4201) // Nonstandard extension - nameless struct
24- #include < windows.h>
2524#include " systimer.h"
2625#include < Utility/intrin_compat.h>
2726
27+ #ifdef _WIN32
28+ #include < windows.h>
29+ #endif
30+
2831#ifdef _UNIX
2932# include < time.h> // for time(), localtime() and timezone variable.
3033#endif
@@ -57,7 +60,7 @@ int CPUDetectClass::ProcessorFamily;
5760int CPUDetectClass::ProcessorModel;
5861int CPUDetectClass::ProcessorRevision;
5962int CPUDetectClass::ProcessorSpeed;
60- __int64 CPUDetectClass::ProcessorTicksPerSecond; // Ticks per second
63+ sint64 CPUDetectClass::ProcessorTicksPerSecond; // Ticks per second
6164double CPUDetectClass::InvProcessorTicksPerSecond; // 1.0 / Ticks per second
6265
6366unsigned CPUDetectClass::FeatureBits;
@@ -125,10 +128,10 @@ const char* CPUDetectClass::Get_Processor_Manufacturer_Name()
125128
126129#define ASM_RDTSC _asm _emit 0x0f _asm _emit 0x31
127130
128- static unsigned Calculate_Processor_Speed (__int64 & ticks_per_second)
131+ static unsigned Calculate_Processor_Speed (sint64 & ticks_per_second)
129132{
130- unsigned __int64 timer0=0 ;
131- unsigned __int64 timer1=0 ;
133+ sint64 timer0=0 ;
134+ sint64 timer1=0 ;
132135
133136 timer0=_rdtsc ();
134137
@@ -138,8 +141,8 @@ static unsigned Calculate_Processor_Speed(__int64& ticks_per_second)
138141 timer1=_rdtsc ();
139142 }
140143
141- __int64 t=timer1-timer0;
142- ticks_per_second=(__int64 )((1000.0 /(double )elapsed)*(double )t); // Ticks per second
144+ sint64 t=timer1-timer0;
145+ ticks_per_second=(sint64 )((1000.0 /(double )elapsed)*(double )t); // Ticks per second
143146 return unsigned ((double )t/(double )(elapsed*1000 ));
144147}
145148
@@ -898,8 +901,8 @@ void CPUDetectClass::Init_Memory()
898901
899902void CPUDetectClass::Init_OS ()
900903{
901- OSVERSIONINFO os;
902904#ifdef WIN32
905+ OSVERSIONINFO os;
903906 os.dwOSVersionInfoSize = sizeof (os);
904907 GetVersionEx (&os);
905908
@@ -940,9 +943,11 @@ void CPUDetectClass::Init_Processor_Log()
940943
941944 SYSLOG ((" Operating System: " ));
942945 switch (OSVersionPlatformId) {
946+ #ifdef _WIN32
943947 case VER_PLATFORM_WIN32s: SYSLOG ((" Windows 3.1" )); break ;
944948 case VER_PLATFORM_WIN32_WINDOWS: SYSLOG ((" Windows 9x" )); break ;
945949 case VER_PLATFORM_WIN32_NT: SYSLOG ((" Windows NT" )); break ;
950+ #endif
946951 }
947952 SYSLOG ((" \r\n " ));
948953
@@ -1223,6 +1228,7 @@ void Get_OS_Info(
12231228 switch (OSVersionPlatformId) {
12241229 default :
12251230 break ;
1231+ #ifdef _WIN32
12261232 case VER_PLATFORM_WIN32_WINDOWS:
12271233 {
12281234 for (int i=0 ;i<sizeof (Windows9xVersionTable)/sizeof (os_info);++i) {
@@ -1304,5 +1310,6 @@ void Get_OS_Info(
13041310
13051311 // No more-specific version detected; fallback to XX
13061312 os_info.Code =" WINXX" ;
1313+ #endif
13071314 }
13081315}
0 commit comments