@rescript/std
Version:
The motiviation of this repo is that when ReScript users want to share their library with JS users, the JS users don't need have ReScript toolchain installed, this makes sharing code with JS users easier (more details on that topic can be found in our [Ex
48 lines (40 loc) • 745 B
JavaScript
;
function power_2_above(_x, n) {
while(true) {
var x = _x;
if (x >= n) {
return x;
}
if ((x << 1) < x) {
return x;
}
_x = (x << 1);
continue ;
};
}
function make(hash, eq, hintSize) {
var s = power_2_above(16, hintSize);
return {
size: 0,
buckets: new Array(s),
hash: hash,
eq: eq
};
}
function clear(h) {
h.size = 0;
var h_buckets = h.buckets;
var len = h_buckets.length;
for(var i = 0; i < len; ++i){
h_buckets[i] = undefined;
}
}
function isEmpty(h) {
return h.size === 0;
}
var emptyOpt;
exports.emptyOpt = emptyOpt;
exports.make = make;
exports.clear = clear;
exports.isEmpty = isEmpty;
/* No side effect */