authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2026-05-03 20:50:09+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2026-05-03 21:42:06+01:00
log991f56fd6b23db0e6a6c78cac8ad62e869a39711
tree32819bee475570ac3705ce81d19e9f33c4636b88
parenta794287573a84f04f675efeb3278ebc00755a57b

std.meta: Remove Int in favor of @Int


79 files changed, 200 insertions(+), 209 deletions(-)

lib/compiler/resinator/errors.zig+7-7
......@@ -43,7 +43,7 @@ pub const Diagnostics = struct {
4343 try self.errors.append(self.allocator, error_details);
4444 }
4545
46 const SmallestStringIndexType = std.meta.Int(.unsigned, @min(
46 const SmallestStringIndexType = @Int(.unsigned, @min(
4747 @bitSizeOf(ErrorDetails.FileOpenError.FilenameStringIndex),
4848 @min(
4949 @bitSizeOf(ErrorDetails.IconReadError.FilenameStringIndex),
......@@ -165,7 +165,7 @@ pub const ErrorDetails = struct {
165165 err: FileOpenErrorEnum,
166166 filename_string_index: FilenameStringIndex,
167167
168 pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(FileOpenErrorEnum));
168 pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(FileOpenErrorEnum));
169169 pub const FileOpenErrorEnum = std.meta.FieldEnum(Io.File.OpenError || Io.File.StatError);
170170
171171 pub fn enumFromError(err: (Io.File.OpenError || Io.File.StatError)) FileOpenErrorEnum {
......@@ -180,7 +180,7 @@ pub const ErrorDetails = struct {
180180 icon_type: enum(u1) { cursor, icon },
181181 filename_string_index: FilenameStringIndex,
182182
183 pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(IconReadErrorEnum) - 1);
183 pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(IconReadErrorEnum) - 1);
184184 pub const IconReadErrorEnum = std.meta.FieldEnum(ico.ReadError);
185185
186186 pub fn enumFromError(err: ico.ReadError) IconReadErrorEnum {
......@@ -197,14 +197,14 @@ pub const ErrorDetails = struct {
197197 bitmap_version: ico.BitmapHeader.Version = .unknown,
198198 _: Padding = 0,
199199
200 pub const Padding = std.meta.Int(.unsigned, 15 - @bitSizeOf(ico.BitmapHeader.Version) - @bitSizeOf(ico.ImageFormat));
200 pub const Padding = @Int(.unsigned, 15 - @bitSizeOf(ico.BitmapHeader.Version) - @bitSizeOf(ico.ImageFormat));
201201 };
202202
203203 pub const BitmapReadError = packed struct(u32) {
204204 err: BitmapReadErrorEnum,
205205 filename_string_index: FilenameStringIndex,
206206
207 pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(BitmapReadErrorEnum));
207 pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(BitmapReadErrorEnum));
208208 pub const BitmapReadErrorEnum = std.meta.FieldEnum(bmp.ReadError);
209209
210210 pub fn enumFromError(err: bmp.ReadError) BitmapReadErrorEnum {
......@@ -218,14 +218,14 @@ pub const ErrorDetails = struct {
218218 dib_version: ico.BitmapHeader.Version,
219219 filename_string_index: FilenameStringIndex,
220220
221 pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(ico.BitmapHeader.Version));
221 pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(ico.BitmapHeader.Version));
222222 };
223223
224224 pub const AcceleratorError = packed struct(u32) {
225225 err: AcceleratorErrorEnum,
226226 _: Padding = 0,
227227
228 pub const Padding = std.meta.Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum));
228 pub const Padding = @Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum));
229229 pub const AcceleratorErrorEnum = std.meta.FieldEnum(res.ParseAcceleratorKeyStringError);
230230
231231 pub fn enumFromError(err: res.ParseAcceleratorKeyStringError) AcceleratorErrorEnum {
lib/compiler_rt.zig+4-4
......@@ -574,8 +574,8 @@ pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
574574 }
575575}
576576
577pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 {
578 const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
577pub fn normalize(comptime T: type, significand: *@Int(.unsigned, @typeInfo(T).float.bits)) i32 {
578 const Z = @Int(.unsigned, @typeInfo(T).float.bits);
579579 const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
580580
581581 const shift = @clz(significand.*) - @clz(integerBit);
......@@ -625,8 +625,8 @@ fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
625625pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
626626 return extern union {
627627 pub const bits = @divExact(@typeInfo(T).int.bits, 2);
628 pub const HalfTU = std.meta.Int(.unsigned, bits);
629 pub const HalfTS = std.meta.Int(.signed, bits);
628 pub const HalfTU = @Int(.unsigned, bits);
629 pub const HalfTS = @Int(.signed, bits);
630630 pub const HalfT = if (signed_half) HalfTS else HalfTU;
631631
632632 all: T,
lib/compiler_rt/addf3.zig+1-1
......@@ -8,7 +8,7 @@ const normalize = compiler_rt.normalize;
88/// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/lib/builtins/fp_add_impl.inc
99pub inline fn addf3(comptime T: type, a: T, b: T) T {
1010 const bits = @typeInfo(T).float.bits;
11 const Z = std.meta.Int(.unsigned, bits);
11 const Z = @Int(.unsigned, bits);
1212
1313 const typeWidth = bits;
1414 const significandBits = math.floatMantissaBits(T);
lib/compiler_rt/comparef.zig+3-3
......@@ -162,8 +162,8 @@ pub const GE = enum(i32) {
162162
163163pub inline fn cmpf2(comptime T: type, comptime RT: type, a: T, b: T) RT {
164164 const bits = @typeInfo(T).float.bits;
165 const srep_t = std.meta.Int(.signed, bits);
166 const rep_t = std.meta.Int(.unsigned, bits);
165 const srep_t = @Int(.signed, bits);
166 const rep_t = @Int(.unsigned, bits);
167167
168168 const significandBits = std.math.floatMantissaBits(T);
169169 const exponentBits = std.math.floatExponentBits(T);
......@@ -253,7 +253,7 @@ test "cmp_f80" {
253253}
254254
255255pub inline fn unordcmp(comptime T: type, a: T, b: T) i32 {
256 const rep_t = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
256 const rep_t = @Int(.unsigned, @typeInfo(T).float.bits);
257257
258258 const significandBits = std.math.floatMantissaBits(T);
259259 const exponentBits = std.math.floatExponentBits(T);
lib/compiler_rt/count0bits.zig+1-1
......@@ -198,7 +198,7 @@ pub fn __ctzti2(a: i128) callconv(.c) i32 {
198198}
199199
200200inline fn ffsXi2(comptime T: type, a: T) i32 {
201 var x: std.meta.Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a);
201 var x: @Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a);
202202 var n: T = 1;
203203 // adapted from Number of trailing zeroes (see ctzXi2)
204204 var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));
lib/compiler_rt/divdf3.zig+2-2
......@@ -26,8 +26,8 @@ fn __aeabi_ddiv(a: f64, b: f64) callconv(.{ .arm_aapcs = .{} }) f64 {
2626}
2727
2828inline fn div(a: f64, b: f64) f64 {
29 const Z = std.meta.Int(.unsigned, 64);
30 const SignedZ = std.meta.Int(.signed, 64);
29 const Z = @Int(.unsigned, 64);
30 const SignedZ = @Int(.signed, 64);
3131
3232 const significandBits = std.math.floatMantissaBits(f64);
3333 const exponentBits = std.math.floatExponentBits(f64);
lib/compiler_rt/divsf3.zig+1-1
......@@ -25,7 +25,7 @@ fn __aeabi_fdiv(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
2525}
2626
2727inline fn div(a: f32, b: f32) f32 {
28 const Z = std.meta.Int(.unsigned, 32);
28 const Z = @Int(.unsigned, 32);
2929
3030 const significandBits = std.math.floatMantissaBits(f32);
3131 const exponentBits = std.math.floatExponentBits(f32);
lib/compiler_rt/divtf3.zig+1-1
......@@ -24,7 +24,7 @@ fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.c) void {
2424}
2525
2626inline fn div(a: f128, b: f128) f128 {
27 const Z = std.meta.Int(.unsigned, 128);
27 const Z = @Int(.unsigned, 128);
2828
2929 const significandBits = std.math.floatMantissaBits(f128);
3030 const exponentBits = std.math.floatExponentBits(f128);
lib/compiler_rt/divxf3.zig+1-1
......@@ -13,7 +13,7 @@ comptime {
1313
1414pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 {
1515 const T = f80;
16 const Z = std.meta.Int(.unsigned, @bitSizeOf(T));
16 const Z = @Int(.unsigned, @bitSizeOf(T));
1717
1818 const significandBits = std.math.floatMantissaBits(T);
1919 const fractionalBits = std.math.floatFractionalBits(T);
lib/compiler_rt/extendf.zig+5-5
......@@ -3,10 +3,10 @@ const std = @import("std");
33pub inline fn extendf(
44 comptime dst_t: type,
55 comptime src_t: type,
6 a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits),
6 a: @Int(.unsigned, @typeInfo(src_t).float.bits),
77) dst_t {
8 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
9 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
8 const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
9 const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits);
1010 const srcSigBits = std.math.floatMantissaBits(src_t);
1111 const dstSigBits = std.math.floatMantissaBits(dst_t);
1212
......@@ -70,8 +70,8 @@ pub inline fn extendf(
7070 return @bitCast(result);
7171}
7272
73pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits)) f80 {
74 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
73pub inline fn extend_f80(comptime src_t: type, a: @Int(.unsigned, @typeInfo(src_t).float.bits)) f80 {
74 const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
7575 const src_sig_bits = std.math.floatMantissaBits(src_t);
7676 const dst_int_bit = 0x8000000000000000;
7777 const dst_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
lib/compiler_rt/fabs.zig+1-1
......@@ -47,7 +47,7 @@ pub fn fabsl(x: c_longdouble) callconv(.c) c_longdouble {
4747
4848inline fn generic_fabs(x: anytype) @TypeOf(x) {
4949 const T = @TypeOf(x);
50 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
50 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
5151 const float_bits: TBits = @bitCast(x);
5252 const remove_sign = ~@as(TBits, 0) >> 1;
5353 return @bitCast(float_bits & remove_sign);
lib/compiler_rt/float_from_int.zig+3-4
......@@ -1,5 +1,4 @@
11const std = @import("std");
2const Int = std.meta.Int;
32const math = std.math;
43
54pub fn floatFromInt(comptime T: type, x: anytype) T {
......@@ -7,14 +6,14 @@ pub fn floatFromInt(comptime T: type, x: anytype) T {
76
87 // Various constants whose values follow from the type parameters.
98 // Any reasonable optimizer will fold and propagate all of these.
10 const Z = Int(.unsigned, @bitSizeOf(@TypeOf(x)));
11 const uT = Int(.unsigned, @bitSizeOf(T));
9 const Z = @Int(.unsigned, @bitSizeOf(@TypeOf(x)));
10 const uT = @Int(.unsigned, @bitSizeOf(T));
1211 const inf = math.inf(T);
1312 const float_bits = @bitSizeOf(T);
1413 const int_bits = @bitSizeOf(@TypeOf(x));
1514 const exp_bits = math.floatExponentBits(T);
1615 const fractional_bits = math.floatFractionalBits(T);
17 const exp_bias = math.maxInt(Int(.unsigned, exp_bits - 1));
16 const exp_bias = math.maxInt(@Int(.unsigned, exp_bits - 1));
1817 const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0;
1918 const max_exp = exp_bias;
2019
lib/compiler_rt/fmax.zig+1-1
......@@ -59,7 +59,7 @@ inline fn generic_fmax(comptime T: type, x: T, y: T) T {
5959test "generic_fmax" {
6060 inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| {
6161 const nan_val = math.nan(T);
62 const Int = std.meta.Int(.unsigned, @bitSizeOf(T));
62 const Int = @Int(.unsigned, @bitSizeOf(T));
6363
6464 try std.testing.expect(math.isNan(generic_fmax(T, nan_val, nan_val)));
6565 try std.testing.expectEqual(@as(T, 1.0), generic_fmax(T, nan_val, 1.0));
lib/compiler_rt/fmin.zig+1-1
......@@ -59,7 +59,7 @@ inline fn generic_fmin(comptime T: type, x: T, y: T) T {
5959test "generic_fmin" {
6060 inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| {
6161 const nan_val = math.nan(T);
62 const Int = std.meta.Int(.unsigned, @bitSizeOf(T));
62 const Int = @Int(.unsigned, @bitSizeOf(T));
6363
6464 try std.testing.expect(math.isNan(generic_fmin(T, nan_val, nan_val)));
6565 try std.testing.expectEqual(@as(T, 1.0), generic_fmin(T, nan_val, 1.0));
lib/compiler_rt/fmod.zig+2-2
......@@ -36,7 +36,7 @@ pub fn fmod(x: f64, y: f64) callconv(.c) f64 {
3636/// Logic and flow heavily inspired by MUSL fmodl for 113 mantissa digits
3737pub fn __fmodx(a: f80, b: f80) callconv(.c) f80 {
3838 const T = f80;
39 const Z = std.meta.Int(.unsigned, @bitSizeOf(T));
39 const Z = @Int(.unsigned, @bitSizeOf(T));
4040
4141 const significandBits = math.floatMantissaBits(T);
4242 const fractionalBits = math.floatFractionalBits(T);
......@@ -260,7 +260,7 @@ pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.c) c_longdouble {
260260
261261inline fn generic_fmod(comptime T: type, x: T, y: T) T {
262262 const bits = @typeInfo(T).float.bits;
263 const uint = std.meta.Int(.unsigned, bits);
263 const uint = @Int(.unsigned, bits);
264264 comptime assert(T == f32 or T == f64);
265265 const digits = if (T == f32) 23 else 52;
266266 const exp_bits = if (T == f32) 9 else 12;
lib/compiler_rt/mulf3.zig+2-2
......@@ -12,7 +12,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
1212 const fractionalBits = math.floatFractionalBits(T);
1313 const exponentBits = math.floatExponentBits(T);
1414
15 const Z = std.meta.Int(.unsigned, typeWidth);
15 const Z = @Int(.unsigned, typeWidth);
1616
1717 // ZSignificand is large enough to contain the significand, including an explicit integer bit
1818 const ZSignificand = PowerOfTwoSignificandZ(T);
......@@ -195,7 +195,7 @@ fn normalize(comptime T: type, significand: *PowerOfTwoSignificandZ(T)) i32 {
195195/// the significand of T, including an explicit integer bit
196196fn PowerOfTwoSignificandZ(comptime T: type) type {
197197 const bits = math.ceilPowerOfTwoAssert(u16, math.floatFractionalBits(T) + 1);
198 return std.meta.Int(.unsigned, bits);
198 return @Int(.unsigned, bits);
199199}
200200
201201test {
lib/compiler_rt/truncf.zig+3-3
......@@ -1,8 +1,8 @@
11const std = @import("std");
22
33pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {
4 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
5 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
4 const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
5 const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits);
66 const srcSigBits = std.math.floatMantissaBits(src_t);
77 const dstSigBits = std.math.floatMantissaBits(dst_t);
88
......@@ -100,7 +100,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t
100100}
101101
102102pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t {
103 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
103 const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits);
104104 const src_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
105105 const dst_sig_bits = std.math.floatMantissaBits(dst_t);
106106
lib/std/Build/abi.zig+1-1
......@@ -266,7 +266,7 @@ pub const fuzz = struct {
266266 .comptime_int => x,
267267 .bool => @intFromBool(x),
268268 .@"enum" => @intFromEnum(x),
269 else => @as(std.meta.Int(.unsigned, @bitSizeOf(T)), @bitCast(x)),
269 else => @as(@Int(.unsigned, @bitSizeOf(T)), @bitCast(x)),
270270
271271 .int => |i| x: {
272272 comptime {
lib/std/Io/Threaded.zig+1-1
......@@ -15574,7 +15574,7 @@ fn readIntFd(fd: posix.fd_t) !ErrInt {
1557415574 return @intCast(std.mem.readInt(u64, &buffer, .little));
1557515575}
1557615576
15577const ErrInt = std.meta.Int(.unsigned, @sizeOf(anyerror) * 8);
15577const ErrInt = @Int(.unsigned, @sizeOf(anyerror) * 8);
1557815578
1557915579fn destroyPipe(pipe: [2]posix.fd_t) void {
1558015580 if (pipe[0] != -1) closeFd(pipe[0]);
lib/std/Io/Writer.zig+2-2
......@@ -1517,7 +1517,7 @@ pub fn printIntAny(
15171517 // The type must have the same size as `base` or be wider in order for the
15181518 // division to work
15191519 const min_int_bits = comptime @max(value_info.bits, 8);
1520 const MinInt = std.meta.Int(.unsigned, min_int_bits);
1520 const MinInt = @Int(.unsigned, min_int_bits);
15211521
15221522 const abs_value = @abs(value);
15231523 // The worst case in terms of space needed is base 2, plus 1 for the sign
......@@ -1637,7 +1637,7 @@ pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precisi
16371637 });
16381638
16391639 const T = @TypeOf(v);
1640 const TU = std.meta.Int(.unsigned, @bitSizeOf(T));
1640 const TU = @Int(.unsigned, @bitSizeOf(T));
16411641
16421642 const mantissa_bits = std.math.floatMantissaBits(T);
16431643 const fractional_bits = std.math.floatFractionalBits(T);
lib/std/Random.zig+6-6
......@@ -125,9 +125,9 @@ pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: ty
125125/// `i` is evenly distributed.
126126pub fn int(r: Random, comptime T: type) T {
127127 const bits = @typeInfo(T).int.bits;
128 const UnsignedT = std.meta.Int(.unsigned, bits);
128 const UnsignedT = @Int(.unsigned, bits);
129129 const ceil_bytes = comptime std.math.divCeil(u16, bits, 8) catch unreachable;
130 const ByteAlignedT = std.meta.Int(.unsigned, ceil_bytes * 8);
130 const ByteAlignedT = @Int(.unsigned, ceil_bytes * 8);
131131
132132 var rand_bytes: [ceil_bytes]u8 = undefined;
133133 r.bytes(&rand_bytes);
......@@ -215,7 +215,7 @@ pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_tha
215215 const info = @typeInfo(T).int;
216216 if (info.signedness == .signed) {
217217 // Two's complement makes this math pretty easy.
218 const UnsignedT = std.meta.Int(.unsigned, info.bits);
218 const UnsignedT = @Int(.unsigned, info.bits);
219219 const lo: UnsignedT = @bitCast(at_least);
220220 const hi: UnsignedT = @bitCast(less_than);
221221 const result = lo +% r.uintLessThanBiased(UnsignedT, hi -% lo);
......@@ -234,7 +234,7 @@ pub fn intRangeLessThan(r: Random, comptime T: type, at_least: T, less_than: T)
234234 const info = @typeInfo(T).int;
235235 if (info.signedness == .signed) {
236236 // Two's complement makes this math pretty easy.
237 const UnsignedT = std.meta.Int(.unsigned, info.bits);
237 const UnsignedT = @Int(.unsigned, info.bits);
238238 const lo: UnsignedT = @bitCast(at_least);
239239 const hi: UnsignedT = @bitCast(less_than);
240240 const result = lo +% r.uintLessThan(UnsignedT, hi -% lo);
......@@ -252,7 +252,7 @@ pub fn intRangeAtMostBiased(r: Random, comptime T: type, at_least: T, at_most: T
252252 const info = @typeInfo(T).int;
253253 if (info.signedness == .signed) {
254254 // Two's complement makes this math pretty easy.
255 const UnsignedT = std.meta.Int(.unsigned, info.bits);
255 const UnsignedT = @Int(.unsigned, info.bits);
256256 const lo: UnsignedT = @bitCast(at_least);
257257 const hi: UnsignedT = @bitCast(at_most);
258258 const result = lo +% r.uintAtMostBiased(UnsignedT, hi -% lo);
......@@ -271,7 +271,7 @@ pub fn intRangeAtMost(r: Random, comptime T: type, at_least: T, at_most: T) T {
271271 const info = @typeInfo(T).int;
272272 if (info.signedness == .signed) {
273273 // Two's complement makes this math pretty easy.
274 const UnsignedT = std.meta.Int(.unsigned, info.bits);
274 const UnsignedT = @Int(.unsigned, info.bits);
275275 const lo: UnsignedT = @bitCast(at_least);
276276 const hi: UnsignedT = @bitCast(at_most);
277277 const result = lo +% r.uintAtMost(UnsignedT, hi -% lo);
lib/std/Target.zig+1-1
......@@ -1228,7 +1228,7 @@ pub const Cpu = struct {
12281228 pub const needed_bit_count = 347;
12291229 pub const byte_count = (needed_bit_count + 7) / 8;
12301230 pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize);
1231 pub const Index = std.math.Log2Int(std.meta.Int(.unsigned, usize_count * @bitSizeOf(usize)));
1231 pub const Index = std.math.Log2Int(@Int(.unsigned, usize_count * @bitSizeOf(usize)));
12321232 pub const ShiftInt = std.math.Log2Int(usize);
12331233
12341234 pub const empty: Set = .{ .ints = @splat(0) };
lib/std/bit_set.zig+3-3
......@@ -65,7 +65,7 @@ pub fn Integer(comptime size: u16) type {
6565 pub const bit_length: usize = size;
6666
6767 /// The integer type used to represent a mask in this bit set
68 pub const MaskInt = std.meta.Int(.unsigned, size);
68 pub const MaskInt = @Int(.unsigned, size);
6969
7070 /// The integer type used to shift a mask in this bit set
7171 pub const ShiftInt = std.math.Log2Int(MaskInt);
......@@ -359,7 +359,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
359359 if (!std.math.isPowerOfTwo(@bitSizeOf(MaskIntType))) {
360360 var desired_bits = std.math.ceilPowerOfTwoAssert(usize, @bitSizeOf(MaskIntType));
361361 if (desired_bits < byte_size) desired_bits = byte_size;
362 const FixedMaskType = std.meta.Int(.unsigned, desired_bits);
362 const FixedMaskType = @Int(.unsigned, desired_bits);
363363 @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++
364364 ", which is not a power of two. Please round this up to a power of two integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
365365 }
......@@ -370,7 +370,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
370370 if (@bitSizeOf(MaskIntType) != @sizeOf(MaskIntType) * byte_size) {
371371 var desired_bits = @sizeOf(MaskIntType) * byte_size;
372372 desired_bits = std.math.ceilPowerOfTwoAssert(usize, desired_bits);
373 const FixedMaskType = std.meta.Int(.unsigned, desired_bits);
373 const FixedMaskType = @Int(.unsigned, desired_bits);
374374 @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++
375375 ", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
376376 }
lib/std/c.zig+5-5
......@@ -7185,7 +7185,7 @@ pub const RTLD = switch (native_os) {
71857185 NOW: bool = false,
71867186 GLOBAL: bool = false,
71877187 LOCAL: bool = false,
7188 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 6) = 0,
7188 _: @Int(.unsigned, @bitSizeOf(c_int) - 6) = 0,
71897189 },
71907190 else => void,
71917191};
......@@ -7365,7 +7365,7 @@ pub const AI = if (builtin.abi.isAndroid()) packed struct(u32) {
73657365 V4MAPPED: bool = false,
73667366 ALL: bool = false,
73677367 ADDRCONFIG: bool = false,
7368 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 7) = 0,
7368 _: @Int(.unsigned, @bitSizeOf(c_int) - 7) = 0,
73697369 },
73707370 else => void,
73717371};
......@@ -7398,7 +7398,7 @@ pub const NI = switch (native_os) {
73987398 NAMEREQD: bool = false,
73997399 NOFQDN: bool = false,
74007400 DGRAM: bool = false,
7401 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 5) = 0,
7401 _: @Int(.unsigned, @bitSizeOf(c_int) - 5) = 0,
74027402 },
74037403 .freebsd, .haiku => packed struct(u32) {
74047404 NOFQDN: bool = false,
......@@ -8634,7 +8634,7 @@ pub const O = switch (native_os) {
86348634 CLOEXEC: bool = false,
86358635 DIRECT: bool = false,
86368636 SYNC: bool = false,
8637 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 14) = 0,
8637 _: @Int(.unsigned, @bitSizeOf(c_int) - 14) = 0,
86388638 },
86398639 else => void,
86408640};
......@@ -8788,7 +8788,7 @@ pub const MAP = switch (native_os) {
87888788 RANDOMIZED: bool = false,
87898789 PURGEABLE: bool = false,
87908790 FIXED_NOREPLACE: bool = false,
8791 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 11) = 0,
8791 _: @Int(.unsigned, @bitSizeOf(c_int) - 11) = 0,
87928792 },
87938793 else => void,
87948794};
lib/std/compress/zstd/Decompress.zig+5-5
......@@ -533,7 +533,7 @@ pub const Frame = struct {
533533 table: Table,
534534 accuracy_log: u8,
535535
536 const State = std.meta.Int(.unsigned, max_accuracy_log);
536 const State = @Int(.unsigned, max_accuracy_log);
537537 };
538538 }
539539
......@@ -1783,7 +1783,7 @@ const ReverseBitReader = struct {
17831783 }
17841784
17851785 fn initBits(comptime T: type, out: anytype, num: u16) Bits(T) {
1786 const UT = std.meta.Int(.unsigned, @bitSizeOf(T));
1786 const UT = @Int(.unsigned, @bitSizeOf(T));
17871787 return .{
17881788 @bitCast(@as(UT, @intCast(out))),
17891789 num,
......@@ -1803,7 +1803,7 @@ const ReverseBitReader = struct {
18031803 }
18041804
18051805 fn readBitsTuple(self: *ReverseBitReader, comptime T: type, num: u16) !Bits(T) {
1806 const UT = std.meta.Int(.unsigned, @bitSizeOf(T));
1806 const UT = @Int(.unsigned, @bitSizeOf(T));
18071807 const U = if (@bitSizeOf(T) < 8) u8 else UT;
18081808
18091809 if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num);
......@@ -1871,7 +1871,7 @@ const BitReader = struct {
18711871 count: u4 = 0,
18721872
18731873 fn initBits(comptime T: type, out: anytype, num: u16) Bits(T) {
1874 const UT = std.meta.Int(.unsigned, @bitSizeOf(T));
1874 const UT = @Int(.unsigned, @bitSizeOf(T));
18751875 return .{
18761876 @bitCast(@as(UT, @intCast(out))),
18771877 num,
......@@ -1891,7 +1891,7 @@ const BitReader = struct {
18911891 }
18921892
18931893 fn readBitsTuple(self: *@This(), comptime T: type, num: u16) !Bits(T) {
1894 const UT = std.meta.Int(.unsigned, @bitSizeOf(T));
1894 const UT = @Int(.unsigned, @bitSizeOf(T));
18951895 const U = if (@bitSizeOf(T) < 8) u8 else UT;
18961896
18971897 if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num);
lib/std/crypto/aes_ccm.zig+2-2
......@@ -171,7 +171,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le
171171 block[0] = L - 1; // flags
172172 @memcpy(block[1..][0..nonce_length], &npub);
173173 // Counter goes in the last L bytes
174 const CounterInt = std.meta.Int(.unsigned, L * 8);
174 const CounterInt = @Int(.unsigned, L * 8);
175175 mem.writeInt(CounterInt, block[1 + nonce_length ..][0..L], @as(CounterInt, @intCast(counter)), .big);
176176 }
177177
......@@ -229,7 +229,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le
229229 @memcpy(block[1..][0..nonce_length], &npub);
230230
231231 // Encode message length in last L bytes
232 const LengthInt = std.meta.Int(.unsigned, L * 8);
232 const LengthInt = @Int(.unsigned, L * 8);
233233 mem.writeInt(LengthInt, block[1 + nonce_length ..][0..L], @as(LengthInt, @intCast(msg_len)), .big);
234234 }
235235
lib/std/crypto/cmac.zig+1-1
......@@ -74,7 +74,7 @@ pub fn Cmac(comptime BlockCipher: type) type {
7474 }
7575
7676 fn double(l: Block) Block {
77 const Int = std.meta.Int(.unsigned, block_length * 8);
77 const Int = @Int(.unsigned, block_length * 8);
7878 const l_ = mem.readInt(Int, &l, .big);
7979 const l_2 = switch (block_length) {
8080 8 => (l_ << 1) ^ (0x1b & -%(l_ >> 63)), // mod x^64 + x^4 + x^3 + x + 1
lib/std/crypto/codecs/asn1/der/Encoder.zig+1-1
......@@ -129,7 +129,7 @@ fn int(self: *Encoder, comptime T: type, value: T) !void {
129129 const needs_padding: u1 = if (value == 0)
130130 1
131131 else if (bits_needed > 8) brk: {
132 const RightShift = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(bits_needed)) - 1);
132 const RightShift = @Int(.unsigned, @bitSizeOf(@TypeOf(bits_needed)) - 1);
133133 const right_shift: RightShift = @intCast(bits_needed - 9);
134134 break :brk if (value >> right_shift == 0x1ff) 1 else 0;
135135 } else 0;
lib/std/crypto/ff.zig+2-3
......@@ -10,7 +10,6 @@ const builtin = @import("builtin");
1010const crypto = std.crypto;
1111const math = std.math;
1212const mem = std.mem;
13const meta = std.meta;
1413const testing = std.testing;
1514const assert = std.debug.assert;
1615const Endian = std.builtin.Endian;
......@@ -25,7 +24,7 @@ const carry_bits = 1;
2524const t_bits: usize = @bitSizeOf(Limb) - carry_bits;
2625
2726// A TLimb is a Limb that is truncated to t_bits.
28const TLimb = meta.Int(.unsigned, t_bits);
27const TLimb = @Int(.unsigned, t_bits);
2928
3029const native_endian = builtin.target.cpu.arch.endian();
3130
......@@ -906,7 +905,7 @@ const ct_protected = struct {
906905 // Multiplies two limbs and returns the result as a wide limb.
907906 fn mulWide(x: Limb, y: Limb) WideLimb {
908907 const half_bits = @typeInfo(Limb).int.bits / 2;
909 const Half = meta.Int(.unsigned, half_bits);
908 const Half = @Int(.unsigned, half_bits);
910909 const x0 = @as(Half, @truncate(x));
911910 const x1 = @as(Half, @truncate(x >> half_bits));
912911 const y0 = @as(Half, @truncate(y));
lib/std/crypto/keccak_p.zig+1-1
......@@ -9,7 +9,7 @@ const mode = @import("builtin").mode;
99/// The Keccak-f permutation.
1010pub fn KeccakF(comptime f: u11) type {
1111 comptime assert(f >= 200 and f <= 1600 and f % 200 == 0); // invalid bit size
12 const T = std.meta.Int(.unsigned, f / 25);
12 const T = @Int(.unsigned, f / 25);
1313 const Block = [25]T;
1414
1515 const PI = [_]u5{
lib/std/crypto/ml_dsa.zig+6-6
......@@ -3413,7 +3413,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
34133413 // Use a signed type for EEA computation
34143414 const type_info = @typeInfo(T);
34153415 const SignedT = if (type_info == .int and type_info.int.signedness == .unsigned)
3416 std.meta.Int(.signed, type_info.int.bits)
3416 @Int(.signed, type_info.int.bits)
34173417 else
34183418 T;
34193419
......@@ -3436,7 +3436,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
34363436fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T {
34373437 const type_info = @typeInfo(T);
34383438 const bits = type_info.int.bits;
3439 const WideT = std.meta.Int(.unsigned, bits * 2);
3439 const WideT = @Int(.unsigned, bits * 2);
34403440
34413441 var ret: T = 1;
34423442 var base: T = a;
......@@ -3465,14 +3465,14 @@ fn bitMask(comptime T: type, bit: T) T {
34653465
34663466/// Creates a mask from the sign bit of a signed integer.
34673467/// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0.
3468fn signMask(comptime T: type, x: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) {
3468fn signMask(comptime T: type, x: T) @Int(.unsigned, @typeInfo(T).int.bits) {
34693469 const type_info = @typeInfo(T);
34703470 if (type_info != .int) {
34713471 @compileError("signMask requires an integer type");
34723472 }
34733473
34743474 const bits = type_info.int.bits;
3475 const SignedT = std.meta.Int(.signed, bits);
3475 const SignedT = @Int(.signed, bits);
34763476
34773477 // Convert to signed if needed, arithmetic right shift to propagate sign bit
34783478 const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x);
......@@ -3499,8 +3499,8 @@ fn montgomeryReduce(
34993499 const m: OutT = @truncate(m_full);
35003500
35013501 const yR = x -% @as(InT, m) * @as(InT, q);
3502 const y_shifted = @as(std.meta.Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits;
3503 return @bitCast(@as(std.meta.Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
3502 const y_shifted = @as(@Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits;
3503 return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
35043504}
35053505
35063506/// Uniform sampling using SHAKE-128 with rejection sampling.
lib/std/crypto/ml_kem.zig+6-6
......@@ -1794,7 +1794,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
17941794 // Use a signed type for EEA computation
17951795 const type_info = @typeInfo(T);
17961796 const SignedT = if (type_info == .int and type_info.int.signedness == .unsigned)
1797 std.meta.Int(.signed, type_info.int.bits)
1797 @Int(.signed, type_info.int.bits)
17981798 else
17991799 T;
18001800
......@@ -1817,7 +1817,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
18171817fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T {
18181818 const type_info = @typeInfo(T);
18191819 const bits = type_info.int.bits;
1820 const WideT = std.meta.Int(.unsigned, bits * 2);
1820 const WideT = @Int(.unsigned, bits * 2);
18211821
18221822 var ret: T = 1;
18231823 var base: T = a;
......@@ -1846,14 +1846,14 @@ fn bitMask(comptime T: type, bit: T) T {
18461846
18471847/// Creates a mask from the sign bit of a signed integer.
18481848/// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0.
1849fn signMask(comptime T: type, x: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) {
1849fn signMask(comptime T: type, x: T) @Int(.unsigned, @typeInfo(T).int.bits) {
18501850 const type_info = @typeInfo(T);
18511851 if (type_info != .int) {
18521852 @compileError("signMask requires an integer type");
18531853 }
18541854
18551855 const bits = type_info.int.bits;
1856 const SignedT = std.meta.Int(.signed, bits);
1856 const SignedT = @Int(.signed, bits);
18571857
18581858 // Convert to signed if needed, arithmetic right shift to propagate sign bit
18591859 const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x);
......@@ -1898,8 +1898,8 @@ fn montgomeryReduce(
18981898 const m: OutT = @truncate(m_full);
18991899
19001900 const yR = x -% @as(InT, m) * @as(InT, q);
1901 const y_shifted = @as(std.meta.Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits;
1902 return @bitCast(@as(std.meta.Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
1901 const y_shifted = @as(@Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits;
1902 return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
19031903}
19041904
19051905/// Uniform sampling using SHAKE-128 with rejection sampling.
lib/std/crypto/modes.zig+1-1
......@@ -40,7 +40,7 @@ pub fn ctrSlice(
4040 var counterBlock = iv;
4141 var i: usize = 0;
4242
43 const CounterInt = std.meta.Int(.unsigned, counter_size * 8);
43 const CounterInt = @Int(.unsigned, counter_size * 8);
4444
4545 const parallel_count = BlockCipher.block.parallel.optimal_parallel_blocks;
4646 const wide_block_length = parallel_count * block_length;
lib/std/crypto/pcurves/common.zig+4-5
......@@ -2,7 +2,6 @@ const std = @import("std");
22const crypto = std.crypto;
33const debug = std.debug;
44const mem = std.mem;
5const meta = std.meta;
65
76const NonCanonicalError = crypto.errors.NonCanonicalError;
87const NotSquareError = crypto.errors.NotSquareError;
......@@ -54,7 +53,7 @@ pub fn Field(comptime params: FieldParams) type {
5453 var s = if (endian == .little) s_ else orderSwap(s_);
5554 const field_order_s = comptime fos: {
5655 var fos: [encoded_length]u8 = undefined;
57 mem.writeInt(std.meta.Int(.unsigned, encoded_length * 8), &fos, field_order, .little);
56 mem.writeInt(@Int(.unsigned, encoded_length * 8), &fos, field_order, .little);
5857 break :fos fos;
5958 };
6059 if (crypto.timing_safe.compare(u8, &s, &field_order_s, .little) != .lt) {
......@@ -90,7 +89,7 @@ pub fn Field(comptime params: FieldParams) type {
9089 }
9190
9291 /// Element as an integer.
93 pub const IntRepr = meta.Int(.unsigned, params.field_bits);
92 pub const IntRepr = @Int(.unsigned, params.field_bits);
9493
9594 /// Create a field element from an integer.
9695 pub fn fromInt(comptime x: IntRepr) NonCanonicalError!Fe {
......@@ -270,7 +269,7 @@ pub fn Field(comptime params: FieldParams) type {
270269 const ls = x126.sqn(126).mul(x126).sqn(3).mul(t111).sqn(33).mul(x32).sqn(95).mul(x31);
271270 return ls.equivalent(Fe.one);
272271 } else {
273 const ls = x2.pow(std.meta.Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol
272 const ls = x2.pow(@Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol
274273 return ls.equivalent(Fe.one);
275274 }
276275 }
......@@ -307,7 +306,7 @@ pub fn Field(comptime params: FieldParams) type {
307306 const x108 = x54.sqn(54).mul(x54);
308307 return x108.sqn(108).mul(x108).sqn(7).mul(t1111111).sqn(23).mul(x22).sqn(6).mul(t11).sqn(2);
309308 } else {
310 return x2.pow(std.meta.Int(.unsigned, field_bits), (field_order + 1) / 4);
309 return x2.pow(@Int(.unsigned, field_bits), (field_order + 1) / 4);
311310 }
312311 }
313312
lib/std/crypto/timing_safe.zig+5-5
......@@ -21,8 +21,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool {
2121 acc |= x ^ b[i];
2222 }
2323 const s = @typeInfo(C).int.bits;
24 const Cu = std.meta.Int(.unsigned, s);
25 const Cext = std.meta.Int(.unsigned, s + 1);
24 const Cu = @Int(.unsigned, s);
25 const Cext = @Int(.unsigned, s + 1);
2626 return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
2727 },
2828 .vector => |info| {
......@@ -32,8 +32,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool {
3232 }
3333 const acc = @reduce(.Or, a ^ b);
3434 const s = @typeInfo(C).int.bits;
35 const Cu = std.meta.Int(.unsigned, s);
36 const Cext = std.meta.Int(.unsigned, s + 1);
35 const Cu = @Int(.unsigned, s);
36 const Cext = @Int(.unsigned, s + 1);
3737 return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
3838 },
3939 else => {
......@@ -50,7 +50,7 @@ pub fn compare(comptime T: type, a: []const T, b: []const T, endian: Endian) Ord
5050 .int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits,
5151 else => @compileError("Elements to be compared must be integers"),
5252 };
53 const Cext = std.meta.Int(.unsigned, bits + 1);
53 const Cext = @Int(.unsigned, bits + 1);
5454 var gt: T = 0;
5555 var eq: T = 1;
5656 if (endian == .little) {
lib/std/enums.zig+5-5
......@@ -1291,7 +1291,7 @@ pub fn EnumIndexer(comptime E: type) type {
12911291 const min_value = std.math.minInt(BackingInt);
12921292 const max_value = std.math.maxInt(BackingInt);
12931293
1294 const RangeType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt));
1294 const RangeType = @Int(.unsigned, @bitSizeOf(BackingInt));
12951295 pub const count: comptime_int = std.math.maxInt(RangeType) + 1;
12961296
12971297 pub fn indexOf(e: E) usize {
......@@ -1307,7 +1307,7 @@ pub fn EnumIndexer(comptime E: type) type {
13071307 if (backing_int_sign == .unsigned)
13081308 return @enumFromInt(i);
13091309
1310 return @enumFromInt(@as(std.meta.Int(.signed, @bitSizeOf(RangeType) + 1), @intCast(i)) + min_value);
1310 return @enumFromInt(@as(@Int(.signed, @bitSizeOf(RangeType) + 1), @intCast(i)) + min_value);
13111311 }
13121312 };
13131313 }
......@@ -1380,14 +1380,14 @@ test "EnumIndexer non-exhaustive" {
13801380 i4,
13811381 i8,
13821382 i16,
1383 std.meta.Int(.signed, @bitSizeOf(isize) - 1),
1383 @Int(.signed, @bitSizeOf(isize) - 1),
13841384 isize,
13851385 u1,
13861386 u2,
13871387 u3,
13881388 u4,
13891389 u16,
1390 std.meta.Int(.unsigned, @bitSizeOf(usize) - 1),
1390 @Int(.unsigned, @bitSizeOf(usize) - 1),
13911391 usize,
13921392 };
13931393 inline for (backing_ints) |BackingInt| {
......@@ -1400,7 +1400,7 @@ test "EnumIndexer non-exhaustive" {
14001400 const min_tag: E = @enumFromInt(std.math.minInt(BackingInt));
14011401 const max_tag: E = @enumFromInt(std.math.maxInt(BackingInt));
14021402
1403 const RangedType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt));
1403 const RangedType = @Int(.unsigned, @bitSizeOf(BackingInt));
14041404 const max_index: comptime_int = std.math.maxInt(RangedType);
14051405 const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).int.signedness) {
14061406 .unsigned => 0,
lib/std/fmt.zig+1-1
......@@ -433,7 +433,7 @@ fn parseIntWithSign(
433433 // accumulate into Accumulate which is always 8 bits or larger. this prevents
434434 // `buf_base` from overflowing Result.
435435 const info = @typeInfo(Result);
436 const Accumulate = std.meta.Int(info.int.signedness, @max(8, info.int.bits));
436 const Accumulate = @Int(info.int.signedness, @max(8, info.int.bits));
437437 var accumulate: Accumulate = 0;
438438
439439 if (buf_start[0] == '_' or buf_start[buf_start.len - 1] == '_') return error.InvalidCharacter;
lib/std/fmt/parse_float.zig+1-1
......@@ -128,7 +128,7 @@ test parseFloat {
128128
129129test "nan and inf" {
130130 inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| {
131 const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
131 const Z = @Int(.unsigned, @typeInfo(T).float.bits);
132132
133133 try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T))));
134134 try expectEqual(try parseFloat(T, "inF"), std.math.inf(T));
lib/std/hash/wyhash.zig+1-1
......@@ -130,7 +130,7 @@ pub const Wyhash = struct {
130130
131131 inline fn read(comptime bytes: usize, data: []const u8) u64 {
132132 std.debug.assert(bytes <= 8);
133 const T = std.meta.Int(.unsigned, 8 * bytes);
133 const T = @Int(.unsigned, 8 * bytes);
134134 return @as(u64, std.mem.readInt(T, data[0..bytes], .little));
135135 }
136136
lib/std/heap/debug_allocator.zig+1-1
......@@ -189,7 +189,7 @@ pub fn DebugAllocator(comptime config: Config) type {
189189 const page_size = config.page_size;
190190 const page_align: mem.Alignment = .fromByteUnits(page_size);
191191 /// Integer type for pointing to slots in a small allocation
192 const SlotIndex = std.meta.Int(.unsigned, math.log2(page_size) + 1);
192 const SlotIndex = @Int(.unsigned, math.log2(page_size) + 1);
193193
194194 const total_requested_bytes_init = if (config.enable_memory_limit) @as(usize, 0) else {};
195195 const requested_memory_limit_init = if (config.enable_memory_limit) @as(usize, math.maxInt(usize)) else {};
lib/std/leb128.zig+2-2
......@@ -9,7 +9,7 @@ const testing = std.testing;
99/// An example use case of this is in emitting DWARF info where one wants to make a ULEB128 field
1010/// "relocatable", meaning that it becomes possible to later go back and patch the number to be a
1111/// different value without shifting all the following code.
12pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.unsigned, l * 7)) void {
12pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: @Int(.unsigned, l * 7)) void {
1313 writeUnsignedExtended(ptr, int);
1414}
1515
......@@ -65,7 +65,7 @@ test writeUnsignedFixed {
6565/// An example use case of this is in emitting DWARF info where one wants to make a ILEB128 field
6666/// "relocatable", meaning that it becomes possible to later go back and patch the number to be a
6767/// different value without shifting all the following code.
68pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.signed, l * 7)) void {
68pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: @Int(.signed, l * 7)) void {
6969 const T = @TypeOf(int);
7070 const U = if (@typeInfo(T).int.bits < 8) u8 else T;
7171 var value: U = @intCast(int);
lib/std/math.zig+8-8
......@@ -779,7 +779,7 @@ pub fn Log2Int(comptime T: type) type {
779779 if (T == comptime_int) return comptime_int;
780780 const bits: u16 = @typeInfo(T).int.bits;
781781 const log2_bits = 16 - @clz(bits - 1);
782 return std.meta.Int(.unsigned, log2_bits);
782 return @Int(.unsigned, log2_bits);
783783}
784784
785785/// Returns an unsigned int type that can hold the number of bits in T.
......@@ -788,7 +788,7 @@ pub fn Log2IntCeil(comptime T: type) type {
788788 if (T == comptime_int) return comptime_int;
789789 const bits: u16 = @typeInfo(T).int.bits;
790790 const log2_bits = 16 - @clz(bits);
791 return std.meta.Int(.unsigned, log2_bits);
791 return @Int(.unsigned, log2_bits);
792792}
793793
794794/// Returns the smallest integer type that can hold both from and to.
......@@ -1048,10 +1048,10 @@ fn testRem() !void {
10481048
10491049/// Returns the negation of the integer parameter.
10501050/// Result is a signed integer.
1051pub fn negateCast(x: anytype) !std.meta.Int(.signed, @bitSizeOf(@TypeOf(x))) {
1051pub fn negateCast(x: anytype) !@Int(.signed, @bitSizeOf(@TypeOf(x))) {
10521052 if (@typeInfo(@TypeOf(x)).int.signedness == .signed) return negate(x);
10531053
1054 const int = std.meta.Int(.signed, @bitSizeOf(@TypeOf(x)));
1054 const int = @Int(.signed, @bitSizeOf(@TypeOf(x)));
10551055 if (x > -minInt(int)) return error.Overflow;
10561056
10571057 if (x == -minInt(int)) return minInt(int);
......@@ -1177,7 +1177,7 @@ pub inline fn floor(value: anytype) @TypeOf(value) {
11771177/// Returns the nearest power of two less than or equal to value, or
11781178/// zero if value is less than or equal to zero.
11791179pub fn floorPowerOfTwo(comptime T: type, value: T) T {
1180 const uT = std.meta.Int(.unsigned, @typeInfo(T).int.bits);
1180 const uT = @Int(.unsigned, @typeInfo(T).int.bits);
11811181 if (value <= 0) return 0;
11821182 return @as(T, 1) << log2_int(uT, @as(uT, @intCast(value)));
11831183}
......@@ -1212,7 +1212,7 @@ pub inline fn ceil(value: anytype) @TypeOf(value) {
12121212/// Returns the next power of two (if the value is not already a power of two).
12131213/// Only unsigned integers can be used. Zero is not an allowed input.
12141214/// Result is a type with 1 more bit than the input type.
1215pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1) {
1215pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) @Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1) {
12161216 comptime assert(@typeInfo(T) == .int);
12171217 comptime assert(@typeInfo(T).int.signedness == .unsigned);
12181218 assert(value != 0);
......@@ -1497,11 +1497,11 @@ test "max value type" {
14971497
14981498/// Multiply a and b. Return type is wide enough to guarantee no
14991499/// overflow.
1500pub fn mulWide(comptime T: type, a: T, b: T) std.meta.Int(
1500pub fn mulWide(comptime T: type, a: T, b: T) @Int(
15011501 @typeInfo(T).int.signedness,
15021502 @typeInfo(T).int.bits * 2,
15031503) {
1504 const ResultInt = std.meta.Int(
1504 const ResultInt = @Int(
15051505 @typeInfo(T).int.signedness,
15061506 @typeInfo(T).int.bits * 2,
15071507 );
lib/std/math/big.zig+4-4
......@@ -4,10 +4,10 @@ const assert = std.debug.assert;
44pub const int = @import("big/int.zig");
55pub const Limb = usize;
66const limb_info = @typeInfo(Limb).int;
7pub const SignedLimb = std.meta.Int(.signed, limb_info.bits);
8pub const DoubleLimb = std.meta.Int(.unsigned, 2 * limb_info.bits);
9pub const HalfLimb = std.meta.Int(.unsigned, limb_info.bits / 2);
10pub const SignedDoubleLimb = std.meta.Int(.signed, 2 * limb_info.bits);
7pub const SignedLimb = @Int(.signed, limb_info.bits);
8pub const DoubleLimb = @Int(.unsigned, 2 * limb_info.bits);
9pub const HalfLimb = @Int(.unsigned, limb_info.bits / 2);
10pub const SignedDoubleLimb = @Int(.signed, 2 * limb_info.bits);
1111pub const Log2Limb = std.math.Log2Int(Limb);
1212
1313comptime {
lib/std/math/big/int.zig+2-2
......@@ -2047,7 +2047,7 @@ pub const Mutable = struct {
20472047 var limb = switch (signedness) {
20482048 .unsigned => mem.readVarPackedInt(Limb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .unsigned),
20492049 .signed => b: {
2050 const SLimb = std.meta.Int(.signed, @bitSizeOf(Limb));
2050 const SLimb = @Int(.signed, @bitSizeOf(Limb));
20512051 const limb = mem.readVarPackedInt(SLimb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .signed);
20522052 break :b @as(Limb, @bitCast(limb));
20532053 },
......@@ -2284,7 +2284,7 @@ pub const Const = struct {
22842284 // Make sure -0 is handled correctly.
22852285 if (self.eqlZero()) return 0;
22862286
2287 const Unsigned = std.meta.Int(.unsigned, info.bits);
2287 const Unsigned = @Int(.unsigned, info.bits);
22882288
22892289 if (!self.fitsInTwosComp(info.signedness, info.bits)) {
22902290 return error.TargetTooSmall;
lib/std/math/big/int_test.zig+2-2
......@@ -2370,7 +2370,7 @@ test "truncate multi to single signed" {
23702370
23712371test "truncate multi to multi unsigned" {
23722372 const bits = @typeInfo(SignedDoubleLimb).int.bits;
2373 const Int = std.meta.Int(.unsigned, bits - 1);
2373 const Int = @Int(.unsigned, bits - 1);
23742374
23752375 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));
23762376 defer a.deinit();
......@@ -2386,7 +2386,7 @@ test "truncate multi to multi signed" {
23862386
23872387 try a.truncate(&a, .signed, @bitSizeOf(Limb) + 1);
23882388
2389 try testing.expectEqual(-1 << @bitSizeOf(Limb), try a.toInt(std.meta.Int(.signed, @bitSizeOf(Limb) + 1)));
2389 try testing.expectEqual(-1 << @bitSizeOf(Limb), try a.toInt(@Int(.signed, @bitSizeOf(Limb) + 1)));
23902390}
23912391
23922392test "truncate negative multi to single" {
lib/std/math/copysign.zig+1-1
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns a value with the magnitude of `magnitude` and the sign of `sign`.
66pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) {
77 const T = @TypeOf(magnitude);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
8 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
99 const sign_bit_mask = @as(TBits, 1) << (@bitSizeOf(T) - 1);
1010 const mag = @as(TBits, @bitCast(magnitude)) & ~sign_bit_mask;
1111 const sgn = @as(TBits, @bitCast(sign)) & sign_bit_mask;
lib/std/math/frexp.zig+4-4
......@@ -22,16 +22,16 @@ pub fn frexp(x: anytype) Frexp(@TypeOf(x)) {
2222 const T: type = @TypeOf(x);
2323
2424 const bits: comptime_int = @typeInfo(T).float.bits;
25 const Int: type = std.meta.Int(.unsigned, bits);
25 const Int: type = @Int(.unsigned, bits);
2626
2727 const exp_bits: comptime_int = math.floatExponentBits(T);
2828 const mant_bits: comptime_int = math.floatMantissaBits(T);
2929 const frac_bits: comptime_int = math.floatFractionalBits(T);
3030 const exp_min: comptime_int = math.floatExponentMin(T);
3131
32 const ExpInt: type = std.meta.Int(.unsigned, exp_bits);
33 const MantInt: type = std.meta.Int(.unsigned, mant_bits);
34 const FracInt: type = std.meta.Int(.unsigned, frac_bits);
32 const ExpInt: type = @Int(.unsigned, exp_bits);
33 const MantInt: type = @Int(.unsigned, mant_bits);
34 const FracInt: type = @Int(.unsigned, frac_bits);
3535
3636 const unreal_exponent: comptime_int = (1 << exp_bits) - 1;
3737 const bias: comptime_int = (1 << (exp_bits - 1)) - 2;
lib/std/math/ilogb.zig+1-1
......@@ -30,7 +30,7 @@ fn ilogbX(comptime T: type, x: T) i32 {
3030 const significandBits = math.floatMantissaBits(T);
3131 const exponentBits = math.floatExponentBits(T);
3232
33 const Z = std.meta.Int(.unsigned, typeWidth);
33 const Z = @Int(.unsigned, typeWidth);
3434
3535 const signBit = (@as(Z, 1) << (significandBits + exponentBits));
3636 const maxExponent = ((1 << exponentBits) - 1);
lib/std/math/isfinite.zig+1-1
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns whether x is a finite value.
66pub fn isFinite(x: anytype) bool {
77 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
8 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
99 const remove_sign = ~@as(TBits, 0) >> 1;
1010 return @as(TBits, @bitCast(x)) & remove_sign < @as(TBits, @bitCast(math.inf(T)));
1111}
lib/std/math/isinf.zig+1-1
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns whether x is an infinity, ignoring sign.
66pub inline fn isInf(x: anytype) bool {
77 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
8 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
99 const remove_sign = ~@as(TBits, 0) >> 1;
1010 return @as(TBits, @bitCast(x)) & remove_sign == @as(TBits, @bitCast(math.inf(T)));
1111}
lib/std/math/isnan.zig+1-2
......@@ -1,7 +1,6 @@
11const std = @import("../std.zig");
22const builtin = @import("builtin");
33const math = std.math;
4const meta = std.meta;
54const expect = std.testing.expect;
65
76pub fn isNan(x: anytype) bool {
......@@ -12,7 +11,7 @@ pub fn isNan(x: anytype) bool {
1211/// this is tracked by https://github.com/ziglang/zig/issues/14366
1312pub fn isSignalNan(x: anytype) bool {
1413 const T = @TypeOf(x);
15 const U = meta.Int(.unsigned, @bitSizeOf(T));
14 const U = @Int(.unsigned, @bitSizeOf(T));
1615 const quiet_signal_bit_mask = 1 << (math.floatFractionalBits(T) - 1);
1716 return isNan(x) and (@as(U, @bitCast(x)) & quiet_signal_bit_mask == 0);
1817}
lib/std/math/isnormal.zig+2-2
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns whether x is neither zero, subnormal, infinity, or NaN.
66pub fn isNormal(x: anytype) bool {
77 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
8 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
99
1010 const increment_exp = 1 << math.floatMantissaBits(T);
1111 const remove_sign = ~@as(TBits, 0) >> 1;
......@@ -22,7 +22,7 @@ pub fn isNormal(x: anytype) bool {
2222test isNormal {
2323 // TODO add `c_longdouble' when math.inf(T) supports it
2424 inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| {
25 const TBits = std.meta.Int(.unsigned, @bitSizeOf(T));
25 const TBits = @Int(.unsigned, @bitSizeOf(T));
2626
2727 // normals
2828 try expect(isNormal(@as(T, 1.0)));
lib/std/math/iszero.zig+2-2
......@@ -6,7 +6,7 @@ const expect = std.testing.expect;
66pub inline fn isPositiveZero(x: anytype) bool {
77 const T = @TypeOf(x);
88 const bit_count = @typeInfo(T).float.bits;
9 const TBits = std.meta.Int(.unsigned, bit_count);
9 const TBits = @Int(.unsigned, bit_count);
1010 return @as(TBits, @bitCast(x)) == @as(TBits, 0);
1111}
1212
......@@ -14,7 +14,7 @@ pub inline fn isPositiveZero(x: anytype) bool {
1414pub inline fn isNegativeZero(x: anytype) bool {
1515 const T = @TypeOf(x);
1616 const bit_count = @typeInfo(T).float.bits;
17 const TBits = std.meta.Int(.unsigned, bit_count);
17 const TBits = @Int(.unsigned, bit_count);
1818 return @as(TBits, @bitCast(x)) == @as(TBits, 1) << (bit_count - 1);
1919}
2020
lib/std/math/ldexp.zig+2-2
......@@ -7,7 +7,7 @@ const expect = std.testing.expect;
77/// Returns x * 2^n.
88pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
99 const T = @TypeOf(x);
10 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
10 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
1111
1212 const exponent_bits = math.floatExponentBits(T);
1313 const mantissa_bits = math.floatMantissaBits(T);
......@@ -103,7 +103,7 @@ test ldexp {
103103
104104 // Multiplications might flush the denormals to zero, esp. at
105105 // runtime, so we manually construct the constants here instead.
106 const Z = std.meta.Int(.unsigned, @bitSizeOf(T));
106 const Z = @Int(.unsigned, @bitSizeOf(T));
107107 const EightTimesTrueMin = @as(T, @bitCast(@as(Z, 8)));
108108 const TwoTimesTrueMin = @as(T, @bitCast(@as(Z, 2)));
109109
lib/std/math/nextafter.zig+2-2
......@@ -90,7 +90,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {
9090
9191 return x_parts.toFloat();
9292 } else {
93 const Bits = std.meta.Int(.unsigned, @bitSizeOf(T));
93 const Bits = @Int(.unsigned, @bitSizeOf(T));
9494 var x_bits: Bits = @bitCast(x);
9595 if ((x > 0.0) == (y > x)) {
9696 x_bits += 1;
......@@ -320,6 +320,6 @@ test "float" {
320320/// Helps ensure that 0.0 doesn't compare equal to -0.0.
321321fn bitwiseEqual(comptime T: type, x: T, y: T) bool {
322322 comptime assert(@typeInfo(T) == .float);
323 const Bits = std.meta.Int(.unsigned, @bitSizeOf(T));
323 const Bits = @Int(.unsigned, @bitSizeOf(T));
324324 return @as(Bits, @bitCast(x)) == @as(Bits, @bitCast(y));
325325}
lib/std/math/pow.zig+1-1
......@@ -147,7 +147,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
147147 var xe = r2.exponent;
148148 var x1 = r2.significand;
149149
150 var i = @as(std.meta.Int(.signed, @typeInfo(T).float.bits), @intFromFloat(yi));
150 var i = @as(@Int(.signed, @typeInfo(T).float.bits), @intFromFloat(yi));
151151 while (i != 0) : (i >>= 1) {
152152 const overflow_shift = math.floatExponentBits(T) + 1;
153153 if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) {
lib/std/mem.zig+20-20
......@@ -1777,7 +1777,7 @@ pub fn readVarInt(comptime ReturnType: type, bytes: []const u8, endian: Endian)
17771777 assert(@typeInfo(ReturnType).int.bits >= bytes.len * 8);
17781778 const bits = @typeInfo(ReturnType).int.bits;
17791779 const signedness = @typeInfo(ReturnType).int.signedness;
1780 const WorkType = std.meta.Int(signedness, @max(16, bits));
1780 const WorkType = @Int(signedness, @max(16, bits));
17811781 var result: WorkType = 0;
17821782 switch (endian) {
17831783 .big => {
......@@ -1828,8 +1828,8 @@ pub fn readVarPackedInt(
18281828 endian: std.builtin.Endian,
18291829 signedness: std.builtin.Signedness,
18301830) T {
1831 const uN = std.meta.Int(.unsigned, @bitSizeOf(T));
1832 const iN = std.meta.Int(.signed, @bitSizeOf(T));
1831 const uN = @Int(.unsigned, @bitSizeOf(T));
1832 const iN = @Int(.signed, @bitSizeOf(T));
18331833 const Log2N = std.math.Log2Int(T);
18341834
18351835 const read_size = (bit_count + (bit_offset % 8) + 7) / 8;
......@@ -1921,7 +1921,7 @@ test readInt {
19211921}
19221922
19231923fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T {
1924 const uN = std.meta.Int(.unsigned, @bitSizeOf(T));
1924 const uN = @Int(.unsigned, @bitSizeOf(T));
19251925 const Log2N = std.math.Log2Int(T);
19261926
19271927 const bit_count = @as(usize, @bitSizeOf(T));
......@@ -1929,7 +1929,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T
19291929
19301930 const load_size = (bit_count + 7) / 8;
19311931 const load_tail_bits = @as(u3, @intCast((load_size * 8) - bit_count));
1932 const LoadInt = std.meta.Int(.unsigned, load_size * 8);
1932 const LoadInt = @Int(.unsigned, load_size * 8);
19331933
19341934 if (bit_count == 0)
19351935 return 0;
......@@ -1947,7 +1947,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T
19471947}
19481948
19491949fn readPackedIntBig(comptime T: type, bytes: []const u8, bit_offset: usize) T {
1950 const uN = std.meta.Int(.unsigned, @bitSizeOf(T));
1950 const uN = @Int(.unsigned, @bitSizeOf(T));
19511951 const Log2N = std.math.Log2Int(T);
19521952
19531953 const bit_count = @as(usize, @bitSizeOf(T));
......@@ -1956,7 +1956,7 @@ fn readPackedIntBig(comptime T: type, bytes: []const u8, bit_offset: usize) T {
19561956
19571957 const load_size = (bit_count + 7) / 8;
19581958 const load_tail_bits = @as(u3, @intCast((load_size * 8) - bit_count));
1959 const LoadInt = std.meta.Int(.unsigned, load_size * 8);
1959 const LoadInt = @Int(.unsigned, load_size * 8);
19601960
19611961 if (bit_count == 0)
19621962 return 0;
......@@ -2061,7 +2061,7 @@ test writeInt {
20612061}
20622062
20632063fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {
2064 const uN = std.meta.Int(.unsigned, @bitSizeOf(T));
2064 const uN = @Int(.unsigned, @bitSizeOf(T));
20652065 const Log2N = std.math.Log2Int(T);
20662066
20672067 const bit_count = @as(usize, @bitSizeOf(T));
......@@ -2069,7 +2069,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value:
20692069
20702070 const store_size = (@bitSizeOf(T) + 7) / 8;
20712071 const store_tail_bits = @as(u3, @intCast((store_size * 8) - bit_count));
2072 const StoreInt = std.meta.Int(.unsigned, store_size * 8);
2072 const StoreInt = @Int(.unsigned, store_size * 8);
20732073
20742074 if (bit_count == 0)
20752075 return;
......@@ -2094,7 +2094,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value:
20942094}
20952095
20962096fn writePackedIntBig(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {
2097 const uN = std.meta.Int(.unsigned, @bitSizeOf(T));
2097 const uN = @Int(.unsigned, @bitSizeOf(T));
20982098 const Log2N = std.math.Log2Int(T);
20992099
21002100 const bit_count = @as(usize, @bitSizeOf(T));
......@@ -2103,7 +2103,7 @@ fn writePackedIntBig(comptime T: type, bytes: []u8, bit_offset: usize, value: T)
21032103
21042104 const store_size = (@bitSizeOf(T) + 7) / 8;
21052105 const store_tail_bits = @as(u3, @intCast((store_size * 8) - bit_count));
2106 const StoreInt = std.meta.Int(.unsigned, store_size * 8);
2106 const StoreInt = @Int(.unsigned, store_size * 8);
21072107
21082108 if (bit_count == 0)
21092109 return;
......@@ -2160,7 +2160,7 @@ test writePackedInt {
21602160/// If negative, the written value is sign-extended.
21612161pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value: anytype, endian: std.builtin.Endian) void {
21622162 const T = @TypeOf(value);
2163 const uN = std.meta.Int(.unsigned, @bitSizeOf(T));
2163 const uN = @Int(.unsigned, @bitSizeOf(T));
21642164
21652165 const bit_shift = @as(u3, @intCast(bit_offset % 8));
21662166 const write_size = (bit_count + bit_shift + 7) / 8;
......@@ -2242,7 +2242,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a
22422242 },
22432243 .bool => {},
22442244 .float => |float_info| {
2245 @field(ptr, f.name) = @bitCast(@byteSwap(@as(std.meta.Int(.unsigned, float_info.bits), @bitCast(@field(ptr, f.name)))));
2245 @field(ptr, f.name) = @bitCast(@byteSwap(@as(@Int(.unsigned, float_info.bits), @bitCast(@field(ptr, f.name)))));
22462246 },
22472247 else => {
22482248 @field(ptr, f.name) = @byteSwap(@field(ptr, f.name));
......@@ -2262,7 +2262,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a
22622262 }
22632263 }
22642264
2265 const BackingInt = std.meta.Int(.unsigned, @bitSizeOf(S));
2265 const BackingInt = @Int(.unsigned, @bitSizeOf(S));
22662266 ptr.* = @bitCast(@byteSwap(@as(BackingInt, @bitCast(ptr.*))));
22672267 },
22682268 .array => |info| {
......@@ -2370,7 +2370,7 @@ pub fn byteSwapAllElements(comptime Elem: type, slice: []Elem) void {
23702370 },
23712371 .bool => {},
23722372 .float => |float_info| {
2373 elem.* = @bitCast(@byteSwap(@as(std.meta.Int(.unsigned, float_info.bits), @bitCast(elem.*))));
2373 elem.* = @bitCast(@byteSwap(@as(@Int(.unsigned, float_info.bits), @bitCast(elem.*))));
23742374 },
23752375 else => {
23762376 elem.* = @byteSwap(elem.*);
......@@ -4800,7 +4800,7 @@ pub fn doNotOptimizeAway(val: anytype) void {
48004800 const bits = t.int.bits;
48014801 if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) {
48024802 const val2 = @as(
4803 std.meta.Int(t.int.signedness, @max(8, std.math.ceilPowerOfTwoAssert(u16, bits))),
4803 @Int(t.int.signedness, @max(8, std.math.ceilPowerOfTwoAssert(u16, bits))),
48044804 val,
48054805 );
48064806 asm volatile (""
......@@ -5035,8 +5035,8 @@ test "read/write(Var)PackedInt" {
50355035 if (@bitSizeOf(PackedType) > @bitSizeOf(BackingType))
50365036 continue;
50375037
5038 const iPackedType = std.meta.Int(.signed, @bitSizeOf(PackedType));
5039 const uPackedType = std.meta.Int(.unsigned, @bitSizeOf(PackedType));
5038 const iPackedType = @Int(.signed, @bitSizeOf(PackedType));
5039 const uPackedType = @Int(.unsigned, @bitSizeOf(PackedType));
50405040 const Log2T = std.math.Log2Int(BackingType);
50415041
50425042 const offset_at_end = @bitSizeOf(BackingType) - @bitSizeOf(PackedType);
......@@ -5103,8 +5103,8 @@ test "read/write(Var)PackedInt" {
51035103 }
51045104
51055105 const signedness = @typeInfo(PackedType).int.signedness;
5106 const NextPowerOfTwoInt = std.meta.Int(signedness, try comptime std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType)));
5107 const ui64 = std.meta.Int(signedness, 64);
5106 const NextPowerOfTwoInt = @Int(signedness, try std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType)));
5107 const ui64 = @Int(signedness, 64);
51085108 inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| {
51095109 { // Variable-size Read/Write (Native-endian)
51105110
lib/std/meta.zig-5
......@@ -751,11 +751,6 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int {
751751 return null;
752752}
753753
754/// Deprecated: use @Int
755pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type {
756 return @Int(signedness, bit_count);
757}
758
759754pub fn Float(comptime bit_count: u8) type {
760755 return switch (bit_count) {
761756 16 => f16,
lib/std/meta/trailer_flags.zig+1-1
......@@ -13,7 +13,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
1313 return struct {
1414 bits: Int,
1515
16 pub const Int = meta.Int(.unsigned, bit_count);
16 pub const Int = @Int(.unsigned, bit_count);
1717 pub const bit_count = @typeInfo(Fields).@"struct".fields.len;
1818
1919 pub const FieldEnum = std.meta.FieldEnum(Fields);
lib/std/os/emscripten.zig+1-1
......@@ -17,7 +17,7 @@ pub const CLOCK = linux.CLOCK;
1717
1818pub const CPU_SETSIZE = 128;
1919pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize;
20pub const cpu_count_t = std.meta.Int(.unsigned, std.math.log2(CPU_SETSIZE * 8));
20pub const cpu_count_t = @Int(.unsigned, std.math.log2(CPU_SETSIZE * 8));
2121
2222pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {
2323 var sum: cpu_count_t = 0;
lib/std/os/linux.zig+1-1
......@@ -6291,7 +6291,7 @@ pub const dl_phdr_info = extern struct {
62916291
62926292pub const CPU_SETSIZE = 128;
62936293pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize;
6294pub const cpu_count_t = std.meta.Int(.unsigned, std.math.log2(CPU_SETSIZE * 8));
6294pub const cpu_count_t = @Int(.unsigned, std.math.log2(CPU_SETSIZE * 8));
62956295
62966296pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {
62976297 var sum: cpu_count_t = 0;
lib/std/os/linux/ioctl.zig+2-2
......@@ -15,12 +15,12 @@ const bits = switch (@import("builtin").cpu.arch) {
1515 else => .{ .size = 14, .dir = 2, .none = 0, .read = 2, .write = 1 },
1616};
1717
18const Direction = std.meta.Int(.unsigned, bits.dir);
18const Direction = @Int(.unsigned, bits.dir);
1919
2020pub const Request = packed struct {
2121 nr: u8,
2222 io_type: u8,
23 size: std.meta.Int(.unsigned, bits.size),
23 size: @Int(.unsigned, bits.size),
2424 dir: Direction,
2525};
2626
lib/std/os/uefi/tables/runtime_services.zig+1-1
......@@ -419,7 +419,7 @@ pub const RuntimeServices = extern struct {
419419 pub const DebugDisposition = enum(usize) {
420420 const Bits = packed struct(usize) {
421421 optional_ptr: bool = false,
422 _pad: std.meta.Int(.unsigned, @bitSizeOf(usize) - 1) = 0,
422 _pad: @Int(.unsigned, @bitSizeOf(usize) - 1) = 0,
423423 };
424424
425425 pointer = @bitCast(Bits{}),
lib/std/posix.zig+1-1
......@@ -803,7 +803,7 @@ pub fn dl_iterate_phdr(
803803 }
804804 }.callbackC, @ptrCast(@constCast(&context)))) {
805805 0 => return,
806 else => |err| return @as(Error, @errorCast(@errorFromInt(@as(std.meta.Int(.unsigned, @bitSizeOf(anyerror)), @intCast(err))))),
806 else => |err| return @as(Error, @errorCast(@errorFromInt(@as(@Int(.unsigned, @bitSizeOf(anyerror)), @intCast(err))))),
807807 }
808808 }
809809
lib/std/testing.zig+1-1
......@@ -163,7 +163,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
163163 }
164164 }
165165
166 const BackingInt = std.meta.Int(.unsigned, @bitSizeOf(T));
166 const BackingInt = @Int(.unsigned, @bitSizeOf(T));
167167 return expectEqual(
168168 @as(BackingInt, @bitCast(expected)),
169169 @as(BackingInt, @bitCast(actual)),
lib/std/zig/llvm/Builder.zig+3-3
......@@ -7657,9 +7657,9 @@ pub const Constant = enum(u32) {
76577657 .float => {
76587658 const Float = struct {
76597659 fn Repr(comptime T: type) type {
7660 return packed struct(std.meta.Int(.unsigned, @bitSizeOf(T))) {
7661 mantissa: std.meta.Int(.unsigned, std.math.floatMantissaBits(T)),
7662 exponent: std.meta.Int(.unsigned, std.math.floatExponentBits(T)),
7660 return packed struct(@Int(.unsigned, @bitSizeOf(T))) {
7661 mantissa: @Int(.unsigned, std.math.floatMantissaBits(T)),
7662 exponent: @Int(.unsigned, std.math.floatExponentBits(T)),
76637663 sign: u1,
76647664 };
76657665 }
lib/std/zig/llvm/bitcode_writer.zig+3-3
......@@ -404,7 +404,7 @@ fn charTo6Bit(c: u8) u8 {
404404}
405405
406406fn BufType(comptime T: type, comptime min_len: usize) type {
407 return std.meta.Int(.unsigned, @max(min_len, @bitSizeOf(switch (@typeInfo(T)) {
407 return @Int(.unsigned, @max(min_len, @bitSizeOf(switch (@typeInfo(T)) {
408408 .comptime_int => u32,
409409 .int => |info| if (info.signedness == .unsigned)
410410 T
......@@ -414,7 +414,7 @@ fn BufType(comptime T: type, comptime min_len: usize) type {
414414 .bool => u1,
415415 .@"struct" => |info| switch (info.layout) {
416416 .auto, .@"extern" => @compileError("Unsupported type: " ++ @typeName(T)),
417 .@"packed" => std.meta.Int(.unsigned, @bitSizeOf(T)),
417 .@"packed" => @Int(.unsigned, @bitSizeOf(T)),
418418 },
419419 else => @compileError("Unsupported type: " ++ @typeName(T)),
420420 })));
......@@ -425,7 +425,7 @@ fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min
425425 .comptime_int, .int => @intCast(value),
426426 .@"enum" => @intFromEnum(value),
427427 .bool => @intFromBool(value),
428 .@"struct" => @intCast(@as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))),
428 .@"struct" => @intCast(@as(@Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))),
429429 else => unreachable,
430430 };
431431}
lib/std/zig/llvm/ir.zig+8-8
......@@ -235,7 +235,7 @@ pub const ModuleBlock = struct {
235235 is_const: AddrSpaceAndIsConst,
236236 initid: u32,
237237 linkage: Builder.Linkage,
238 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),
238 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
239239 section: usize,
240240 visibility: Builder.Visibility,
241241 thread_local: Builder.ThreadLocal,
......@@ -275,7 +275,7 @@ pub const ModuleBlock = struct {
275275 is_proto: bool,
276276 linkage: Builder.Linkage,
277277 paramattr: usize,
278 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),
278 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
279279 section: usize,
280280 visibility: Builder.Visibility,
281281 unnamed_addr: Builder.UnnamedAddr,
......@@ -1214,7 +1214,7 @@ pub const ModuleBlock = struct {
12141214 };
12151215 ptr: u32,
12161216 ty: Builder.Type,
1217 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1217 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
12181218 is_volatile: bool,
12191219 };
12201220
......@@ -1230,7 +1230,7 @@ pub const ModuleBlock = struct {
12301230 };
12311231 ptr: u32,
12321232 ty: Builder.Type,
1233 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1233 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
12341234 is_volatile: bool,
12351235 success_ordering: Builder.AtomicOrdering,
12361236 sync_scope: Builder.SyncScope,
......@@ -1246,7 +1246,7 @@ pub const ModuleBlock = struct {
12461246 };
12471247 ptr: u32,
12481248 val: u32,
1249 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1249 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
12501250 is_volatile: bool,
12511251 };
12521252
......@@ -1262,7 +1262,7 @@ pub const ModuleBlock = struct {
12621262 };
12631263 ptr: u32,
12641264 val: u32,
1265 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1265 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
12661266 is_volatile: bool,
12671267 success_ordering: Builder.AtomicOrdering,
12681268 sync_scope: Builder.SyncScope,
......@@ -1317,7 +1317,7 @@ pub const ModuleBlock = struct {
13171317 is_volatile: bool,
13181318 success_ordering: Builder.AtomicOrdering,
13191319 sync_scope: Builder.SyncScope,
1320 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1320 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
13211321 };
13221322
13231323 pub const CmpXchg = struct {
......@@ -1341,7 +1341,7 @@ pub const ModuleBlock = struct {
13411341 sync_scope: Builder.SyncScope,
13421342 failure_ordering: Builder.AtomicOrdering,
13431343 is_weak: bool,
1344 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1344 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
13451345 };
13461346
13471347 pub const Fence = struct {
src/Air/Liveness.zig+1-1
......@@ -301,7 +301,7 @@ pub fn iterateBigTomb(l: Liveness, inst: Air.Inst.Index) BigTomb {
301301
302302/// How many tomb bits per AIR instruction.
303303pub const bpi = 4;
304pub const Bpi = std.meta.Int(.unsigned, bpi);
304pub const Bpi = @Int(.unsigned, bpi);
305305pub const OperandInt = std.math.Log2Int(Bpi);
306306
307307/// Useful for decoders of Liveness information.
src/InternPool.zig+2-2
......@@ -2660,7 +2660,7 @@ pub const Key = union(enum) {
26602660 switch (float.storage) {
26612661 inline else => |val| std.hash.autoHash(
26622662 &hasher,
2663 @as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(val))), @bitCast(val)),
2663 @as(@Int(.unsigned, @bitSizeOf(@TypeOf(val))), @bitCast(val)),
26642664 ),
26652665 }
26662666 return hasher.final();
......@@ -3012,7 +3012,7 @@ pub const Key = union(enum) {
30123012
30133013 switch (a_info.storage) {
30143014 inline else => |val, tag| {
3015 const Bits = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(val)));
3015 const Bits = @Int(.unsigned, @bitSizeOf(@TypeOf(val)));
30163016 const a_bits: Bits = @bitCast(val);
30173017 const b_bits: Bits = @bitCast(@field(b_info.storage, @tagName(tag)));
30183018 return a_bits == b_bits;
src/codegen/c.zig+1-1
......@@ -7221,7 +7221,7 @@ fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Alt(FormatStringCont
72217221
72227222fn undefPattern(comptime IntType: type) IntType {
72237223 const int_info = @typeInfo(IntType).int;
7224 const UnsignedType = std.meta.Int(.unsigned, int_info.bits);
7224 const UnsignedType = @Int(.unsigned, int_info.bits);
72257225 return @bitCast(@as(UnsignedType, (1 << (int_info.bits | 1)) / 3));
72267226}
72277227
src/codegen/riscv64/bits.zig+1-1
......@@ -118,7 +118,7 @@ pub const Immediate = union(enum) {
118118 const int_info = @typeInfo(T).int;
119119 if (int_info.signedness != .unsigned) @compileError("Immediate.asBits needs unsigned T");
120120 return switch (imm) {
121 .signed => |x| @bitCast(@as(std.meta.Int(.signed, int_info.bits), @intCast(x))),
121 .signed => |x| @bitCast(@as(@Int(.signed, int_info.bits), @intCast(x))),
122122 .unsigned => |x| @intCast(x),
123123 };
124124 }
src/codegen/spirv/Assembler.zig+1-1
......@@ -821,7 +821,7 @@ fn parseContextDependentFloat(ass: *Assembler, comptime width: u16) !void {
821821 const gpa = ass.cg.module.gpa;
822822
823823 const Float = std.meta.Float(width);
824 const Int = std.meta.Int(.unsigned, width);
824 const Int = @Int(.unsigned, width);
825825
826826 const tok = ass.currentToken();
827827 try ass.expectToken(.value);
src/codegen/spirv/Section.zig+1-1
......@@ -8,7 +8,7 @@ const testing = std.testing;
88
99const spec = @import("spec.zig");
1010const Word = spec.Word;
11const DoubleWord = std.meta.Int(.unsigned, @bitSizeOf(Word) * 2);
11const DoubleWord = @Int(.unsigned, @bitSizeOf(Word) * 2);
1212const Log2Word = std.math.Log2Int(Word);
1313
1414const Opcode = spec.Opcode;
test/behavior/abs.zig+1-1
......@@ -155,7 +155,7 @@ test "@abs big int <= 128 bits" {
155155 try testAbsUnsignedBigInt();
156156}
157157
158fn abs(comptime T: type, a: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) {
158fn abs(comptime T: type, a: T) @Int(.unsigned, @typeInfo(T).int.bits) {
159159 return @abs(a);
160160}
161161
test/behavior/atomics.zig+3-3
......@@ -232,7 +232,7 @@ fn testAtomicRmwInts() !void {
232232}
233233
234234fn testAtomicRmwInt(comptime signedness: std.builtin.Signedness, comptime N: usize) !void {
235 const int = std.meta.Int(signedness, N);
235 const int = @Int(signedness, N);
236236
237237 var x: int = 1;
238238 var res = @atomicRmw(int, &x, .Xchg, 3, .seq_cst);
......@@ -293,8 +293,8 @@ test "atomicrmw with 128-bit ints" {
293293}
294294
295295fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void {
296 const uint = std.meta.Int(.unsigned, 128);
297 const int = std.meta.Int(signedness, 128);
296 const uint = @Int(.unsigned, 128);
297 const int = @Int(signedness, 128);
298298
299299 const initial: int = @as(int, @bitCast(@as(uint, 0xaaaaaaaa_bbbbbbbb_cccccccc_dddddddd)));
300300 const replacement: int = 0x00000000_00000005_00000000_00000003;
test/behavior/bit_shifting.zig+2-2
......@@ -5,10 +5,10 @@ const builtin = @import("builtin");
55
66fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type {
77 const key_bits = @typeInfo(Key).int.bits;
8 std.debug.assert(Key == std.meta.Int(.unsigned, key_bits));
8 std.debug.assert(Key == @Int(.unsigned, key_bits));
99 std.debug.assert(key_bits >= mask_bit_count);
1010 const shard_key_bits = mask_bit_count;
11 const ShardKey = std.meta.Int(.unsigned, mask_bit_count);
11 const ShardKey = @Int(.unsigned, mask_bit_count);
1212 const shift_amount = key_bits - shard_key_bits;
1313 return struct {
1414 const Self = @This();
test/behavior/bitcast.zig+7-7
......@@ -49,8 +49,8 @@ test "@bitCast iX -> uX exotic integers" {
4949}
5050
5151fn testBitCast(comptime N: usize) !void {
52 const iN = std.meta.Int(.signed, N);
53 const uN = std.meta.Int(.unsigned, N);
52 const iN = @Int(.signed, N);
53 const uN = @Int(.unsigned, N);
5454
5555 try expect(conv_iN(N, -1) == maxInt(uN));
5656 try expect(conv_uN(N, maxInt(uN)) == -1);
......@@ -69,12 +69,12 @@ fn testBitCast(comptime N: usize) !void {
6969 }
7070}
7171
72fn conv_iN(comptime N: usize, x: std.meta.Int(.signed, N)) std.meta.Int(.unsigned, N) {
73 return @as(std.meta.Int(.unsigned, N), @bitCast(x));
72fn conv_iN(comptime N: usize, x: @Int(.signed, N)) @Int(.unsigned, N) {
73 return @as(@Int(.unsigned, N), @bitCast(x));
7474}
7575
76fn conv_uN(comptime N: usize, x: std.meta.Int(.unsigned, N)) std.meta.Int(.signed, N) {
77 return @as(std.meta.Int(.signed, N), @bitCast(x));
76fn conv_uN(comptime N: usize, x: @Int(.unsigned, N)) @Int(.signed, N) {
77 return @as(@Int(.signed, N), @bitCast(x));
7878}
7979
8080test "bitcast uX to bytes" {
......@@ -101,7 +101,7 @@ fn testBitCastuXToBytes(comptime N: usize) !void {
101101 // on the platforms we target. If the above behavior is restricted after all,
102102 // this test should be deleted.
103103
104 const T = std.meta.Int(.unsigned, N);
104 const T = @Int(.unsigned, N);
105105 for ([_]T{ 0, ~@as(T, 0) }) |init_value| {
106106 var x: T = init_value;
107107 const bytes = std.mem.asBytes(&x);
test/behavior/math.zig+1-1
......@@ -2359,7 +2359,7 @@ test "signed zeros are represented properly" {
23592359 }
23602360
23612361 fn testOne(comptime T: type) !void {
2362 const ST = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
2362 const ST = @Int(.unsigned, @typeInfo(T).float.bits);
23632363 var as_fp_val = -@as(T, 0.0);
23642364 _ = &as_fp_val;
23652365 const as_uint_val: ST = @bitCast(as_fp_val);