1
0
Fork 0
QuasselClient/src/qtshit/read/readShort.zig
2021-06-04 17:48:50 +01:00

16 lines
367 B
Zig

const std = @import("std");
pub fn readShort(reader: anytype) !u16 {
//std.debug.print("read: readShort\n", .{});
return try reader.readIntBig(u16);
}
test "deserialize short" {
var bytes = &[_]u8{ 0x13, 0x12 };
var fBS = std.io.fixedBufferStream(bytes);
var short = try readShort(fBS.reader());
try std.testing.expect(short == 0x1312);
}