reign
Version:
A persistent, typed-objects implementation.
25 lines (21 loc) • 551 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = hashInteger;
var _performance = require("../../performance");
/**
* From https://github.com/v8/v8/blob/master/src/js/collection.js
*/
function hashInteger(input) {
let hash = input;
hash = hash ^ 0;
hash = ~hash + (hash << 15);
hash = hash ^ hash >>> 12;
hash = hash + (hash << 2);
hash = hash ^ hash >>> 4;
hash = hash * 2057 | 0;
hash = hash ^ hash >>> 16;
return hash & 0x3fffffff;
}
(0, _performance.forceInline)(hashInteger);