add ushort writer

This commit is contained in:
Andrew Kelley 2013-01-07 22:14:14 -05:00
parent a95fe18a4d
commit 8a6d4bc725

View file

@ -450,6 +450,7 @@ var packets = {
var writers = {
'int': IntWriter,
'short': ShortWriter,
'ushort': UShortWriter,
'byte': ByteWriter,
'ubyte': UByteWriter,
'string': StringWriter,
@ -963,6 +964,15 @@ ShortWriter.prototype.write = function(buffer, offset) {
buffer.writeInt16BE(this.value, offset);
}
function UShortWriter(value) {
this.value = value;
this.size = 2;
}
UShortWriter.prototype.write = function(buffer, offset) {
buffer.writeUInt16BE(this.value, offset);
}
function IntWriter(value) {
this.value = value;
this.size = 4;