9 lines
196 B
JavaScript
9 lines
196 B
JavaScript
module.exports = {
|
|
encode: function (value) {
|
|
return (value << 1) ^ (value >> 31);
|
|
},
|
|
decode: function (value) {
|
|
return (value >> 1) ^ (-(value & 1));
|
|
}
|
|
};
|