1const std = @import("std");
2const string = []const u8;
3const extras = @import("./lib.zig");
4
5pub fn OneSmallerInt(comptime T: type) type {
6 const info = @typeInfo(T).int;
7 return @Int(info.signedness, info.bits - 1);
8}
9
10test {
11 try std.testing.expect(OneSmallerInt(u1) == u0);
12}
13test {
14 try std.testing.expect(OneSmallerInt(u2) == u1);
15}
16test {
17 try std.testing.expect(OneSmallerInt(u3) == u2);
18}
19test {
20 try std.testing.expect(OneSmallerInt(u4) == u3);
21}
22test {
23 try std.testing.expect(OneSmallerInt(u5) == u4);
24}
25test {
26 try std.testing.expect(OneSmallerInt(i1) == i0);
27}
28test {
29 try std.testing.expect(OneSmallerInt(i2) == i1);
30}
31test {
32 try std.testing.expect(OneSmallerInt(i3) == i2);
33}
34test {
35 try std.testing.expect(OneSmallerInt(i4) == i3);
36}
37test {
38 try std.testing.expect(OneSmallerInt(i5) == i4);
39}