fix more things?
This commit is contained in:
1 parent
b22ddb1453
commit
b455ccd261
2 files changed
+5
-5
No files matched your search
@@ -3,6 +3,7 @@ package os
|
|||||||
|
|
||||||
import win32 "core:sys/windows"
|
import win32 "core:sys/windows"
|
||||||
import "core:runtime"
|
import "core:runtime"
|
||||||
|
import "core:intrinsics"
|
||||||
|
|
||||||
Handle :: distinct uintptr
|
Handle :: distinct uintptr
|
||||||
File_Time :: distinct u64
|
File_Time :: distinct u64
|
||||||
@@ -128,15 +129,14 @@ get_page_size :: proc() -> int {
|
|||||||
|
|
||||||
get_processor_thread_count :: proc() -> int {
|
get_processor_thread_count :: proc() -> int {
|
||||||
length : c.int = 0
|
length : c.int = 0
|
||||||
result := windows.GetLogicalProcessorInformation(nil, &length)
|
result := win32.GetLogicalProcessorInformation(nil, &length)
|
||||||
|
|
||||||
thread_count := 0
|
thread_count := 0
|
||||||
if !result && win32.GetLastError() == 122 && length > 0 {
|
if !result && win32.GetLastError() == 122 && length > 0 {
|
||||||
processors := make([]windows.SYSTEM_LOGICAL_PROCESSOR_INFORMATION, length, context.temp_allocator)
|
processors := make([]win32.SYSTEM_LOGICAL_PROCESSOR_INFORMATION, length, context.temp_allocator)
|
||||||
|
|
||||||
result = windows.GetLogicalProcessorInformation(&processors[0], &length)
|
result = win32.GetLogicalProcessorInformation(&processors[0], &length)
|
||||||
if result {
|
if result {
|
||||||
core_count := 0
|
|
||||||
for processor in processors {
|
for processor in processors {
|
||||||
if processor.Relationship == windows.RelationProcessorCore {
|
if processor.Relationship == windows.RelationProcessorCore {
|
||||||
thread := intrinsics.count_ones(processor.ProcessorMask)
|
thread := intrinsics.count_ones(processor.ProcessorMask)
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ foreign kernel32 {
|
|||||||
lpTotalNumberOfFreeBytes: PULARGE_INTEGER,
|
lpTotalNumberOfFreeBytes: PULARGE_INTEGER,
|
||||||
) -> BOOL ---
|
) -> BOOL ---
|
||||||
|
|
||||||
GetLogicalProcessorInformation :: proc(buffer: ^LOGICAL_PROCESSOR_INFORMATION, returnedLength: PDWORD) -> BOOL ---
|
GetLogicalProcessorInformation :: proc(buffer: ^SYSTEM_LOGICAL_PROCESSOR_INFORMATION, returnedLength: PDWORD) -> BOOL ---
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user