Function writeUleb128 [src]
Write a single unsigned integer as LEB128 to the given writer.
Prototype
pub fn writeUleb128(w: *Writer, value: anytype) Error!void
Parameters
w: *Writer
Possible Errors
See the Writer
implementation for detailed diagnostics.
Source
pub fn writeUleb128(w: *Writer, value: anytype) Error!void {
try w.writeLeb128(switch (@typeInfo(@TypeOf(value))) {
.comptime_int => @as(std.math.IntFittingRange(0, @abs(value)), value),
.int => |value_info| switch (value_info.signedness) {
.signed => @as(@Type(.{ .int = .{ .signedness = .unsigned, .bits = value_info.bits -| 1 } }), @intCast(value)),
.unsigned => value,
},
else => comptime unreachable,
});
}