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