Skip to content

Commit 2c5ec3e

Browse files
laurynas-biveinisinikep
authored andcommitted
[macos] MyRocks: define BSD-style endian conversion functions (facebook#1204)
Summary: macOS does not have beXXtoh and htobeXX functions. Define them using macOS equivalents. Both downstreams have done the same: https://github.com/percona/percona-server/pull/4808/files#diff-083593616349ef36e9a39f1251813d7c0fe6a93883f131fe041f0d167dfe941f, MariaDB/server@b64910c#diff-083593616349ef36e9a39f1251813d7c0fe6a93883f131fe041f0d167dfe941f This patch is closer to MariaDB one instead of Percona : use general `__APPLE__` define instead of RocksDB core `OS_MACOSX`, define only used functions, and define them right after system header includes. Pull Request resolved: facebook#1204 Reviewed By: Pushapgl Differential Revision: D38956497 Pulled By: hermanlee fbshipit-source-id: d82fad1
1 parent f47f289 commit 2c5ec3e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

storage/rocksdb/rdb_buff.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@
2020
#include <string>
2121
#include <vector>
2222

23+
#ifdef __APPLE__
24+
25+
#include <libkern/OSByteOrder.h>
26+
27+
#define be16toh(x) OSSwapBigToHostInt16(x)
28+
#define htobe16(x) OSSwapHostToBigInt16(x)
29+
30+
#define be32toh(x) OSSwapBigToHostInt32(x)
31+
#define htobe32(x) OSSwapHostToBigInt32(x)
32+
33+
#define be64toh(x) OSSwapBigToHostInt64(x)
34+
#define htobe64(x) OSSwapHostToBigInt64(x)
35+
36+
#endif // __APPLE__
37+
2338
/* MySQL header files */
2439

2540
/* MyRocks header files */

0 commit comments

Comments
 (0)