21
21
#include " wwdebug.h"
22
22
#include " thread.h"
23
23
#pragma warning (disable : 4201) // Nonstandard extension - nameless struct
24
- #include < windows.h>
25
24
#include " systimer.h"
26
25
#include < Utility/intrin_compat.h>
27
26
27
+ #ifdef _WIN32
28
+ #include < windows.h>
29
+ #endif
30
+
28
31
#ifdef _UNIX
29
32
# include < time.h> // for time(), localtime() and timezone variable.
30
33
#endif
@@ -57,7 +60,7 @@ int CPUDetectClass::ProcessorFamily;
57
60
int CPUDetectClass::ProcessorModel;
58
61
int CPUDetectClass::ProcessorRevision;
59
62
int CPUDetectClass::ProcessorSpeed;
60
- __int64 CPUDetectClass::ProcessorTicksPerSecond; // Ticks per second
63
+ sint64 CPUDetectClass::ProcessorTicksPerSecond; // Ticks per second
61
64
double CPUDetectClass::InvProcessorTicksPerSecond; // 1.0 / Ticks per second
62
65
63
66
unsigned CPUDetectClass::FeatureBits;
@@ -125,10 +128,10 @@ const char* CPUDetectClass::Get_Processor_Manufacturer_Name()
125
128
126
129
#define ASM_RDTSC _asm _emit 0x0f _asm _emit 0x31
127
130
128
- static unsigned Calculate_Processor_Speed (__int64 & ticks_per_second)
131
+ static unsigned Calculate_Processor_Speed (sint64 & ticks_per_second)
129
132
{
130
- unsigned __int64 timer0=0 ;
131
- unsigned __int64 timer1=0 ;
133
+ sint64 timer0=0 ;
134
+ sint64 timer1=0 ;
132
135
133
136
timer0=_rdtsc ();
134
137
@@ -138,8 +141,8 @@ static unsigned Calculate_Processor_Speed(__int64& ticks_per_second)
138
141
timer1=_rdtsc ();
139
142
}
140
143
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
143
146
return unsigned ((double )t/(double )(elapsed*1000 ));
144
147
}
145
148
@@ -898,8 +901,8 @@ void CPUDetectClass::Init_Memory()
898
901
899
902
void CPUDetectClass::Init_OS ()
900
903
{
901
- OSVERSIONINFO os;
902
904
#ifdef WIN32
905
+ OSVERSIONINFO os;
903
906
os.dwOSVersionInfoSize = sizeof (os);
904
907
GetVersionEx (&os);
905
908
@@ -940,9 +943,11 @@ void CPUDetectClass::Init_Processor_Log()
940
943
941
944
SYSLOG ((" Operating System: " ));
942
945
switch (OSVersionPlatformId) {
946
+ #ifdef _WIN32
943
947
case VER_PLATFORM_WIN32s: SYSLOG ((" Windows 3.1" )); break ;
944
948
case VER_PLATFORM_WIN32_WINDOWS: SYSLOG ((" Windows 9x" )); break ;
945
949
case VER_PLATFORM_WIN32_NT: SYSLOG ((" Windows NT" )); break ;
950
+ #endif
946
951
}
947
952
SYSLOG ((" \r\n " ));
948
953
@@ -1223,6 +1228,7 @@ void Get_OS_Info(
1223
1228
switch (OSVersionPlatformId) {
1224
1229
default :
1225
1230
break ;
1231
+ #ifdef _WIN32
1226
1232
case VER_PLATFORM_WIN32_WINDOWS:
1227
1233
{
1228
1234
for (int i=0 ;i<sizeof (Windows9xVersionTable)/sizeof (os_info);++i) {
@@ -1304,5 +1310,6 @@ void Get_OS_Info(
1304
1310
1305
1311
// No more-specific version detected; fallback to XX
1306
1312
os_info.Code =" WINXX" ;
1313
+ #endif
1307
1314
}
1308
1315
}
0 commit comments