mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-24 17:31:16 +08:00
io/load: Enabled pread implementation for mingw32 (#1706)
This commit is contained in:
parent
af5a614aad
commit
a82996e9fb
@ -6,9 +6,11 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// Used by pread implementation.
|
// Used by pread implementation.
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mlx/io/load.h"
|
#include "mlx/io/load.h"
|
||||||
@ -106,7 +108,7 @@ Dtype dtype_from_array_protocol(std::string_view t) {
|
|||||||
"[from_str] Invalid array protocol type-string: " + std::string(t));
|
"[from_str] Invalid array protocol type-string: " + std::string(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
// There is no pread on Windows, emulate it with ReadFile.
|
// There is no pread on Windows, emulate it with ReadFile.
|
||||||
int64_t pread(int fd, void* buf, uint64_t size, uint64_t offset) {
|
int64_t pread(int fd, void* buf, uint64_t size, uint64_t offset) {
|
||||||
HANDLE file = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
|
HANDLE file = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
|
||||||
|
Loading…
Reference in New Issue
Block a user