| ... | @@ -51,12 +51,8 @@ pub fn int(input: anytype) @TypeOf(input) { | ... | @@ -51,12 +51,8 @@ pub fn int(input: anytype) @TypeOf(input) { |
| 51 | const Unsigned = @Type(.{ .int = .{ .signedness = .unsigned, .bits = info.bits } }); | 51 | const Unsigned = @Type(.{ .int = .{ .signedness = .unsigned, .bits = info.bits } }); |
| 52 | const casted: Unsigned = @bitCast(input); | 52 | const casted: Unsigned = @bitCast(input); |
| 53 | return @bitCast(int(casted)); | 53 | return @bitCast(int(casted)); |
| 54 | } else if (info.bits < 16) { | 54 | } else if (info.bits < 4) { |
| 55 | return @truncate(int(@as(u16, input))); | 55 | return @truncate(int(@as(u4, input))); |
| 56 | } else if (info.bits < 32) { | | |
| 57 | return @truncate(int(@as(u32, input))); | | |
| 58 | } else if (info.bits < 64) { | | |
| 59 | return @truncate(int(@as(u64, input))); | | |
| 60 | } | 56 | } |
| 61 | var x = input; | 57 | var x = input; |
| 62 | switch (info.bits) { | 58 | switch (info.bits) { |