summaryrefslogtreecommitdiffhomepage
path: root/src/pool.c
diff options
context:
space:
mode:
authortake_cheeze <[email protected]>2017-04-21 17:31:33 +0900
committertake_cheeze <[email protected]>2017-04-21 17:34:31 +0900
commitb2dc04393adaa09b6ff91e4d31b72e0ba6621a53 (patch)
tree179d9c96ac030fa64d168cd757c52b90285bb2a3 /src/pool.c
parent94bcdca64fb08e3724c1a5cf6ce25f6f9c6e041e (diff)
downloadmruby-b2dc04393adaa09b6ff91e4d31b72e0ba6621a53.tar.gz
mruby-b2dc04393adaa09b6ff91e4d31b72e0ba6621a53.zip
Align pool allocator with 8 byte in 64-bit environment.
To avoid warnings from undefined sanitizer. ( https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html )
Diffstat (limited to 'src/pool.c')
-rw-r--r--src/pool.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pool.c b/src/pool.c
index 18f66fc27..db4546abf 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -13,8 +13,12 @@
/* allocated memory address should be multiple of POOL_ALIGNMENT */
/* or undef it if alignment does not matter */
#ifndef POOL_ALIGNMENT
+#if INTPTR_MAX == INT64_MAX
+#define POOL_ALIGNMENT 8
+#else
#define POOL_ALIGNMENT 4
#endif
+#endif
/* page size of memory pool */
#ifndef POOL_PAGE_SIZE
#define POOL_PAGE_SIZE 16000