bufValue
Function parameters
Parameters
- value:anytype
- min_len:usize
Type definitions in this namespace
Types
Functions in this namespace
Functions
Error sets in this namespace
Error Sets
Source
Implementation
fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min_len) {
return switch (@typeInfo(@TypeOf(value))) {
.comptime_int, .int => @intCast(value),
.@"enum" => @intFromEnum(value),
.bool => @intFromBool(value),
.@"struct" => @intCast(@as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))),
else => unreachable,
};
}