<commit_before>'use strict';
const util = require('./util');

function Status() {
	this.map = new Map();
}
module.exports = Status;

Status.prototype.clone = function() {
	const obj = Object.create(Status.prototype);
	obj.map = new Map(this.map);
	return obj;
};
Status.prototype.get = function(key) {
	return this.map.get(key) || 0;
};
Status.prototype.set = function(key, val) {
	this.map.set(key, val|0);
};
Status.prototype.incr = function(key, val) {
	this.map.set(key, (this.map.get(key)|0)+val);
};
Status.prototype.maybeDecr = function(key) {
	const val = this.map.get(key);
	if (val > 0) this.map.set(key, val-1);
};
Status.prototype.clear = function() {
	this.map.clear();
};
Status.prototype.hash = function() {
	let ret = 0xdeadbeef;
	for (const [k, v] of this.map) {
		if (v) ret ^= util.hashString(k) ^ (v * 0x04004004);
	}
	return ret;
};<commit_msg>Fix Status maybeDecr regression<commit_after>'use strict';
const util = require('./util');

function Status() {
	this.map = new Map();
}
module.exports = Status;

Status.prototype.clone = function() {
	const obj = Object.create(Status.prototype);
	obj.map = new Map(this.map);
	return obj;
};
Status.prototype.get = function(key) {
	return this.map.get(key) || 0;
};
Status.prototype.set = function(key, val) {
	this.map.set(key, val|0);
};
Status.prototype.incr = function(key, val) {
	this.map.set(key, (this.map.get(key)|0)+val);
};
Status.prototype.maybeDecr = function(key) {
	const val = this.get(key);
	if (val > 0) this.map.set(key, val-1);
	return val;
};
Status.prototype.clear = function() {
	this.map.clear();
};
Status.prototype.hash = function() {
	let ret = 0xdeadbeef;
	for (const [k, v] of this.map) {
		if (v) ret ^= util.hashString(k) ^ (v * 0x04004004);
	}
	return ret;
};
{'fraction_non_alphanumeric': 0.19237336368810473, 'fraction_numerical': 0.01707455890722823, 'mean_word_length': 4.327272727272727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6553172', 'n_tokens_mistral': 684, 'n_tokens_neox': 662, 'n_words': 143}