clean away unnecessary preprocessor conditional
This commit is contained in:
parent
b684583f0c
commit
8847e95725
1 changed files with 2 additions and 7 deletions
|
@ -271,19 +271,17 @@ struct llama_mmap {
|
||||||
throw std::runtime_error(format("MapViewOfFile failed: %s", llama_format_win_err(error).c_str()));
|
throw std::runtime_error(format("MapViewOfFile failed: %s", llama_format_win_err(error).c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
|
|
||||||
if (prefetch) {
|
if (prefetch) {
|
||||||
// The PrefetchVirtualMemory API is only present on Windows 8 and above, so we
|
// The PrefetchVirtualMemory API is only present on Windows 8 and above, so we
|
||||||
// will dynamically load it using GetProcAddress.
|
// will dynamically load it using GetProcAddress.
|
||||||
typedef BOOL (WINAPI *PPREFETCHVIRTUALMEMORY) (HANDLE, ULONG_PTR, PWIN32_MEMORY_RANGE_ENTRY, ULONG);
|
BOOL (WINAPI *pPrefetchVirtualMemory) (HANDLE, ULONG_PTR, PWIN32_MEMORY_RANGE_ENTRY, ULONG);
|
||||||
PPREFETCHVIRTUALMEMORY pPrefetchVirtualMemory;
|
|
||||||
HMODULE hKernel32;
|
HMODULE hKernel32;
|
||||||
|
|
||||||
// This call is guaranteed to succeed.
|
// This call is guaranteed to succeed.
|
||||||
hKernel32 = GetModuleHandleW(L"kernel32.dll");
|
hKernel32 = GetModuleHandleW(L"kernel32.dll");
|
||||||
|
|
||||||
// This call may fail if on a pre-Win8 system.
|
// This call may fail if on a pre-Win8 system.
|
||||||
pPrefetchVirtualMemory = (PPREFETCHVIRTUALMEMORY) GetProcAddress(hKernel32, "PrefetchVirtualMemory");
|
pPrefetchVirtualMemory = reinterpret_cast<decltype(pPrefetchVirtualMemory)> GetProcAddress(hKernel32, "PrefetchVirtualMemory");
|
||||||
|
|
||||||
if (pPrefetchVirtualMemory) {
|
if (pPrefetchVirtualMemory) {
|
||||||
// Advise the kernel to preload the mapped memory.
|
// Advise the kernel to preload the mapped memory.
|
||||||
|
@ -296,9 +294,6 @@ struct llama_mmap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#pragma message("warning: You are building for pre-Windows 8; prefetch not supported")
|
|
||||||
#endif // _WIN32_WINNT >= _WIN32_WINNT_WIN8
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~llama_mmap() {
|
~llama_mmap() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue