aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-03-13 10:09:33 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-03-13 10:09:33 +0100
commit59f1846249fbbb76e786d1e73e9be5c72a41fefb (patch)
tree653e7ea26a961ece507659c78a349e8412ced0ae /erts/emulator/beam
parentb398819d59863db76fc2ce2f0c1584254e38f3bb (diff)
downloadotp-59f1846249fbbb76e786d1e73e9be5c72a41fefb.tar.gz
otp-59f1846249fbbb76e786d1e73e9be5c72a41fefb.tar.bz2
otp-59f1846249fbbb76e786d1e73e9be5c72a41fefb.zip
erts: Restrict GCC intrinsics by compiler version
Intrinsics __builtin_clz and __builtin_popcount are only valid on GCC version 3.4 and above.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_map.c3
-rw-r--r--erts/emulator/beam/erl_map.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_map.c b/erts/emulator/beam/erl_map.c
index b7f07fa6c4..964c09e906 100644
--- a/erts/emulator/beam/erl_map.c
+++ b/erts/emulator/beam/erl_map.c
@@ -2768,7 +2768,7 @@ static Eterm hashmap_bld_tuple_uint(Uint **hpp, Uint *szp, Uint n, Uint nums[])
/* implementation of builtin emulations */
-#if !defined(__GNUC__)
+#if !ERTS_AT_LEAST_GCC_VSN__(3, 4, 0)
/* Count leading zeros emulation */
Uint32 hashmap_clz(Uint32 x) {
Uint32 y;
@@ -2780,6 +2780,7 @@ Uint32 hashmap_clz(Uint32 x) {
y = x >> 1; if (y != 0) return n - 2;
return n - x;
}
+
const Uint32 SK5 = 0x55555555, SK3 = 0x33333333;
const Uint32 SKF0 = 0xF0F0F0F, SKFF = 0xFF00FF;
diff --git a/erts/emulator/beam/erl_map.h b/erts/emulator/beam/erl_map.h
index ff5e6edd1e..d075d87c83 100644
--- a/erts/emulator/beam/erl_map.h
+++ b/erts/emulator/beam/erl_map.h
@@ -24,7 +24,7 @@
#include "sys.h"
/* instrinsic wrappers */
-#if defined(__GNUC__)
+#if ERTS_AT_LEAST_GCC_VSN__(3, 4, 0)
#define hashmap_clz(x) ((Uint32) __builtin_clz((unsigned int)(x)))
#define hashmap_bitcount(x) ((Uint32) __builtin_popcount((unsigned int) (x)))
#else