Skip to content

Commit

Permalink
[ruby/prism] Better hashing between positive/negative integers
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored and matzbot committed Feb 29, 2024
1 parent 950c606 commit cb78408
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions prism/static_literals.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit cb78408

Please sign in to comment.