macOS/Apple Silicon port: NEON kernels + platform shim (PR #1 by RDouglasSharp)

This commit is contained in:
RDouglas
2026-07-06 21:01:12 +01:00
committed by GitHub
parent 8d7fbef39c
commit dd8c907800
6 changed files with 200 additions and 7 deletions
+7
View File
@@ -15,6 +15,7 @@
#include <unistd.h>
#include <dirent.h>
#include "json.h"
#include "compat.h"
typedef struct {
char *name;
@@ -78,7 +79,13 @@ static int st_open_fd(shards *S, const char *path) {
int fd = open(path, O_RDONLY);
if (fd < 0) { perror(path); exit(1); }
S->paths[S->nfd] = strdup(path); S->fds[S->nfd] = fd;
#ifdef O_DIRECT
S->dfds[S->nfd] = open(path, O_RDONLY | O_DIRECT); /* eager: lookup poi thread-safe */
#elif defined(__APPLE__)
S->dfds[S->nfd] = compat_open_direct(path); /* macOS: F_NOCACHE ~ O_DIRECT */
#else
S->dfds[S->nfd] = -1; /* niente equivalente: solo buffered */
#endif
S->nfd++;
return fd;
}