summaryrefslogtreecommitdiff
path: root/prism/static_literals.c
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-02-29 09:39:57 -0500
committergit <[email protected]>2024-02-29 14:53:42 +0000
commitcb784082bc38299a1669d2d593f7a796411d752b (patch)
tree82efcb2b9d44d291df013043ae405d904aa40531 /prism/static_literals.c
parent950c60623b83fb778df6b928ccbe46b2e54b18b6 (diff)
[ruby/prism] Better hashing between positive/negative integers
https://github.com/ruby/prism/commit/68ddf08634
Diffstat (limited to 'prism/static_literals.c')
-rw-r--r--prism/static_literals.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/prism/static_literals.c b/prism/static_literals.c
index 17be22c2e7..64d6ffeec9 100644
--- a/prism/static_literals.c
+++ b/prism/static_literals.c
@@ -61,6 +61,10 @@ node_hash(const pm_parser_t *parser, const pm_node_t *node) {
hash ^= murmur_hash((const uint8_t *) value, sizeof(uint32_t));
}
+ if (integer->negative) {
+ hash ^= murmur_scramble((uint32_t) 1);
+ }
+
return hash;
}
case PM_SOURCE_LINE_NODE: {