瀏覽代碼

Fixed Win32 core count issue.

woollybah 9 年之前
父節點
當前提交
9d89da6177
共有 2 個文件被更改,包括 13 次插入20 次删除
  1. 5 20
      bmk_cores_win32.bmx
  2. 8 0
      bmk_cores_win32.c

+ 5 - 20
bmk_cores_win32.bmx

@@ -1,31 +1,16 @@
 SuperStrict
 
-' http://msdn.microsoft.com/en-us/library/ms724958(VS.85).aspx
-Extern "win32"
-	Function GetSystemInfo(info:Byte Ptr)
-End Extern
+Import "bmk_cores_win32.c"
 
-Type SYSTEM_INFO
-	Field wProcessorArchitecture:Short
-	Field wReserved:Short
-	Field dwPageSize:Int
-	Field lpMinimumApplicationAddress:Byte Ptr
-	Field lpMaximumApplicationAddress:Byte Ptr
-	Field dwActiveProcessorMask:Int
-	Field dwNumberOfProcessors:Int
-	Field dwProcessorType:Int
-	Field dwAllocationGranularity:Int
-	Field wProcessorLevel:Short
-	Field wProcessorRevision:Short
-End Type
+Extern
+	Function bmx_GetSystemInfo_dwNumberOfProcessors:Int()
+End Extern
 
 Function GetCoreCount:Int()
 	Global count:Int
 
 	If Not count Then
-		Local info:SYSTEM_INFO = New SYSTEM_INFO
-		GetSystemInfo(info)
-		count = info.dwNumberOfProcessors
+		count = bmx_GetSystemInfo_dwNumberOfProcessors()
 	End If
 
 	Return count

+ 8 - 0
bmk_cores_win32.c

@@ -0,0 +1,8 @@
+#include "windows.h"
+
+
+int bmx_GetSystemInfo_dwNumberOfProcessors() {
+	SYSTEM_INFO info;
+	GetSystemInfo(&info);
+	return info.dwNumberOfProcessors;
+}