Function writeInt [src]
Asserts the buffer was initialized with a capacity of at least @sizeOf(T) bytes.
Prototype
pub inline fn writeInt(w: *Writer, comptime T: type, value: T, endian: std.builtin.Endian) Error!void
Parameters
w: *Writer
T: type
value: T
endian: std.builtin.Endian
Possible Errors
See the Writer
implementation for detailed diagnostics.
Source
pub inline fn writeInt(w: *Writer, comptime T: type, value: T, endian: std.builtin.Endian) Error!void {
var bytes: [@divExact(@typeInfo(T).int.bits, 8)]u8 = undefined;
std.mem.writeInt(std.math.ByteAlignedInt(@TypeOf(value)), &bytes, value, endian);
return w.writeAll(&bytes);
}