aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-04-10 10:15:50 +0200
committerBjörn Gustavsson <[email protected]>2017-04-10 10:15:50 +0200
commit47911ac4aa0c85c700a23a0b382c373becf99d49 (patch)
tree08425c77b0e72acc8226175b45d66486c87f7827
parent710abdb5d79554cde4e0ca051bfa16bdcfdccc57 (diff)
parentbb89d065dbe47554c0cb929d244e0d38cad52e65 (diff)
downloadotp-47911ac4aa0c85c700a23a0b382c373becf99d49.tar.gz
otp-47911ac4aa0c85c700a23a0b382c373becf99d49.tar.bz2
otp-47911ac4aa0c85c700a23a0b382c373becf99d49.zip
Merge branch 'bjorn/erts/slight-bxor-optimization'
* bjorn/erts/slight-bxor-optimization: beam_emu: Slightly optimize the bxor/2 operator
-rw-r--r--erts/emulator/beam/beam_emu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 9a91fdce08..6010c17c17 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -3044,10 +3044,12 @@ do { \
GetArg2(2, Op1, Op2);
if (is_both_small(Op1, Op2)) {
/*
- * We could extract the tag from one argument, but a tag extraction
- * could mean a shift. Therefore, play it safe here.
+ * TAG ^ TAG == 0.
+ *
+ * Therefore, we perform the XOR operation on the tagged values,
+ * and OR in the tag bits.
*/
- Eterm result = make_small(signed_val(Op1) ^ signed_val(Op2));
+ Eterm result = (Op1 ^ Op2) | make_small(0);
StoreBifResult(4, result);
}
DO_OUTLINED_ARITH_2(bxor, Op1, Op2);