ICU-23064 Fix for POSIX_MADV_RANDOM undefined

This commit is contained in:
Mihai Nita 2025-02-27 13:07:20 -08:00
parent 53adb4bca8
commit 443c8c5187

View file

@ -238,7 +238,12 @@ typedef HANDLE MemoryMap;
pData->pHeader=(const DataHeader *)data;
pData->mapAddr = data;
#if U_PLATFORM == U_PF_IPHONE || U_PLATFORM == U_PF_ANDROID
// Apparently supported from Android 23 and higher:
// https://github.com/ggml-org/llama.cpp/pull/3631
// Checking for the flag itself is safer than checking for __ANDROID_API__.
# ifdef POSIX_MADV_RANDOM
posix_madvise(data, length, POSIX_MADV_RANDOM);
# endif
#endif
return true;
}