fix Xcode mysterious build error

This commit is contained in:
guoling
2020-06-28 20:02:19 +08:00
parent 937bfba5c4
commit 711e1afaee
3 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ void MMKV::minimalInit(MMKVPath_t defaultRootDir) {
// crc32 instruction requires A10 chip, aka iPhone 7 or iPad 6th generation
int device = 0, version = 0;
GetAppleMachineInfo(device, version);
# ifdef __aarch64__
# ifdef MMKV_USE_ARMV8_CRC32
if ((device == iPhone && version >= 9) || (device == iPad && version >= 7)) {
CRC32 = mmkv::armv8_crc32;
}
+6 -2
View File
@@ -18,7 +18,8 @@
* limitations under the License.
*/
#pragma once
#ifndef CHECKSUM_H
#define CHECKSUM_H
#ifdef __cplusplus
#include "../MMKVPredef.h"
@@ -39,6 +40,8 @@ uLong crc32(uLong crc, const Bytef *buf, z_size_t len);
# ifdef __aarch64__
# define MMKV_USE_ARMV8_CRC32
namespace mmkv {
uint32_t armv8_crc32(uint32_t crc, const uint8_t *buf, size_t len);
}
@@ -57,4 +60,5 @@ extern CRC32_Func_t CRC32;
#endif // MMKV_EMBED_ZLIB
#endif
#endif // __cplusplus
#endif // CHECKSUM_H
+2 -2
View File
@@ -20,7 +20,7 @@
#include "Checksum.h"
#ifdef __aarch64__
#ifdef MMKV_USE_ARMV8_CRC32
# include <zlib.h>
@@ -110,4 +110,4 @@ TARGET_ARM_CRC uint32_t armv8_crc32(uint32_t crc, const uint8_t *buf, size_t len
} // namespace mmkv
#endif // __aarch64__
#endif // MMKV_USE_ARMV8_CRC32