Fix encoding uint

This commit is contained in:
Belma Gutlic 2019-12-24 17:27:55 +01:00
parent 4a04e955dd
commit a5ec8efd28

View File

@ -4,13 +4,13 @@ import {MessageBuffer} from "./xx";
export const int16BEEncode = (value, target, offset) => {
target = target || Buffer.allocUnsafe(2);
return target.writeInt16BE(value, offset);
return target.writeUInt16BE(value, offset);
};
int16BEEncode.bytes = 2;
export const int16BEDecode = data => {
if (data.length < 2) throw RangeError('Could not decode int16BE');
return data.readInt16BE(0);
return data.readUInt16BE(0);
};
int16BEDecode.bytes = 2;