Skip to content

Commit

Permalink
Merge pull request #2526 from ruby/mix-in-negative
Browse files Browse the repository at this point in the history
Better hashing between positive/negative integers
  • Loading branch information
kddnewton committed Feb 29, 2024
2 parents aa42f45 + 68ddf08 commit 8679645
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/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 8679645

Please sign in to comment.