authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-06 19:35:40+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-06 19:35:40+02:00
logcd23f7a814bf81b3c06f4d016bcb006520a3158e
tree5cbff0f206ee77e8bbbde9a46071ea860c655ced
parent3d56df1716601440f580df3eee7e12bea44d919b
parentbf953c4d6af5225d27cdfade564814a92321befb

Merge pull request 'std.meta: Remove Int/Tuple in favor of @Int/@Tuple' (#35188) from linus/zig:deprecated-std-meta into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35188 Reviewed-by: Andrew Kelley <andrew@ziglang.org>

81 files changed, 209 insertions(+), 245 deletions(-)

lib/compiler/resinator/errors.zig+7-7
...@@ -43,7 +43,7 @@ pub const Diagnostics = struct {...@@ -43,7 +43,7 @@ pub const Diagnostics = struct {
43 try self.errors.append(self.allocator, error_details);43 try self.errors.append(self.allocator, error_details);
44 }44 }
4545
46 const SmallestStringIndexType = std.meta.Int(.unsigned, @min(46 const SmallestStringIndexType = @Int(.unsigned, @min(
47 @bitSizeOf(ErrorDetails.FileOpenError.FilenameStringIndex),47 @bitSizeOf(ErrorDetails.FileOpenError.FilenameStringIndex),
48 @min(48 @min(
49 @bitSizeOf(ErrorDetails.IconReadError.FilenameStringIndex),49 @bitSizeOf(ErrorDetails.IconReadError.FilenameStringIndex),
...@@ -165,7 +165,7 @@ pub const ErrorDetails = struct {...@@ -165,7 +165,7 @@ pub const ErrorDetails = struct {
165 err: FileOpenErrorEnum,165 err: FileOpenErrorEnum,
166 filename_string_index: FilenameStringIndex,166 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));
169 pub const FileOpenErrorEnum = std.meta.FieldEnum(Io.File.OpenError || Io.File.StatError);169 pub const FileOpenErrorEnum = std.meta.FieldEnum(Io.File.OpenError || Io.File.StatError);
170170
171 pub fn enumFromError(err: (Io.File.OpenError || Io.File.StatError)) FileOpenErrorEnum {171 pub fn enumFromError(err: (Io.File.OpenError || Io.File.StatError)) FileOpenErrorEnum {
...@@ -180,7 +180,7 @@ pub const ErrorDetails = struct {...@@ -180,7 +180,7 @@ pub const ErrorDetails = struct {
180 icon_type: enum(u1) { cursor, icon },180 icon_type: enum(u1) { cursor, icon },
181 filename_string_index: FilenameStringIndex,181 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);
184 pub const IconReadErrorEnum = std.meta.FieldEnum(ico.ReadError);184 pub const IconReadErrorEnum = std.meta.FieldEnum(ico.ReadError);
185185
186 pub fn enumFromError(err: ico.ReadError) IconReadErrorEnum {186 pub fn enumFromError(err: ico.ReadError) IconReadErrorEnum {
...@@ -197,14 +197,14 @@ pub const ErrorDetails = struct {...@@ -197,14 +197,14 @@ pub const ErrorDetails = struct {
197 bitmap_version: ico.BitmapHeader.Version = .unknown,197 bitmap_version: ico.BitmapHeader.Version = .unknown,
198 _: Padding = 0,198 _: 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));
201 };201 };
202202
203 pub const BitmapReadError = packed struct(u32) {203 pub const BitmapReadError = packed struct(u32) {
204 err: BitmapReadErrorEnum,204 err: BitmapReadErrorEnum,
205 filename_string_index: FilenameStringIndex,205 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));
208 pub const BitmapReadErrorEnum = std.meta.FieldEnum(bmp.ReadError);208 pub const BitmapReadErrorEnum = std.meta.FieldEnum(bmp.ReadError);
209209
210 pub fn enumFromError(err: bmp.ReadError) BitmapReadErrorEnum {210 pub fn enumFromError(err: bmp.ReadError) BitmapReadErrorEnum {
...@@ -218,14 +218,14 @@ pub const ErrorDetails = struct {...@@ -218,14 +218,14 @@ pub const ErrorDetails = struct {
218 dib_version: ico.BitmapHeader.Version,218 dib_version: ico.BitmapHeader.Version,
219 filename_string_index: FilenameStringIndex,219 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));
222 };222 };
223223
224 pub const AcceleratorError = packed struct(u32) {224 pub const AcceleratorError = packed struct(u32) {
225 err: AcceleratorErrorEnum,225 err: AcceleratorErrorEnum,
226 _: Padding = 0,226 _: Padding = 0,
227227
228 pub const Padding = std.meta.Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum));228 pub const Padding = @Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum));
229 pub const AcceleratorErrorEnum = std.meta.FieldEnum(res.ParseAcceleratorKeyStringError);229 pub const AcceleratorErrorEnum = std.meta.FieldEnum(res.ParseAcceleratorKeyStringError);
230230
231 pub fn enumFromError(err: res.ParseAcceleratorKeyStringError) AcceleratorErrorEnum {231 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 {...@@ -574,8 +574,8 @@ pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
574 }574 }
575}575}
576576
577pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 {577pub fn normalize(comptime T: type, significand: *@Int(.unsigned, @typeInfo(T).float.bits)) i32 {
578 const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);578 const Z = @Int(.unsigned, @typeInfo(T).float.bits);
579 const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);579 const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
580580
581 const shift = @clz(significand.*) - @clz(integerBit);581 const shift = @clz(significand.*) - @clz(integerBit);
...@@ -625,8 +625,8 @@ fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 {...@@ -625,8 +625,8 @@ fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
625pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {625pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
626 return extern union {626 return extern union {
627 pub const bits = @divExact(@typeInfo(T).int.bits, 2);627 pub const bits = @divExact(@typeInfo(T).int.bits, 2);
628 pub const HalfTU = std.meta.Int(.unsigned, bits);628 pub const HalfTU = @Int(.unsigned, bits);
629 pub const HalfTS = std.meta.Int(.signed, bits);629 pub const HalfTS = @Int(.signed, bits);
630 pub const HalfT = if (signed_half) HalfTS else HalfTU;630 pub const HalfT = if (signed_half) HalfTS else HalfTU;
631631
632 all: T,632 all: T,
lib/compiler_rt/addf3.zig+1-1
...@@ -8,7 +8,7 @@ const normalize = compiler_rt.normalize;...@@ -8,7 +8,7 @@ const normalize = compiler_rt.normalize;
8/// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/lib/builtins/fp_add_impl.inc8/// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/lib/builtins/fp_add_impl.inc
9pub inline fn addf3(comptime T: type, a: T, b: T) T {9pub inline fn addf3(comptime T: type, a: T, b: T) T {
10 const bits = @typeInfo(T).float.bits;10 const bits = @typeInfo(T).float.bits;
11 const Z = std.meta.Int(.unsigned, bits);11 const Z = @Int(.unsigned, bits);
1212
13 const typeWidth = bits;13 const typeWidth = bits;
14 const significandBits = math.floatMantissaBits(T);14 const significandBits = math.floatMantissaBits(T);
lib/compiler_rt/comparef.zig+3-3
...@@ -162,8 +162,8 @@ pub const GE = enum(i32) {...@@ -162,8 +162,8 @@ pub const GE = enum(i32) {
162162
163pub inline fn cmpf2(comptime T: type, comptime RT: type, a: T, b: T) RT {163pub inline fn cmpf2(comptime T: type, comptime RT: type, a: T, b: T) RT {
164 const bits = @typeInfo(T).float.bits;164 const bits = @typeInfo(T).float.bits;
165 const srep_t = std.meta.Int(.signed, bits);165 const srep_t = @Int(.signed, bits);
166 const rep_t = std.meta.Int(.unsigned, bits);166 const rep_t = @Int(.unsigned, bits);
167167
168 const significandBits = std.math.floatMantissaBits(T);168 const significandBits = std.math.floatMantissaBits(T);
169 const exponentBits = std.math.floatExponentBits(T);169 const exponentBits = std.math.floatExponentBits(T);
...@@ -253,7 +253,7 @@ test "cmp_f80" {...@@ -253,7 +253,7 @@ test "cmp_f80" {
253}253}
254254
255pub inline fn unordcmp(comptime T: type, a: T, b: T) i32 {255pub 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
258 const significandBits = std.math.floatMantissaBits(T);258 const significandBits = std.math.floatMantissaBits(T);
259 const exponentBits = std.math.floatExponentBits(T);259 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 {...@@ -198,7 +198,7 @@ pub fn __ctzti2(a: i128) callconv(.c) i32 {
198}198}
199199
200inline fn ffsXi2(comptime T: type, a: T) i32 {200inline 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);
202 var n: T = 1;202 var n: T = 1;
203 // adapted from Number of trailing zeroes (see ctzXi2)203 // adapted from Number of trailing zeroes (see ctzXi2)
204 var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));204 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 {...@@ -26,8 +26,8 @@ fn __aeabi_ddiv(a: f64, b: f64) callconv(.{ .arm_aapcs = .{} }) f64 {
26}26}
2727
28inline fn div(a: f64, b: f64) f64 {28inline fn div(a: f64, b: f64) f64 {
29 const Z = std.meta.Int(.unsigned, 64);29 const Z = @Int(.unsigned, 64);
30 const SignedZ = std.meta.Int(.signed, 64);30 const SignedZ = @Int(.signed, 64);
3131
32 const significandBits = std.math.floatMantissaBits(f64);32 const significandBits = std.math.floatMantissaBits(f64);
33 const exponentBits = std.math.floatExponentBits(f64);33 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 {...@@ -25,7 +25,7 @@ fn __aeabi_fdiv(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
25}25}
2626
27inline fn div(a: f32, b: f32) f32 {27inline fn div(a: f32, b: f32) f32 {
28 const Z = std.meta.Int(.unsigned, 32);28 const Z = @Int(.unsigned, 32);
2929
30 const significandBits = std.math.floatMantissaBits(f32);30 const significandBits = std.math.floatMantissaBits(f32);
31 const exponentBits = std.math.floatExponentBits(f32);31 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 {...@@ -24,7 +24,7 @@ fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.c) void {
24}24}
2525
26inline fn div(a: f128, b: f128) f128 {26inline fn div(a: f128, b: f128) f128 {
27 const Z = std.meta.Int(.unsigned, 128);27 const Z = @Int(.unsigned, 128);
2828
29 const significandBits = std.math.floatMantissaBits(f128);29 const significandBits = std.math.floatMantissaBits(f128);
30 const exponentBits = std.math.floatExponentBits(f128);30 const exponentBits = std.math.floatExponentBits(f128);
lib/compiler_rt/divxf3.zig+1-1
...@@ -13,7 +13,7 @@ comptime {...@@ -13,7 +13,7 @@ comptime {
1313
14pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 {14pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 {
15 const T = f80;15 const T = f80;
16 const Z = std.meta.Int(.unsigned, @bitSizeOf(T));16 const Z = @Int(.unsigned, @bitSizeOf(T));
1717
18 const significandBits = std.math.floatMantissaBits(T);18 const significandBits = std.math.floatMantissaBits(T);
19 const fractionalBits = std.math.floatFractionalBits(T);19 const fractionalBits = std.math.floatFractionalBits(T);
lib/compiler_rt/extendf.zig+5-5
...@@ -3,10 +3,10 @@ const std = @import("std");...@@ -3,10 +3,10 @@ const std = @import("std");
3pub inline fn extendf(3pub inline fn extendf(
4 comptime dst_t: type,4 comptime dst_t: type,
5 comptime src_t: type,5 comptime src_t: type,
6 a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits),6 a: @Int(.unsigned, @typeInfo(src_t).float.bits),
7) dst_t {7) dst_t {
8 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);8 const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
9 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);9 const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits);
10 const srcSigBits = std.math.floatMantissaBits(src_t);10 const srcSigBits = std.math.floatMantissaBits(src_t);
11 const dstSigBits = std.math.floatMantissaBits(dst_t);11 const dstSigBits = std.math.floatMantissaBits(dst_t);
1212
...@@ -70,8 +70,8 @@ pub inline fn extendf(...@@ -70,8 +70,8 @@ pub inline fn extendf(
70 return @bitCast(result);70 return @bitCast(result);
71}71}
7272
73pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits)) f80 {73pub inline fn extend_f80(comptime src_t: type, a: @Int(.unsigned, @typeInfo(src_t).float.bits)) f80 {
74 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);74 const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
75 const src_sig_bits = std.math.floatMantissaBits(src_t);75 const src_sig_bits = std.math.floatMantissaBits(src_t);
76 const dst_int_bit = 0x8000000000000000;76 const dst_int_bit = 0x8000000000000000;
77 const dst_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit77 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 {...@@ -47,7 +47,7 @@ pub fn fabsl(x: c_longdouble) callconv(.c) c_longdouble {
4747
48inline fn generic_fabs(x: anytype) @TypeOf(x) {48inline fn generic_fabs(x: anytype) @TypeOf(x) {
49 const T = @TypeOf(x);49 const T = @TypeOf(x);
50 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);50 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
51 const float_bits: TBits = @bitCast(x);51 const float_bits: TBits = @bitCast(x);
52 const remove_sign = ~@as(TBits, 0) >> 1;52 const remove_sign = ~@as(TBits, 0) >> 1;
53 return @bitCast(float_bits & remove_sign);53 return @bitCast(float_bits & remove_sign);
lib/compiler_rt/float_from_int.zig+3-4
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const Int = std.meta.Int;
3const math = std.math;2const math = std.math;
43
5pub fn floatFromInt(comptime T: type, x: anytype) T {4pub fn floatFromInt(comptime T: type, x: anytype) T {
...@@ -7,14 +6,14 @@ pub fn floatFromInt(comptime T: type, x: anytype) T {...@@ -7,14 +6,14 @@ pub fn floatFromInt(comptime T: type, x: anytype) T {
76
8 // Various constants whose values follow from the type parameters.7 // Various constants whose values follow from the type parameters.
9 // Any reasonable optimizer will fold and propagate all of these.8 // Any reasonable optimizer will fold and propagate all of these.
10 const Z = Int(.unsigned, @bitSizeOf(@TypeOf(x)));9 const Z = @Int(.unsigned, @bitSizeOf(@TypeOf(x)));
11 const uT = Int(.unsigned, @bitSizeOf(T));10 const uT = @Int(.unsigned, @bitSizeOf(T));
12 const inf = math.inf(T);11 const inf = math.inf(T);
13 const float_bits = @bitSizeOf(T);12 const float_bits = @bitSizeOf(T);
14 const int_bits = @bitSizeOf(@TypeOf(x));13 const int_bits = @bitSizeOf(@TypeOf(x));
15 const exp_bits = math.floatExponentBits(T);14 const exp_bits = math.floatExponentBits(T);
16 const fractional_bits = math.floatFractionalBits(T);15 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));
18 const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0;17 const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0;
19 const max_exp = exp_bias;18 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 {...@@ -59,7 +59,7 @@ inline fn generic_fmax(comptime T: type, x: T, y: T) T {
59test "generic_fmax" {59test "generic_fmax" {
60 inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| {60 inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| {
61 const nan_val = math.nan(T);61 const nan_val = math.nan(T);
62 const Int = std.meta.Int(.unsigned, @bitSizeOf(T));62 const Int = @Int(.unsigned, @bitSizeOf(T));
6363
64 try std.testing.expect(math.isNan(generic_fmax(T, nan_val, nan_val)));64 try std.testing.expect(math.isNan(generic_fmax(T, nan_val, nan_val)));
65 try std.testing.expectEqual(@as(T, 1.0), generic_fmax(T, nan_val, 1.0));65 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 {...@@ -59,7 +59,7 @@ inline fn generic_fmin(comptime T: type, x: T, y: T) T {
59test "generic_fmin" {59test "generic_fmin" {
60 inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| {60 inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| {
61 const nan_val = math.nan(T);61 const nan_val = math.nan(T);
62 const Int = std.meta.Int(.unsigned, @bitSizeOf(T));62 const Int = @Int(.unsigned, @bitSizeOf(T));
6363
64 try std.testing.expect(math.isNan(generic_fmin(T, nan_val, nan_val)));64 try std.testing.expect(math.isNan(generic_fmin(T, nan_val, nan_val)));
65 try std.testing.expectEqual(@as(T, 1.0), generic_fmin(T, nan_val, 1.0));65 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 {...@@ -36,7 +36,7 @@ pub fn fmod(x: f64, y: f64) callconv(.c) f64 {
36/// Logic and flow heavily inspired by MUSL fmodl for 113 mantissa digits36/// Logic and flow heavily inspired by MUSL fmodl for 113 mantissa digits
37pub fn __fmodx(a: f80, b: f80) callconv(.c) f80 {37pub fn __fmodx(a: f80, b: f80) callconv(.c) f80 {
38 const T = f80;38 const T = f80;
39 const Z = std.meta.Int(.unsigned, @bitSizeOf(T));39 const Z = @Int(.unsigned, @bitSizeOf(T));
4040
41 const significandBits = math.floatMantissaBits(T);41 const significandBits = math.floatMantissaBits(T);
42 const fractionalBits = math.floatFractionalBits(T);42 const fractionalBits = math.floatFractionalBits(T);
...@@ -260,7 +260,7 @@ pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.c) c_longdouble {...@@ -260,7 +260,7 @@ pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.c) c_longdouble {
260260
261inline fn generic_fmod(comptime T: type, x: T, y: T) T {261inline fn generic_fmod(comptime T: type, x: T, y: T) T {
262 const bits = @typeInfo(T).float.bits;262 const bits = @typeInfo(T).float.bits;
263 const uint = std.meta.Int(.unsigned, bits);263 const uint = @Int(.unsigned, bits);
264 comptime assert(T == f32 or T == f64);264 comptime assert(T == f32 or T == f64);
265 const digits = if (T == f32) 23 else 52;265 const digits = if (T == f32) 23 else 52;
266 const exp_bits = if (T == f32) 9 else 12;266 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 {...@@ -12,7 +12,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
12 const fractionalBits = math.floatFractionalBits(T);12 const fractionalBits = math.floatFractionalBits(T);
13 const exponentBits = math.floatExponentBits(T);13 const exponentBits = math.floatExponentBits(T);
1414
15 const Z = std.meta.Int(.unsigned, typeWidth);15 const Z = @Int(.unsigned, typeWidth);
1616
17 // ZSignificand is large enough to contain the significand, including an explicit integer bit17 // ZSignificand is large enough to contain the significand, including an explicit integer bit
18 const ZSignificand = PowerOfTwoSignificandZ(T);18 const ZSignificand = PowerOfTwoSignificandZ(T);
...@@ -195,7 +195,7 @@ fn normalize(comptime T: type, significand: *PowerOfTwoSignificandZ(T)) i32 {...@@ -195,7 +195,7 @@ fn normalize(comptime T: type, significand: *PowerOfTwoSignificandZ(T)) i32 {
195/// the significand of T, including an explicit integer bit195/// the significand of T, including an explicit integer bit
196fn PowerOfTwoSignificandZ(comptime T: type) type {196fn PowerOfTwoSignificandZ(comptime T: type) type {
197 const bits = math.ceilPowerOfTwoAssert(u16, math.floatFractionalBits(T) + 1);197 const bits = math.ceilPowerOfTwoAssert(u16, math.floatFractionalBits(T) + 1);
198 return std.meta.Int(.unsigned, bits);198 return @Int(.unsigned, bits);
199}199}
200200
201test {201test {
lib/compiler_rt/truncf.zig+3-3
...@@ -1,8 +1,8 @@...@@ -1,8 +1,8 @@
1const std = @import("std");1const std = @import("std");
22
3pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {3pub 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);4 const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
5 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);5 const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits);
6 const srcSigBits = std.math.floatMantissaBits(src_t);6 const srcSigBits = std.math.floatMantissaBits(src_t);
7 const dstSigBits = std.math.floatMantissaBits(dst_t);7 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...@@ -100,7 +100,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t
100}100}
101101
102pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t {102pub 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);
104 const src_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit104 const src_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
105 const dst_sig_bits = std.math.floatMantissaBits(dst_t);105 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 {...@@ -266,7 +266,7 @@ pub const fuzz = struct {
266 .comptime_int => x,266 .comptime_int => x,
267 .bool => @intFromBool(x),267 .bool => @intFromBool(x),
268 .@"enum" => @intFromEnum(x),268 .@"enum" => @intFromEnum(x),
269 else => @as(std.meta.Int(.unsigned, @bitSizeOf(T)), @bitCast(x)),269 else => @as(@Int(.unsigned, @bitSizeOf(T)), @bitCast(x)),
270270
271 .int => |i| x: {271 .int => |i| x: {
272 comptime {272 comptime {
lib/std/Io/Threaded.zig+1-1
...@@ -15574,7 +15574,7 @@ fn readIntFd(fd: posix.fd_t) !ErrInt {...@@ -15574,7 +15574,7 @@ fn readIntFd(fd: posix.fd_t) !ErrInt {
15574 return @intCast(std.mem.readInt(u64, &buffer, .little));15574 return @intCast(std.mem.readInt(u64, &buffer, .little));
15575}15575}
1557615576
15577const ErrInt = std.meta.Int(.unsigned, @sizeOf(anyerror) * 8);15577const ErrInt = @Int(.unsigned, @sizeOf(anyerror) * 8);
1557815578
15579fn destroyPipe(pipe: [2]posix.fd_t) void {15579fn destroyPipe(pipe: [2]posix.fd_t) void {
15580 if (pipe[0] != -1) closeFd(pipe[0]);15580 if (pipe[0] != -1) closeFd(pipe[0]);
lib/std/Io/Writer.zig+2-2
...@@ -1517,7 +1517,7 @@ pub fn printIntAny(...@@ -1517,7 +1517,7 @@ pub fn printIntAny(
1517 // The type must have the same size as `base` or be wider in order for the1517 // The type must have the same size as `base` or be wider in order for the
1518 // division to work1518 // division to work
1519 const min_int_bits = comptime @max(value_info.bits, 8);1519 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
1522 const abs_value = @abs(value);1522 const abs_value = @abs(value);
1523 // The worst case in terms of space needed is base 2, plus 1 for the sign1523 // 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...@@ -1637,7 +1637,7 @@ pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precisi
1637 });1637 });
16381638
1639 const T = @TypeOf(v);1639 const T = @TypeOf(v);
1640 const TU = std.meta.Int(.unsigned, @bitSizeOf(T));1640 const TU = @Int(.unsigned, @bitSizeOf(T));
16411641
1642 const mantissa_bits = std.math.floatMantissaBits(T);1642 const mantissa_bits = std.math.floatMantissaBits(T);
1643 const fractional_bits = std.math.floatFractionalBits(T);1643 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...@@ -125,9 +125,9 @@ pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: ty
125/// `i` is evenly distributed.125/// `i` is evenly distributed.
126pub fn int(r: Random, comptime T: type) T {126pub fn int(r: Random, comptime T: type) T {
127 const bits = @typeInfo(T).int.bits;127 const bits = @typeInfo(T).int.bits;
128 const UnsignedT = std.meta.Int(.unsigned, bits);128 const UnsignedT = @Int(.unsigned, bits);
129 const ceil_bytes = comptime std.math.divCeil(u16, bits, 8) catch unreachable;129 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
132 var rand_bytes: [ceil_bytes]u8 = undefined;132 var rand_bytes: [ceil_bytes]u8 = undefined;
133 r.bytes(&rand_bytes);133 r.bytes(&rand_bytes);
...@@ -215,7 +215,7 @@ pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_tha...@@ -215,7 +215,7 @@ pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_tha
215 const info = @typeInfo(T).int;215 const info = @typeInfo(T).int;
216 if (info.signedness == .signed) {216 if (info.signedness == .signed) {
217 // Two's complement makes this math pretty easy.217 // Two's complement makes this math pretty easy.
218 const UnsignedT = std.meta.Int(.unsigned, info.bits);218 const UnsignedT = @Int(.unsigned, info.bits);
219 const lo: UnsignedT = @bitCast(at_least);219 const lo: UnsignedT = @bitCast(at_least);
220 const hi: UnsignedT = @bitCast(less_than);220 const hi: UnsignedT = @bitCast(less_than);
221 const result = lo +% r.uintLessThanBiased(UnsignedT, hi -% lo);221 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)...@@ -234,7 +234,7 @@ pub fn intRangeLessThan(r: Random, comptime T: type, at_least: T, less_than: T)
234 const info = @typeInfo(T).int;234 const info = @typeInfo(T).int;
235 if (info.signedness == .signed) {235 if (info.signedness == .signed) {
236 // Two's complement makes this math pretty easy.236 // Two's complement makes this math pretty easy.
237 const UnsignedT = std.meta.Int(.unsigned, info.bits);237 const UnsignedT = @Int(.unsigned, info.bits);
238 const lo: UnsignedT = @bitCast(at_least);238 const lo: UnsignedT = @bitCast(at_least);
239 const hi: UnsignedT = @bitCast(less_than);239 const hi: UnsignedT = @bitCast(less_than);
240 const result = lo +% r.uintLessThan(UnsignedT, hi -% lo);240 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...@@ -252,7 +252,7 @@ pub fn intRangeAtMostBiased(r: Random, comptime T: type, at_least: T, at_most: T
252 const info = @typeInfo(T).int;252 const info = @typeInfo(T).int;
253 if (info.signedness == .signed) {253 if (info.signedness == .signed) {
254 // Two's complement makes this math pretty easy.254 // Two's complement makes this math pretty easy.
255 const UnsignedT = std.meta.Int(.unsigned, info.bits);255 const UnsignedT = @Int(.unsigned, info.bits);
256 const lo: UnsignedT = @bitCast(at_least);256 const lo: UnsignedT = @bitCast(at_least);
257 const hi: UnsignedT = @bitCast(at_most);257 const hi: UnsignedT = @bitCast(at_most);
258 const result = lo +% r.uintAtMostBiased(UnsignedT, hi -% lo);258 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 {...@@ -271,7 +271,7 @@ pub fn intRangeAtMost(r: Random, comptime T: type, at_least: T, at_most: T) T {
271 const info = @typeInfo(T).int;271 const info = @typeInfo(T).int;
272 if (info.signedness == .signed) {272 if (info.signedness == .signed) {
273 // Two's complement makes this math pretty easy.273 // Two's complement makes this math pretty easy.
274 const UnsignedT = std.meta.Int(.unsigned, info.bits);274 const UnsignedT = @Int(.unsigned, info.bits);
275 const lo: UnsignedT = @bitCast(at_least);275 const lo: UnsignedT = @bitCast(at_least);
276 const hi: UnsignedT = @bitCast(at_most);276 const hi: UnsignedT = @bitCast(at_most);
277 const result = lo +% r.uintAtMost(UnsignedT, hi -% lo);277 const result = lo +% r.uintAtMost(UnsignedT, hi -% lo);
lib/std/Target.zig+1-1
...@@ -1228,7 +1228,7 @@ pub const Cpu = struct {...@@ -1228,7 +1228,7 @@ pub const Cpu = struct {
1228 pub const needed_bit_count = 347;1228 pub const needed_bit_count = 347;
1229 pub const byte_count = (needed_bit_count + 7) / 8;1229 pub const byte_count = (needed_bit_count + 7) / 8;
1230 pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize);1230 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)));
1232 pub const ShiftInt = std.math.Log2Int(usize);1232 pub const ShiftInt = std.math.Log2Int(usize);
12331233
1234 pub const empty: Set = .{ .ints = @splat(0) };1234 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 {...@@ -65,7 +65,7 @@ pub fn Integer(comptime size: u16) type {
65 pub const bit_length: usize = size;65 pub const bit_length: usize = size;
6666
67 /// The integer type used to represent a mask in this bit set67 /// 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
70 /// The integer type used to shift a mask in this bit set70 /// The integer type used to shift a mask in this bit set
71 pub const ShiftInt = std.math.Log2Int(MaskInt);71 pub const ShiftInt = std.math.Log2Int(MaskInt);
...@@ -359,7 +359,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {...@@ -359,7 +359,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
359 if (!std.math.isPowerOfTwo(@bitSizeOf(MaskIntType))) {359 if (!std.math.isPowerOfTwo(@bitSizeOf(MaskIntType))) {
360 var desired_bits = std.math.ceilPowerOfTwoAssert(usize, @bitSizeOf(MaskIntType));360 var desired_bits = std.math.ceilPowerOfTwoAssert(usize, @bitSizeOf(MaskIntType));
361 if (desired_bits < byte_size) desired_bits = byte_size;361 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);
363 @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++363 @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++
364 ", which is not a power of two. Please round this up to a power of two integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");364 ", which is not a power of two. Please round this up to a power of two integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
365 }365 }
...@@ -370,7 +370,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {...@@ -370,7 +370,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
370 if (@bitSizeOf(MaskIntType) != @sizeOf(MaskIntType) * byte_size) {370 if (@bitSizeOf(MaskIntType) != @sizeOf(MaskIntType) * byte_size) {
371 var desired_bits = @sizeOf(MaskIntType) * byte_size;371 var desired_bits = @sizeOf(MaskIntType) * byte_size;
372 desired_bits = std.math.ceilPowerOfTwoAssert(usize, desired_bits);372 desired_bits = std.math.ceilPowerOfTwoAssert(usize, desired_bits);
373 const FixedMaskType = std.meta.Int(.unsigned, desired_bits);373 const FixedMaskType = @Int(.unsigned, desired_bits);
374 @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++374 @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++
375 ", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");375 ", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
376 }376 }
lib/std/c.zig+5-5
...@@ -7186,7 +7186,7 @@ pub const RTLD = switch (native_os) {...@@ -7186,7 +7186,7 @@ pub const RTLD = switch (native_os) {
7186 NOW: bool = false,7186 NOW: bool = false,
7187 GLOBAL: bool = false,7187 GLOBAL: bool = false,
7188 LOCAL: bool = false,7188 LOCAL: bool = false,
7189 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 6) = 0,7189 _: @Int(.unsigned, @bitSizeOf(c_int) - 6) = 0,
7190 },7190 },
7191 else => void,7191 else => void,
7192};7192};
...@@ -7366,7 +7366,7 @@ pub const AI = if (builtin.abi.isAndroid()) packed struct(u32) {...@@ -7366,7 +7366,7 @@ pub const AI = if (builtin.abi.isAndroid()) packed struct(u32) {
7366 V4MAPPED: bool = false,7366 V4MAPPED: bool = false,
7367 ALL: bool = false,7367 ALL: bool = false,
7368 ADDRCONFIG: bool = false,7368 ADDRCONFIG: bool = false,
7369 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 7) = 0,7369 _: @Int(.unsigned, @bitSizeOf(c_int) - 7) = 0,
7370 },7370 },
7371 else => void,7371 else => void,
7372};7372};
...@@ -7399,7 +7399,7 @@ pub const NI = switch (native_os) {...@@ -7399,7 +7399,7 @@ pub const NI = switch (native_os) {
7399 NAMEREQD: bool = false,7399 NAMEREQD: bool = false,
7400 NOFQDN: bool = false,7400 NOFQDN: bool = false,
7401 DGRAM: bool = false,7401 DGRAM: bool = false,
7402 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 5) = 0,7402 _: @Int(.unsigned, @bitSizeOf(c_int) - 5) = 0,
7403 },7403 },
7404 .freebsd, .haiku => packed struct(u32) {7404 .freebsd, .haiku => packed struct(u32) {
7405 NOFQDN: bool = false,7405 NOFQDN: bool = false,
...@@ -8635,7 +8635,7 @@ pub const O = switch (native_os) {...@@ -8635,7 +8635,7 @@ pub const O = switch (native_os) {
8635 CLOEXEC: bool = false,8635 CLOEXEC: bool = false,
8636 DIRECT: bool = false,8636 DIRECT: bool = false,
8637 SYNC: bool = false,8637 SYNC: bool = false,
8638 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 14) = 0,8638 _: @Int(.unsigned, @bitSizeOf(c_int) - 14) = 0,
8639 },8639 },
8640 else => void,8640 else => void,
8641};8641};
...@@ -8789,7 +8789,7 @@ pub const MAP = switch (native_os) {...@@ -8789,7 +8789,7 @@ pub const MAP = switch (native_os) {
8789 RANDOMIZED: bool = false,8789 RANDOMIZED: bool = false,
8790 PURGEABLE: bool = false,8790 PURGEABLE: bool = false,
8791 FIXED_NOREPLACE: bool = false,8791 FIXED_NOREPLACE: bool = false,
8792 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 11) = 0,8792 _: @Int(.unsigned, @bitSizeOf(c_int) - 11) = 0,
8793 },8793 },
8794 else => void,8794 else => void,
8795};8795};
lib/std/compress/zstd/Decompress.zig+5-5
...@@ -533,7 +533,7 @@ pub const Frame = struct {...@@ -533,7 +533,7 @@ pub const Frame = struct {
533 table: Table,533 table: Table,
534 accuracy_log: u8,534 accuracy_log: u8,
535535
536 const State = std.meta.Int(.unsigned, max_accuracy_log);536 const State = @Int(.unsigned, max_accuracy_log);
537 };537 };
538 }538 }
539539
...@@ -1783,7 +1783,7 @@ const ReverseBitReader = struct {...@@ -1783,7 +1783,7 @@ const ReverseBitReader = struct {
1783 }1783 }
17841784
1785 fn initBits(comptime T: type, out: anytype, num: u16) Bits(T) {1785 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));
1787 return .{1787 return .{
1788 @bitCast(@as(UT, @intCast(out))),1788 @bitCast(@as(UT, @intCast(out))),
1789 num,1789 num,
...@@ -1803,7 +1803,7 @@ const ReverseBitReader = struct {...@@ -1803,7 +1803,7 @@ const ReverseBitReader = struct {
1803 }1803 }
18041804
1805 fn readBitsTuple(self: *ReverseBitReader, comptime T: type, num: u16) !Bits(T) {1805 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));
1807 const U = if (@bitSizeOf(T) < 8) u8 else UT;1807 const U = if (@bitSizeOf(T) < 8) u8 else UT;
18081808
1809 if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num);1809 if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num);
...@@ -1871,7 +1871,7 @@ const BitReader = struct {...@@ -1871,7 +1871,7 @@ const BitReader = struct {
1871 count: u4 = 0,1871 count: u4 = 0,
18721872
1873 fn initBits(comptime T: type, out: anytype, num: u16) Bits(T) {1873 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));
1875 return .{1875 return .{
1876 @bitCast(@as(UT, @intCast(out))),1876 @bitCast(@as(UT, @intCast(out))),
1877 num,1877 num,
...@@ -1891,7 +1891,7 @@ const BitReader = struct {...@@ -1891,7 +1891,7 @@ const BitReader = struct {
1891 }1891 }
18921892
1893 fn readBitsTuple(self: *@This(), comptime T: type, num: u16) !Bits(T) {1893 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));
1895 const U = if (@bitSizeOf(T) < 8) u8 else UT;1895 const U = if (@bitSizeOf(T) < 8) u8 else UT;
18961896
1897 if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num);1897 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...@@ -171,7 +171,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le
171 block[0] = L - 1; // flags171 block[0] = L - 1; // flags
172 @memcpy(block[1..][0..nonce_length], &npub);172 @memcpy(block[1..][0..nonce_length], &npub);
173 // Counter goes in the last L bytes173 // Counter goes in the last L bytes
174 const CounterInt = std.meta.Int(.unsigned, L * 8);174 const CounterInt = @Int(.unsigned, L * 8);
175 mem.writeInt(CounterInt, block[1 + nonce_length ..][0..L], @as(CounterInt, @intCast(counter)), .big);175 mem.writeInt(CounterInt, block[1 + nonce_length ..][0..L], @as(CounterInt, @intCast(counter)), .big);
176 }176 }
177177
...@@ -229,7 +229,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le...@@ -229,7 +229,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le
229 @memcpy(block[1..][0..nonce_length], &npub);229 @memcpy(block[1..][0..nonce_length], &npub);
230230
231 // Encode message length in last L bytes231 // Encode message length in last L bytes
232 const LengthInt = std.meta.Int(.unsigned, L * 8);232 const LengthInt = @Int(.unsigned, L * 8);
233 mem.writeInt(LengthInt, block[1 + nonce_length ..][0..L], @as(LengthInt, @intCast(msg_len)), .big);233 mem.writeInt(LengthInt, block[1 + nonce_length ..][0..L], @as(LengthInt, @intCast(msg_len)), .big);
234 }234 }
235235
lib/std/crypto/cmac.zig+1-1
...@@ -74,7 +74,7 @@ pub fn Cmac(comptime BlockCipher: type) type {...@@ -74,7 +74,7 @@ pub fn Cmac(comptime BlockCipher: type) type {
74 }74 }
7575
76 fn double(l: Block) Block {76 fn double(l: Block) Block {
77 const Int = std.meta.Int(.unsigned, block_length * 8);77 const Int = @Int(.unsigned, block_length * 8);
78 const l_ = mem.readInt(Int, &l, .big);78 const l_ = mem.readInt(Int, &l, .big);
79 const l_2 = switch (block_length) {79 const l_2 = switch (block_length) {
80 8 => (l_ << 1) ^ (0x1b & -%(l_ >> 63)), // mod x^64 + x^4 + x^3 + x + 180 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 {...@@ -129,7 +129,7 @@ fn int(self: *Encoder, comptime T: type, value: T) !void {
129 const needs_padding: u1 = if (value == 0)129 const needs_padding: u1 = if (value == 0)
130 1130 1
131 else if (bits_needed > 8) brk: {131 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);
133 const right_shift: RightShift = @intCast(bits_needed - 9);133 const right_shift: RightShift = @intCast(bits_needed - 9);
134 break :brk if (value >> right_shift == 0x1ff) 1 else 0;134 break :brk if (value >> right_shift == 0x1ff) 1 else 0;
135 } else 0;135 } else 0;
lib/std/crypto/ff.zig+2-3
...@@ -10,7 +10,6 @@ const builtin = @import("builtin");...@@ -10,7 +10,6 @@ const builtin = @import("builtin");
10const crypto = std.crypto;10const crypto = std.crypto;
11const math = std.math;11const math = std.math;
12const mem = std.mem;12const mem = std.mem;
13const meta = std.meta;
14const testing = std.testing;13const testing = std.testing;
15const assert = std.debug.assert;14const assert = std.debug.assert;
16const Endian = std.builtin.Endian;15const Endian = std.builtin.Endian;
...@@ -25,7 +24,7 @@ const carry_bits = 1;...@@ -25,7 +24,7 @@ const carry_bits = 1;
25const t_bits: usize = @bitSizeOf(Limb) - carry_bits;24const t_bits: usize = @bitSizeOf(Limb) - carry_bits;
2625
27// A TLimb is a Limb that is truncated to t_bits.26// 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
30const native_endian = builtin.target.cpu.arch.endian();29const native_endian = builtin.target.cpu.arch.endian();
3130
...@@ -906,7 +905,7 @@ const ct_protected = struct {...@@ -906,7 +905,7 @@ const ct_protected = struct {
906 // Multiplies two limbs and returns the result as a wide limb.905 // Multiplies two limbs and returns the result as a wide limb.
907 fn mulWide(x: Limb, y: Limb) WideLimb {906 fn mulWide(x: Limb, y: Limb) WideLimb {
908 const half_bits = @typeInfo(Limb).int.bits / 2;907 const half_bits = @typeInfo(Limb).int.bits / 2;
909 const Half = meta.Int(.unsigned, half_bits);908 const Half = @Int(.unsigned, half_bits);
910 const x0 = @as(Half, @truncate(x));909 const x0 = @as(Half, @truncate(x));
911 const x1 = @as(Half, @truncate(x >> half_bits));910 const x1 = @as(Half, @truncate(x >> half_bits));
912 const y0 = @as(Half, @truncate(y));911 const y0 = @as(Half, @truncate(y));
lib/std/crypto/keccak_p.zig+1-1
...@@ -9,7 +9,7 @@ const mode = @import("builtin").mode;...@@ -9,7 +9,7 @@ const mode = @import("builtin").mode;
9/// The Keccak-f permutation.9/// The Keccak-f permutation.
10pub fn KeccakF(comptime f: u11) type {10pub fn KeccakF(comptime f: u11) type {
11 comptime assert(f >= 200 and f <= 1600 and f % 200 == 0); // invalid bit size11 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);
13 const Block = [25]T;13 const Block = [25]T;
1414
15 const PI = [_]u5{15 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 {...@@ -3413,7 +3413,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
3413 // Use a signed type for EEA computation3413 // Use a signed type for EEA computation
3414 const type_info = @typeInfo(T);3414 const type_info = @typeInfo(T);
3415 const SignedT = if (type_info == .int and type_info.int.signedness == .unsigned)3415 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)
3417 else3417 else
3418 T;3418 T;
34193419
...@@ -3436,7 +3436,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {...@@ -3436,7 +3436,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
3436fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T {3436fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T {
3437 const type_info = @typeInfo(T);3437 const type_info = @typeInfo(T);
3438 const bits = type_info.int.bits;3438 const bits = type_info.int.bits;
3439 const WideT = std.meta.Int(.unsigned, bits * 2);3439 const WideT = @Int(.unsigned, bits * 2);
34403440
3441 var ret: T = 1;3441 var ret: T = 1;
3442 var base: T = a;3442 var base: T = a;
...@@ -3465,14 +3465,14 @@ fn bitMask(comptime T: type, bit: T) T {...@@ -3465,14 +3465,14 @@ fn bitMask(comptime T: type, bit: T) T {
34653465
3466/// Creates a mask from the sign bit of a signed integer.3466/// Creates a mask from the sign bit of a signed integer.
3467/// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0.3467/// 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) {
3469 const type_info = @typeInfo(T);3469 const type_info = @typeInfo(T);
3470 if (type_info != .int) {3470 if (type_info != .int) {
3471 @compileError("signMask requires an integer type");3471 @compileError("signMask requires an integer type");
3472 }3472 }
34733473
3474 const bits = type_info.int.bits;3474 const bits = type_info.int.bits;
3475 const SignedT = std.meta.Int(.signed, bits);3475 const SignedT = @Int(.signed, bits);
34763476
3477 // Convert to signed if needed, arithmetic right shift to propagate sign bit3477 // Convert to signed if needed, arithmetic right shift to propagate sign bit
3478 const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x);3478 const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x);
...@@ -3499,8 +3499,8 @@ fn montgomeryReduce(...@@ -3499,8 +3499,8 @@ fn montgomeryReduce(
3499 const m: OutT = @truncate(m_full);3499 const m: OutT = @truncate(m_full);
35003500
3501 const yR = x -% @as(InT, m) * @as(InT, q);3501 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;3502 const y_shifted = @as(@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)));3503 return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
3504}3504}
35053505
3506/// Uniform sampling using SHAKE-128 with rejection sampling.3506/// 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 {...@@ -1794,7 +1794,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
1794 // Use a signed type for EEA computation1794 // Use a signed type for EEA computation
1795 const type_info = @typeInfo(T);1795 const type_info = @typeInfo(T);
1796 const SignedT = if (type_info == .int and type_info.int.signedness == .unsigned)1796 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)
1798 else1798 else
1799 T;1799 T;
18001800
...@@ -1817,7 +1817,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {...@@ -1817,7 +1817,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T {
1817fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T {1817fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T {
1818 const type_info = @typeInfo(T);1818 const type_info = @typeInfo(T);
1819 const bits = type_info.int.bits;1819 const bits = type_info.int.bits;
1820 const WideT = std.meta.Int(.unsigned, bits * 2);1820 const WideT = @Int(.unsigned, bits * 2);
18211821
1822 var ret: T = 1;1822 var ret: T = 1;
1823 var base: T = a;1823 var base: T = a;
...@@ -1846,14 +1846,14 @@ fn bitMask(comptime T: type, bit: T) T {...@@ -1846,14 +1846,14 @@ fn bitMask(comptime T: type, bit: T) T {
18461846
1847/// Creates a mask from the sign bit of a signed integer.1847/// Creates a mask from the sign bit of a signed integer.
1848/// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0.1848/// 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) {
1850 const type_info = @typeInfo(T);1850 const type_info = @typeInfo(T);
1851 if (type_info != .int) {1851 if (type_info != .int) {
1852 @compileError("signMask requires an integer type");1852 @compileError("signMask requires an integer type");
1853 }1853 }
18541854
1855 const bits = type_info.int.bits;1855 const bits = type_info.int.bits;
1856 const SignedT = std.meta.Int(.signed, bits);1856 const SignedT = @Int(.signed, bits);
18571857
1858 // Convert to signed if needed, arithmetic right shift to propagate sign bit1858 // Convert to signed if needed, arithmetic right shift to propagate sign bit
1859 const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x);1859 const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x);
...@@ -1898,8 +1898,8 @@ fn montgomeryReduce(...@@ -1898,8 +1898,8 @@ fn montgomeryReduce(
1898 const m: OutT = @truncate(m_full);1898 const m: OutT = @truncate(m_full);
18991899
1900 const yR = x -% @as(InT, m) * @as(InT, q);1900 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;1901 const y_shifted = @as(@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)));1902 return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted)));
1903}1903}
19041904
1905/// Uniform sampling using SHAKE-128 with rejection sampling.1905/// Uniform sampling using SHAKE-128 with rejection sampling.
lib/std/crypto/modes.zig+1-1
...@@ -40,7 +40,7 @@ pub fn ctrSlice(...@@ -40,7 +40,7 @@ pub fn ctrSlice(
40 var counterBlock = iv;40 var counterBlock = iv;
41 var i: usize = 0;41 var i: usize = 0;
4242
43 const CounterInt = std.meta.Int(.unsigned, counter_size * 8);43 const CounterInt = @Int(.unsigned, counter_size * 8);
4444
45 const parallel_count = BlockCipher.block.parallel.optimal_parallel_blocks;45 const parallel_count = BlockCipher.block.parallel.optimal_parallel_blocks;
46 const wide_block_length = parallel_count * block_length;46 const wide_block_length = parallel_count * block_length;
lib/std/crypto/pcurves/common.zig+4-5
...@@ -2,7 +2,6 @@ const std = @import("std");...@@ -2,7 +2,6 @@ const std = @import("std");
2const crypto = std.crypto;2const crypto = std.crypto;
3const debug = std.debug;3const debug = std.debug;
4const mem = std.mem;4const mem = std.mem;
5const meta = std.meta;
65
7const NonCanonicalError = crypto.errors.NonCanonicalError;6const NonCanonicalError = crypto.errors.NonCanonicalError;
8const NotSquareError = crypto.errors.NotSquareError;7const NotSquareError = crypto.errors.NotSquareError;
...@@ -54,7 +53,7 @@ pub fn Field(comptime params: FieldParams) type {...@@ -54,7 +53,7 @@ pub fn Field(comptime params: FieldParams) type {
54 var s = if (endian == .little) s_ else orderSwap(s_);53 var s = if (endian == .little) s_ else orderSwap(s_);
55 const field_order_s = comptime fos: {54 const field_order_s = comptime fos: {
56 var fos: [encoded_length]u8 = undefined;55 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);
58 break :fos fos;57 break :fos fos;
59 };58 };
60 if (crypto.timing_safe.compare(u8, &s, &field_order_s, .little) != .lt) {59 if (crypto.timing_safe.compare(u8, &s, &field_order_s, .little) != .lt) {
...@@ -90,7 +89,7 @@ pub fn Field(comptime params: FieldParams) type {...@@ -90,7 +89,7 @@ pub fn Field(comptime params: FieldParams) type {
90 }89 }
9190
92 /// Element as an integer.91 /// Element as an integer.
93 pub const IntRepr = meta.Int(.unsigned, params.field_bits);92 pub const IntRepr = @Int(.unsigned, params.field_bits);
9493
95 /// Create a field element from an integer.94 /// Create a field element from an integer.
96 pub fn fromInt(comptime x: IntRepr) NonCanonicalError!Fe {95 pub fn fromInt(comptime x: IntRepr) NonCanonicalError!Fe {
...@@ -270,7 +269,7 @@ pub fn Field(comptime params: FieldParams) type {...@@ -270,7 +269,7 @@ pub fn Field(comptime params: FieldParams) type {
270 const ls = x126.sqn(126).mul(x126).sqn(3).mul(t111).sqn(33).mul(x32).sqn(95).mul(x31);269 const ls = x126.sqn(126).mul(x126).sqn(3).mul(t111).sqn(33).mul(x32).sqn(95).mul(x31);
271 return ls.equivalent(Fe.one);270 return ls.equivalent(Fe.one);
272 } else {271 } else {
273 const ls = x2.pow(std.meta.Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol272 const ls = x2.pow(@Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol
274 return ls.equivalent(Fe.one);273 return ls.equivalent(Fe.one);
275 }274 }
276 }275 }
...@@ -307,7 +306,7 @@ pub fn Field(comptime params: FieldParams) type {...@@ -307,7 +306,7 @@ pub fn Field(comptime params: FieldParams) type {
307 const x108 = x54.sqn(54).mul(x54);306 const x108 = x54.sqn(54).mul(x54);
308 return x108.sqn(108).mul(x108).sqn(7).mul(t1111111).sqn(23).mul(x22).sqn(6).mul(t11).sqn(2);307 return x108.sqn(108).mul(x108).sqn(7).mul(t1111111).sqn(23).mul(x22).sqn(6).mul(t11).sqn(2);
309 } else {308 } 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);
311 }310 }
312 }311 }
313312
lib/std/crypto/timing_safe.zig+5-5
...@@ -21,8 +21,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool {...@@ -21,8 +21,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool {
21 acc |= x ^ b[i];21 acc |= x ^ b[i];
22 }22 }
23 const s = @typeInfo(C).int.bits;23 const s = @typeInfo(C).int.bits;
24 const Cu = std.meta.Int(.unsigned, s);24 const Cu = @Int(.unsigned, s);
25 const Cext = std.meta.Int(.unsigned, s + 1);25 const Cext = @Int(.unsigned, s + 1);
26 return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));26 return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
27 },27 },
28 .vector => |info| {28 .vector => |info| {
...@@ -32,8 +32,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool {...@@ -32,8 +32,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool {
32 }32 }
33 const acc = @reduce(.Or, a ^ b);33 const acc = @reduce(.Or, a ^ b);
34 const s = @typeInfo(C).int.bits;34 const s = @typeInfo(C).int.bits;
35 const Cu = std.meta.Int(.unsigned, s);35 const Cu = @Int(.unsigned, s);
36 const Cext = std.meta.Int(.unsigned, s + 1);36 const Cext = @Int(.unsigned, s + 1);
37 return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));37 return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
38 },38 },
39 else => {39 else => {
...@@ -50,7 +50,7 @@ pub fn compare(comptime T: type, a: []const T, b: []const T, endian: Endian) Ord...@@ -50,7 +50,7 @@ pub fn compare(comptime T: type, a: []const T, b: []const T, endian: Endian) Ord
50 .int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits,50 .int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits,
51 else => @compileError("Elements to be compared must be integers"),51 else => @compileError("Elements to be compared must be integers"),
52 };52 };
53 const Cext = std.meta.Int(.unsigned, bits + 1);53 const Cext = @Int(.unsigned, bits + 1);
54 var gt: T = 0;54 var gt: T = 0;
55 var eq: T = 1;55 var eq: T = 1;
56 if (endian == .little) {56 if (endian == .little) {
lib/std/enums.zig+5-5
...@@ -1291,7 +1291,7 @@ pub fn EnumIndexer(comptime E: type) type {...@@ -1291,7 +1291,7 @@ pub fn EnumIndexer(comptime E: type) type {
1291 const min_value = std.math.minInt(BackingInt);1291 const min_value = std.math.minInt(BackingInt);
1292 const max_value = std.math.maxInt(BackingInt);1292 const max_value = std.math.maxInt(BackingInt);
12931293
1294 const RangeType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt));1294 const RangeType = @Int(.unsigned, @bitSizeOf(BackingInt));
1295 pub const count: comptime_int = std.math.maxInt(RangeType) + 1;1295 pub const count: comptime_int = std.math.maxInt(RangeType) + 1;
12961296
1297 pub fn indexOf(e: E) usize {1297 pub fn indexOf(e: E) usize {
...@@ -1307,7 +1307,7 @@ pub fn EnumIndexer(comptime E: type) type {...@@ -1307,7 +1307,7 @@ pub fn EnumIndexer(comptime E: type) type {
1307 if (backing_int_sign == .unsigned)1307 if (backing_int_sign == .unsigned)
1308 return @enumFromInt(i);1308 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);
1311 }1311 }
1312 };1312 };
1313 }1313 }
...@@ -1380,14 +1380,14 @@ test "EnumIndexer non-exhaustive" {...@@ -1380,14 +1380,14 @@ test "EnumIndexer non-exhaustive" {
1380 i4,1380 i4,
1381 i8,1381 i8,
1382 i16,1382 i16,
1383 std.meta.Int(.signed, @bitSizeOf(isize) - 1),1383 @Int(.signed, @bitSizeOf(isize) - 1),
1384 isize,1384 isize,
1385 u1,1385 u1,
1386 u2,1386 u2,
1387 u3,1387 u3,
1388 u4,1388 u4,
1389 u16,1389 u16,
1390 std.meta.Int(.unsigned, @bitSizeOf(usize) - 1),1390 @Int(.unsigned, @bitSizeOf(usize) - 1),
1391 usize,1391 usize,
1392 };1392 };
1393 inline for (backing_ints) |BackingInt| {1393 inline for (backing_ints) |BackingInt| {
...@@ -1400,7 +1400,7 @@ test "EnumIndexer non-exhaustive" {...@@ -1400,7 +1400,7 @@ test "EnumIndexer non-exhaustive" {
1400 const min_tag: E = @enumFromInt(std.math.minInt(BackingInt));1400 const min_tag: E = @enumFromInt(std.math.minInt(BackingInt));
1401 const max_tag: E = @enumFromInt(std.math.maxInt(BackingInt));1401 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));
1404 const max_index: comptime_int = std.math.maxInt(RangedType);1404 const max_index: comptime_int = std.math.maxInt(RangedType);
1405 const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).int.signedness) {1405 const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).int.signedness) {
1406 .unsigned => 0,1406 .unsigned => 0,
lib/std/fmt.zig+1-1
...@@ -433,7 +433,7 @@ fn parseIntWithSign(...@@ -433,7 +433,7 @@ fn parseIntWithSign(
433 // accumulate into Accumulate which is always 8 bits or larger. this prevents433 // accumulate into Accumulate which is always 8 bits or larger. this prevents
434 // `buf_base` from overflowing Result.434 // `buf_base` from overflowing Result.
435 const info = @typeInfo(Result);435 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));
437 var accumulate: Accumulate = 0;437 var accumulate: Accumulate = 0;
438438
439 if (buf_start[0] == '_' or buf_start[buf_start.len - 1] == '_') return error.InvalidCharacter;439 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 {...@@ -128,7 +128,7 @@ test parseFloat {
128128
129test "nan and inf" {129test "nan and inf" {
130 inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| {130 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
133 try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T))));133 try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T))));
134 try expectEqual(try parseFloat(T, "inF"), std.math.inf(T));134 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 {...@@ -130,7 +130,7 @@ pub const Wyhash = struct {
130130
131 inline fn read(comptime bytes: usize, data: []const u8) u64 {131 inline fn read(comptime bytes: usize, data: []const u8) u64 {
132 std.debug.assert(bytes <= 8);132 std.debug.assert(bytes <= 8);
133 const T = std.meta.Int(.unsigned, 8 * bytes);133 const T = @Int(.unsigned, 8 * bytes);
134 return @as(u64, std.mem.readInt(T, data[0..bytes], .little));134 return @as(u64, std.mem.readInt(T, data[0..bytes], .little));
135 }135 }
136136
lib/std/heap/debug_allocator.zig+1-1
...@@ -189,7 +189,7 @@ pub fn DebugAllocator(comptime config: Config) type {...@@ -189,7 +189,7 @@ pub fn DebugAllocator(comptime config: Config) type {
189 const page_size = config.page_size;189 const page_size = config.page_size;
190 const page_align: mem.Alignment = .fromByteUnits(page_size);190 const page_align: mem.Alignment = .fromByteUnits(page_size);
191 /// Integer type for pointing to slots in a small allocation191 /// 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
194 const total_requested_bytes_init = if (config.enable_memory_limit) @as(usize, 0) else {};194 const total_requested_bytes_init = if (config.enable_memory_limit) @as(usize, 0) else {};
195 const requested_memory_limit_init = if (config.enable_memory_limit) @as(usize, math.maxInt(usize)) else {};195 const requested_memory_limit_init = if (config.enable_memory_limit) @as(usize, math.maxInt(usize)) else {};
lib/std/json/static_test.zig+2-2
...@@ -663,7 +663,7 @@ test "parse into tuple" {...@@ -663,7 +663,7 @@ test "parse into tuple" {
663 float: f64,663 float: f64,
664 string: []const u8,664 string: []const u8,
665 };665 };
666 const T = std.meta.Tuple(&.{666 const T = @Tuple(&.{
667 i64,667 i64,
668 f64,668 f64,
669 bool,669 bool,
...@@ -673,7 +673,7 @@ test "parse into tuple" {...@@ -673,7 +673,7 @@ test "parse into tuple" {
673 foo: i32,673 foo: i32,
674 bar: []const u8,674 bar: []const u8,
675 },675 },
676 std.meta.Tuple(&.{ u8, []const u8, u8 }),676 @Tuple(&.{ u8, []const u8, u8 }),
677 Union,677 Union,
678 });678 });
679 const str =679 const str =
lib/std/leb128.zig+2-2
...@@ -9,7 +9,7 @@ const testing = std.testing;...@@ -9,7 +9,7 @@ const testing = std.testing;
9/// An example use case of this is in emitting DWARF info where one wants to make a ULEB128 field9/// An example use case of this is in emitting DWARF info where one wants to make a ULEB128 field
10/// "relocatable", meaning that it becomes possible to later go back and patch the number to be a10/// "relocatable", meaning that it becomes possible to later go back and patch the number to be a
11/// different value without shifting all the following code.11/// 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 {
13 writeUnsignedExtended(ptr, int);13 writeUnsignedExtended(ptr, int);
14}14}
1515
...@@ -65,7 +65,7 @@ test writeUnsignedFixed {...@@ -65,7 +65,7 @@ test writeUnsignedFixed {
65/// An example use case of this is in emitting DWARF info where one wants to make a ILEB128 field65/// An example use case of this is in emitting DWARF info where one wants to make a ILEB128 field
66/// "relocatable", meaning that it becomes possible to later go back and patch the number to be a66/// "relocatable", meaning that it becomes possible to later go back and patch the number to be a
67/// different value without shifting all the following code.67/// 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 {
69 const T = @TypeOf(int);69 const T = @TypeOf(int);
70 const U = if (@typeInfo(T).int.bits < 8) u8 else T;70 const U = if (@typeInfo(T).int.bits < 8) u8 else T;
71 var value: U = @intCast(int);71 var value: U = @intCast(int);
lib/std/math.zig+8-8
...@@ -779,7 +779,7 @@ pub fn Log2Int(comptime T: type) type {...@@ -779,7 +779,7 @@ pub fn Log2Int(comptime T: type) type {
779 if (T == comptime_int) return comptime_int;779 if (T == comptime_int) return comptime_int;
780 const bits: u16 = @typeInfo(T).int.bits;780 const bits: u16 = @typeInfo(T).int.bits;
781 const log2_bits = 16 - @clz(bits - 1);781 const log2_bits = 16 - @clz(bits - 1);
782 return std.meta.Int(.unsigned, log2_bits);782 return @Int(.unsigned, log2_bits);
783}783}
784784
785/// Returns an unsigned int type that can hold the number of bits in T.785/// 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 {...@@ -788,7 +788,7 @@ pub fn Log2IntCeil(comptime T: type) type {
788 if (T == comptime_int) return comptime_int;788 if (T == comptime_int) return comptime_int;
789 const bits: u16 = @typeInfo(T).int.bits;789 const bits: u16 = @typeInfo(T).int.bits;
790 const log2_bits = 16 - @clz(bits);790 const log2_bits = 16 - @clz(bits);
791 return std.meta.Int(.unsigned, log2_bits);791 return @Int(.unsigned, log2_bits);
792}792}
793793
794/// Returns the smallest integer type that can hold both from and to.794/// Returns the smallest integer type that can hold both from and to.
...@@ -1048,10 +1048,10 @@ fn testRem() !void {...@@ -1048,10 +1048,10 @@ fn testRem() !void {
10481048
1049/// Returns the negation of the integer parameter.1049/// Returns the negation of the integer parameter.
1050/// Result is a signed integer.1050/// 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))) {
1052 if (@typeInfo(@TypeOf(x)).int.signedness == .signed) return negate(x);1052 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)));
1055 if (x > -minInt(int)) return error.Overflow;1055 if (x > -minInt(int)) return error.Overflow;
10561056
1057 if (x == -minInt(int)) return minInt(int);1057 if (x == -minInt(int)) return minInt(int);
...@@ -1177,7 +1177,7 @@ pub inline fn floor(value: anytype) @TypeOf(value) {...@@ -1177,7 +1177,7 @@ pub inline fn floor(value: anytype) @TypeOf(value) {
1177/// Returns the nearest power of two less than or equal to value, or1177/// Returns the nearest power of two less than or equal to value, or
1178/// zero if value is less than or equal to zero.1178/// zero if value is less than or equal to zero.
1179pub fn floorPowerOfTwo(comptime T: type, value: T) T {1179pub 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);
1181 if (value <= 0) return 0;1181 if (value <= 0) return 0;
1182 return @as(T, 1) << log2_int(uT, @as(uT, @intCast(value)));1182 return @as(T, 1) << log2_int(uT, @as(uT, @intCast(value)));
1183}1183}
...@@ -1212,7 +1212,7 @@ pub inline fn ceil(value: anytype) @TypeOf(value) {...@@ -1212,7 +1212,7 @@ pub inline fn ceil(value: anytype) @TypeOf(value) {
1212/// Returns the next power of two (if the value is not already a power of two).1212/// Returns the next power of two (if the value is not already a power of two).
1213/// Only unsigned integers can be used. Zero is not an allowed input.1213/// Only unsigned integers can be used. Zero is not an allowed input.
1214/// Result is a type with 1 more bit than the input type.1214/// 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) {
1216 comptime assert(@typeInfo(T) == .int);1216 comptime assert(@typeInfo(T) == .int);
1217 comptime assert(@typeInfo(T).int.signedness == .unsigned);1217 comptime assert(@typeInfo(T).int.signedness == .unsigned);
1218 assert(value != 0);1218 assert(value != 0);
...@@ -1497,11 +1497,11 @@ test "max value type" {...@@ -1497,11 +1497,11 @@ test "max value type" {
14971497
1498/// Multiply a and b. Return type is wide enough to guarantee no1498/// Multiply a and b. Return type is wide enough to guarantee no
1499/// overflow.1499/// 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(
1501 @typeInfo(T).int.signedness,1501 @typeInfo(T).int.signedness,
1502 @typeInfo(T).int.bits * 2,1502 @typeInfo(T).int.bits * 2,
1503) {1503) {
1504 const ResultInt = std.meta.Int(1504 const ResultInt = @Int(
1505 @typeInfo(T).int.signedness,1505 @typeInfo(T).int.signedness,
1506 @typeInfo(T).int.bits * 2,1506 @typeInfo(T).int.bits * 2,
1507 );1507 );
lib/std/math/big.zig+4-4
...@@ -4,10 +4,10 @@ const assert = std.debug.assert;...@@ -4,10 +4,10 @@ const assert = std.debug.assert;
4pub const int = @import("big/int.zig");4pub const int = @import("big/int.zig");
5pub const Limb = usize;5pub const Limb = usize;
6const limb_info = @typeInfo(Limb).int;6const limb_info = @typeInfo(Limb).int;
7pub const SignedLimb = std.meta.Int(.signed, limb_info.bits);7pub const SignedLimb = @Int(.signed, limb_info.bits);
8pub const DoubleLimb = std.meta.Int(.unsigned, 2 * limb_info.bits);8pub const DoubleLimb = @Int(.unsigned, 2 * limb_info.bits);
9pub const HalfLimb = std.meta.Int(.unsigned, limb_info.bits / 2);9pub const HalfLimb = @Int(.unsigned, limb_info.bits / 2);
10pub const SignedDoubleLimb = std.meta.Int(.signed, 2 * limb_info.bits);10pub const SignedDoubleLimb = @Int(.signed, 2 * limb_info.bits);
11pub const Log2Limb = std.math.Log2Int(Limb);11pub const Log2Limb = std.math.Log2Int(Limb);
1212
13comptime {13comptime {
lib/std/math/big/int.zig+2-2
...@@ -2047,7 +2047,7 @@ pub const Mutable = struct {...@@ -2047,7 +2047,7 @@ pub const Mutable = struct {
2047 var limb = switch (signedness) {2047 var limb = switch (signedness) {
2048 .unsigned => mem.readVarPackedInt(Limb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .unsigned),2048 .unsigned => mem.readVarPackedInt(Limb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .unsigned),
2049 .signed => b: {2049 .signed => b: {
2050 const SLimb = std.meta.Int(.signed, @bitSizeOf(Limb));2050 const SLimb = @Int(.signed, @bitSizeOf(Limb));
2051 const limb = mem.readVarPackedInt(SLimb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .signed);2051 const limb = mem.readVarPackedInt(SLimb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .signed);
2052 break :b @as(Limb, @bitCast(limb));2052 break :b @as(Limb, @bitCast(limb));
2053 },2053 },
...@@ -2284,7 +2284,7 @@ pub const Const = struct {...@@ -2284,7 +2284,7 @@ pub const Const = struct {
2284 // Make sure -0 is handled correctly.2284 // Make sure -0 is handled correctly.
2285 if (self.eqlZero()) return 0;2285 if (self.eqlZero()) return 0;
22862286
2287 const Unsigned = std.meta.Int(.unsigned, info.bits);2287 const Unsigned = @Int(.unsigned, info.bits);
22882288
2289 if (!self.fitsInTwosComp(info.signedness, info.bits)) {2289 if (!self.fitsInTwosComp(info.signedness, info.bits)) {
2290 return error.TargetTooSmall;2290 return error.TargetTooSmall;
lib/std/math/big/int_test.zig+2-2
...@@ -2370,7 +2370,7 @@ test "truncate multi to single signed" {...@@ -2370,7 +2370,7 @@ test "truncate multi to single signed" {
23702370
2371test "truncate multi to multi unsigned" {2371test "truncate multi to multi unsigned" {
2372 const bits = @typeInfo(SignedDoubleLimb).int.bits;2372 const bits = @typeInfo(SignedDoubleLimb).int.bits;
2373 const Int = std.meta.Int(.unsigned, bits - 1);2373 const Int = @Int(.unsigned, bits - 1);
23742374
2375 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));2375 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));
2376 defer a.deinit();2376 defer a.deinit();
...@@ -2386,7 +2386,7 @@ test "truncate multi to multi signed" {...@@ -2386,7 +2386,7 @@ test "truncate multi to multi signed" {
23862386
2387 try a.truncate(&a, .signed, @bitSizeOf(Limb) + 1);2387 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)));
2390}2390}
23912391
2392test "truncate negative multi to single" {2392test "truncate negative multi to single" {
lib/std/math/copysign.zig+1-1
...@@ -5,7 +5,7 @@ const expect = std.testing.expect;...@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5/// Returns a value with the magnitude of `magnitude` and the sign of `sign`.5/// Returns a value with the magnitude of `magnitude` and the sign of `sign`.
6pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) {6pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) {
7 const T = @TypeOf(magnitude);7 const T = @TypeOf(magnitude);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);8 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
9 const sign_bit_mask = @as(TBits, 1) << (@bitSizeOf(T) - 1);9 const sign_bit_mask = @as(TBits, 1) << (@bitSizeOf(T) - 1);
10 const mag = @as(TBits, @bitCast(magnitude)) & ~sign_bit_mask;10 const mag = @as(TBits, @bitCast(magnitude)) & ~sign_bit_mask;
11 const sgn = @as(TBits, @bitCast(sign)) & sign_bit_mask;11 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)) {...@@ -22,16 +22,16 @@ pub fn frexp(x: anytype) Frexp(@TypeOf(x)) {
22 const T: type = @TypeOf(x);22 const T: type = @TypeOf(x);
2323
24 const bits: comptime_int = @typeInfo(T).float.bits;24 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
27 const exp_bits: comptime_int = math.floatExponentBits(T);27 const exp_bits: comptime_int = math.floatExponentBits(T);
28 const mant_bits: comptime_int = math.floatMantissaBits(T);28 const mant_bits: comptime_int = math.floatMantissaBits(T);
29 const frac_bits: comptime_int = math.floatFractionalBits(T);29 const frac_bits: comptime_int = math.floatFractionalBits(T);
30 const exp_min: comptime_int = math.floatExponentMin(T);30 const exp_min: comptime_int = math.floatExponentMin(T);
3131
32 const ExpInt: type = std.meta.Int(.unsigned, exp_bits);32 const ExpInt: type = @Int(.unsigned, exp_bits);
33 const MantInt: type = std.meta.Int(.unsigned, mant_bits);33 const MantInt: type = @Int(.unsigned, mant_bits);
34 const FracInt: type = std.meta.Int(.unsigned, frac_bits);34 const FracInt: type = @Int(.unsigned, frac_bits);
3535
36 const unreal_exponent: comptime_int = (1 << exp_bits) - 1;36 const unreal_exponent: comptime_int = (1 << exp_bits) - 1;
37 const bias: comptime_int = (1 << (exp_bits - 1)) - 2;37 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 {...@@ -30,7 +30,7 @@ fn ilogbX(comptime T: type, x: T) i32 {
30 const significandBits = math.floatMantissaBits(T);30 const significandBits = math.floatMantissaBits(T);
31 const exponentBits = math.floatExponentBits(T);31 const exponentBits = math.floatExponentBits(T);
3232
33 const Z = std.meta.Int(.unsigned, typeWidth);33 const Z = @Int(.unsigned, typeWidth);
3434
35 const signBit = (@as(Z, 1) << (significandBits + exponentBits));35 const signBit = (@as(Z, 1) << (significandBits + exponentBits));
36 const maxExponent = ((1 << exponentBits) - 1);36 const maxExponent = ((1 << exponentBits) - 1);
lib/std/math/isfinite.zig+1-1
...@@ -5,7 +5,7 @@ const expect = std.testing.expect;...@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5/// Returns whether x is a finite value.5/// Returns whether x is a finite value.
6pub fn isFinite(x: anytype) bool {6pub fn isFinite(x: anytype) bool {
7 const T = @TypeOf(x);7 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);8 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
9 const remove_sign = ~@as(TBits, 0) >> 1;9 const remove_sign = ~@as(TBits, 0) >> 1;
10 return @as(TBits, @bitCast(x)) & remove_sign < @as(TBits, @bitCast(math.inf(T)));10 return @as(TBits, @bitCast(x)) & remove_sign < @as(TBits, @bitCast(math.inf(T)));
11}11}
lib/std/math/isinf.zig+1-1
...@@ -5,7 +5,7 @@ const expect = std.testing.expect;...@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5/// Returns whether x is an infinity, ignoring sign.5/// Returns whether x is an infinity, ignoring sign.
6pub inline fn isInf(x: anytype) bool {6pub inline fn isInf(x: anytype) bool {
7 const T = @TypeOf(x);7 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);8 const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
9 const remove_sign = ~@as(TBits, 0) >> 1;9 const remove_sign = ~@as(TBits, 0) >> 1;
10 return @as(TBits, @bitCast(x)) & remove_sign == @as(TBits, @bitCast(math.inf(T)));10 return @as(TBits, @bitCast(x)) & remove_sign == @as(TBits, @bitCast(math.inf(T)));
11}11}
lib/std/math/isnan.zig+1-2
...@@ -1,7 +1,6 @@...@@ -1,7 +1,6 @@
1const std = @import("../std.zig");1const std = @import("../std.zig");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const math = std.math;3const math = std.math;
4const meta = std.meta;
5const expect = std.testing.expect;4const expect = std.testing.expect;
65
7pub fn isNan(x: anytype) bool {6pub fn isNan(x: anytype) bool {
...@@ -12,7 +11,7 @@ pub fn isNan(x: anytype) bool {...@@ -12,7 +11,7 @@ pub fn isNan(x: anytype) bool {
12/// this is tracked by https://github.com/ziglang/zig/issues/1436611/// this is tracked by https://github.com/ziglang/zig/issues/14366
13pub fn isSignalNan(x: anytype) bool {12pub fn isSignalNan(x: anytype) bool {
14 const T = @TypeOf(x);13 const T = @TypeOf(x);
15 const U = meta.Int(.unsigned, @bitSizeOf(T));14 const U = @Int(.unsigned, @bitSizeOf(T));
16 const quiet_signal_bit_mask = 1 << (math.floatFractionalBits(T) - 1);15 const quiet_signal_bit_mask = 1 << (math.floatFractionalBits(T) - 1);
17 return isNan(x) and (@as(U, @bitCast(x)) & quiet_signal_bit_mask == 0);16 return isNan(x) and (@as(U, @bitCast(x)) & quiet_signal_bit_mask == 0);
18}17}
lib/std/math/isnormal.zig+2-2
...@@ -5,7 +5,7 @@ const expect = std.testing.expect;...@@ -5,7 +5,7 @@ const expect = std.testing.expect;
5/// Returns whether x is neither zero, subnormal, infinity, or NaN.5/// Returns whether x is neither zero, subnormal, infinity, or NaN.
6pub fn isNormal(x: anytype) bool {6pub fn isNormal(x: anytype) bool {
7 const T = @TypeOf(x);7 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
10 const increment_exp = 1 << math.floatMantissaBits(T);10 const increment_exp = 1 << math.floatMantissaBits(T);
11 const remove_sign = ~@as(TBits, 0) >> 1;11 const remove_sign = ~@as(TBits, 0) >> 1;
...@@ -22,7 +22,7 @@ pub fn isNormal(x: anytype) bool {...@@ -22,7 +22,7 @@ pub fn isNormal(x: anytype) bool {
22test isNormal {22test isNormal {
23 // TODO add `c_longdouble' when math.inf(T) supports it23 // TODO add `c_longdouble' when math.inf(T) supports it
24 inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| {24 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
27 // normals27 // normals
28 try expect(isNormal(@as(T, 1.0)));28 try expect(isNormal(@as(T, 1.0)));
lib/std/math/iszero.zig+2-2
...@@ -6,7 +6,7 @@ const expect = std.testing.expect;...@@ -6,7 +6,7 @@ const expect = std.testing.expect;
6pub inline fn isPositiveZero(x: anytype) bool {6pub inline fn isPositiveZero(x: anytype) bool {
7 const T = @TypeOf(x);7 const T = @TypeOf(x);
8 const bit_count = @typeInfo(T).float.bits;8 const bit_count = @typeInfo(T).float.bits;
9 const TBits = std.meta.Int(.unsigned, bit_count);9 const TBits = @Int(.unsigned, bit_count);
10 return @as(TBits, @bitCast(x)) == @as(TBits, 0);10 return @as(TBits, @bitCast(x)) == @as(TBits, 0);
11}11}
1212
...@@ -14,7 +14,7 @@ pub inline fn isPositiveZero(x: anytype) bool {...@@ -14,7 +14,7 @@ pub inline fn isPositiveZero(x: anytype) bool {
14pub inline fn isNegativeZero(x: anytype) bool {14pub inline fn isNegativeZero(x: anytype) bool {
15 const T = @TypeOf(x);15 const T = @TypeOf(x);
16 const bit_count = @typeInfo(T).float.bits;16 const bit_count = @typeInfo(T).float.bits;
17 const TBits = std.meta.Int(.unsigned, bit_count);17 const TBits = @Int(.unsigned, bit_count);
18 return @as(TBits, @bitCast(x)) == @as(TBits, 1) << (bit_count - 1);18 return @as(TBits, @bitCast(x)) == @as(TBits, 1) << (bit_count - 1);
19}19}
2020
lib/std/math/ldexp.zig+2-2
...@@ -7,7 +7,7 @@ const expect = std.testing.expect;...@@ -7,7 +7,7 @@ const expect = std.testing.expect;
7/// Returns x * 2^n.7/// Returns x * 2^n.
8pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {8pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
9 const T = @TypeOf(x);9 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
12 const exponent_bits = math.floatExponentBits(T);12 const exponent_bits = math.floatExponentBits(T);
13 const mantissa_bits = math.floatMantissaBits(T);13 const mantissa_bits = math.floatMantissaBits(T);
...@@ -103,7 +103,7 @@ test ldexp {...@@ -103,7 +103,7 @@ test ldexp {
103103
104 // Multiplications might flush the denormals to zero, esp. at104 // Multiplications might flush the denormals to zero, esp. at
105 // runtime, so we manually construct the constants here instead.105 // 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));
107 const EightTimesTrueMin = @as(T, @bitCast(@as(Z, 8)));107 const EightTimesTrueMin = @as(T, @bitCast(@as(Z, 8)));
108 const TwoTimesTrueMin = @as(T, @bitCast(@as(Z, 2)));108 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 {...@@ -90,7 +90,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {
9090
91 return x_parts.toFloat();91 return x_parts.toFloat();
92 } else {92 } else {
93 const Bits = std.meta.Int(.unsigned, @bitSizeOf(T));93 const Bits = @Int(.unsigned, @bitSizeOf(T));
94 var x_bits: Bits = @bitCast(x);94 var x_bits: Bits = @bitCast(x);
95 if ((x > 0.0) == (y > x)) {95 if ((x > 0.0) == (y > x)) {
96 x_bits += 1;96 x_bits += 1;
...@@ -320,6 +320,6 @@ test "float" {...@@ -320,6 +320,6 @@ test "float" {
320/// Helps ensure that 0.0 doesn't compare equal to -0.0.320/// Helps ensure that 0.0 doesn't compare equal to -0.0.
321fn bitwiseEqual(comptime T: type, x: T, y: T) bool {321fn bitwiseEqual(comptime T: type, x: T, y: T) bool {
322 comptime assert(@typeInfo(T) == .float);322 comptime assert(@typeInfo(T) == .float);
323 const Bits = std.meta.Int(.unsigned, @bitSizeOf(T));323 const Bits = @Int(.unsigned, @bitSizeOf(T));
324 return @as(Bits, @bitCast(x)) == @as(Bits, @bitCast(y));324 return @as(Bits, @bitCast(x)) == @as(Bits, @bitCast(y));
325}325}
lib/std/math/pow.zig+1-1
...@@ -147,7 +147,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {...@@ -147,7 +147,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
147 var xe = r2.exponent;147 var xe = r2.exponent;
148 var x1 = r2.significand;148 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));
151 while (i != 0) : (i >>= 1) {151 while (i != 0) : (i >>= 1) {
152 const overflow_shift = math.floatExponentBits(T) + 1;152 const overflow_shift = math.floatExponentBits(T) + 1;
153 if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) {153 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)...@@ -1777,7 +1777,7 @@ pub fn readVarInt(comptime ReturnType: type, bytes: []const u8, endian: Endian)
1777 assert(@typeInfo(ReturnType).int.bits >= bytes.len * 8);1777 assert(@typeInfo(ReturnType).int.bits >= bytes.len * 8);
1778 const bits = @typeInfo(ReturnType).int.bits;1778 const bits = @typeInfo(ReturnType).int.bits;
1779 const signedness = @typeInfo(ReturnType).int.signedness;1779 const signedness = @typeInfo(ReturnType).int.signedness;
1780 const WorkType = std.meta.Int(signedness, @max(16, bits));1780 const WorkType = @Int(signedness, @max(16, bits));
1781 var result: WorkType = 0;1781 var result: WorkType = 0;
1782 switch (endian) {1782 switch (endian) {
1783 .big => {1783 .big => {
...@@ -1828,8 +1828,8 @@ pub fn readVarPackedInt(...@@ -1828,8 +1828,8 @@ pub fn readVarPackedInt(
1828 endian: std.builtin.Endian,1828 endian: std.builtin.Endian,
1829 signedness: std.builtin.Signedness,1829 signedness: std.builtin.Signedness,
1830) T {1830) T {
1831 const uN = std.meta.Int(.unsigned, @bitSizeOf(T));1831 const uN = @Int(.unsigned, @bitSizeOf(T));
1832 const iN = std.meta.Int(.signed, @bitSizeOf(T));1832 const iN = @Int(.signed, @bitSizeOf(T));
1833 const Log2N = std.math.Log2Int(T);1833 const Log2N = std.math.Log2Int(T);
18341834
1835 const read_size = (bit_count + (bit_offset % 8) + 7) / 8;1835 const read_size = (bit_count + (bit_offset % 8) + 7) / 8;
...@@ -1921,7 +1921,7 @@ test readInt {...@@ -1921,7 +1921,7 @@ test readInt {
1921}1921}
19221922
1923fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T {1923fn 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));
1925 const Log2N = std.math.Log2Int(T);1925 const Log2N = std.math.Log2Int(T);
19261926
1927 const bit_count = @as(usize, @bitSizeOf(T));1927 const bit_count = @as(usize, @bitSizeOf(T));
...@@ -1929,7 +1929,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T...@@ -1929,7 +1929,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T
19291929
1930 const load_size = (bit_count + 7) / 8;1930 const load_size = (bit_count + 7) / 8;
1931 const load_tail_bits = @as(u3, @intCast((load_size * 8) - bit_count));1931 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
1934 if (bit_count == 0)1934 if (bit_count == 0)
1935 return 0;1935 return 0;
...@@ -1947,7 +1947,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T...@@ -1947,7 +1947,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T
1947}1947}
19481948
1949fn readPackedIntBig(comptime T: type, bytes: []const u8, bit_offset: usize) T {1949fn 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));
1951 const Log2N = std.math.Log2Int(T);1951 const Log2N = std.math.Log2Int(T);
19521952
1953 const bit_count = @as(usize, @bitSizeOf(T));1953 const bit_count = @as(usize, @bitSizeOf(T));
...@@ -1956,7 +1956,7 @@ fn readPackedIntBig(comptime T: type, bytes: []const u8, bit_offset: usize) T {...@@ -1956,7 +1956,7 @@ fn readPackedIntBig(comptime T: type, bytes: []const u8, bit_offset: usize) T {
19561956
1957 const load_size = (bit_count + 7) / 8;1957 const load_size = (bit_count + 7) / 8;
1958 const load_tail_bits = @as(u3, @intCast((load_size * 8) - bit_count));1958 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
1961 if (bit_count == 0)1961 if (bit_count == 0)
1962 return 0;1962 return 0;
...@@ -2061,7 +2061,7 @@ test writeInt {...@@ -2061,7 +2061,7 @@ test writeInt {
2061}2061}
20622062
2063fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {2063fn 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));
2065 const Log2N = std.math.Log2Int(T);2065 const Log2N = std.math.Log2Int(T);
20662066
2067 const bit_count = @as(usize, @bitSizeOf(T));2067 const bit_count = @as(usize, @bitSizeOf(T));
...@@ -2069,7 +2069,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value:...@@ -2069,7 +2069,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value:
20692069
2070 const store_size = (@bitSizeOf(T) + 7) / 8;2070 const store_size = (@bitSizeOf(T) + 7) / 8;
2071 const store_tail_bits = @as(u3, @intCast((store_size * 8) - bit_count));2071 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
2074 if (bit_count == 0)2074 if (bit_count == 0)
2075 return;2075 return;
...@@ -2094,7 +2094,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value:...@@ -2094,7 +2094,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value:
2094}2094}
20952095
2096fn writePackedIntBig(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {2096fn 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));
2098 const Log2N = std.math.Log2Int(T);2098 const Log2N = std.math.Log2Int(T);
20992099
2100 const bit_count = @as(usize, @bitSizeOf(T));2100 const bit_count = @as(usize, @bitSizeOf(T));
...@@ -2103,7 +2103,7 @@ fn writePackedIntBig(comptime T: type, bytes: []u8, bit_offset: usize, value: T)...@@ -2103,7 +2103,7 @@ fn writePackedIntBig(comptime T: type, bytes: []u8, bit_offset: usize, value: T)
21032103
2104 const store_size = (@bitSizeOf(T) + 7) / 8;2104 const store_size = (@bitSizeOf(T) + 7) / 8;
2105 const store_tail_bits = @as(u3, @intCast((store_size * 8) - bit_count));2105 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
2108 if (bit_count == 0)2108 if (bit_count == 0)
2109 return;2109 return;
...@@ -2160,7 +2160,7 @@ test writePackedInt {...@@ -2160,7 +2160,7 @@ test writePackedInt {
2160/// If negative, the written value is sign-extended.2160/// If negative, the written value is sign-extended.
2161pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value: anytype, endian: std.builtin.Endian) void {2161pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value: anytype, endian: std.builtin.Endian) void {
2162 const T = @TypeOf(value);2162 const T = @TypeOf(value);
2163 const uN = std.meta.Int(.unsigned, @bitSizeOf(T));2163 const uN = @Int(.unsigned, @bitSizeOf(T));
21642164
2165 const bit_shift = @as(u3, @intCast(bit_offset % 8));2165 const bit_shift = @as(u3, @intCast(bit_offset % 8));
2166 const write_size = (bit_count + bit_shift + 7) / 8;2166 const write_size = (bit_count + bit_shift + 7) / 8;
...@@ -2242,7 +2242,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a...@@ -2242,7 +2242,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a
2242 },2242 },
2243 .bool => {},2243 .bool => {},
2244 .float => |float_info| {2244 .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)))));
2246 },2246 },
2247 else => {2247 else => {
2248 @field(ptr, f.name) = @byteSwap(@field(ptr, f.name));2248 @field(ptr, f.name) = @byteSwap(@field(ptr, f.name));
...@@ -2262,7 +2262,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a...@@ -2262,7 +2262,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a
2262 }2262 }
2263 }2263 }
22642264
2265 const BackingInt = std.meta.Int(.unsigned, @bitSizeOf(S));2265 const BackingInt = @Int(.unsigned, @bitSizeOf(S));
2266 ptr.* = @bitCast(@byteSwap(@as(BackingInt, @bitCast(ptr.*))));2266 ptr.* = @bitCast(@byteSwap(@as(BackingInt, @bitCast(ptr.*))));
2267 },2267 },
2268 .array => |info| {2268 .array => |info| {
...@@ -2370,7 +2370,7 @@ pub fn byteSwapAllElements(comptime Elem: type, slice: []Elem) void {...@@ -2370,7 +2370,7 @@ pub fn byteSwapAllElements(comptime Elem: type, slice: []Elem) void {
2370 },2370 },
2371 .bool => {},2371 .bool => {},
2372 .float => |float_info| {2372 .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.*))));
2374 },2374 },
2375 else => {2375 else => {
2376 elem.* = @byteSwap(elem.*);2376 elem.* = @byteSwap(elem.*);
...@@ -4800,7 +4800,7 @@ pub fn doNotOptimizeAway(val: anytype) void {...@@ -4800,7 +4800,7 @@ pub fn doNotOptimizeAway(val: anytype) void {
4800 const bits = t.int.bits;4800 const bits = t.int.bits;
4801 if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) {4801 if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) {
4802 const val2 = @as(4802 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))),
4804 val,4804 val,
4805 );4805 );
4806 asm volatile (""4806 asm volatile (""
...@@ -5035,8 +5035,8 @@ test "read/write(Var)PackedInt" {...@@ -5035,8 +5035,8 @@ test "read/write(Var)PackedInt" {
5035 if (@bitSizeOf(PackedType) > @bitSizeOf(BackingType))5035 if (@bitSizeOf(PackedType) > @bitSizeOf(BackingType))
5036 continue;5036 continue;
50375037
5038 const iPackedType = std.meta.Int(.signed, @bitSizeOf(PackedType));5038 const iPackedType = @Int(.signed, @bitSizeOf(PackedType));
5039 const uPackedType = std.meta.Int(.unsigned, @bitSizeOf(PackedType));5039 const uPackedType = @Int(.unsigned, @bitSizeOf(PackedType));
5040 const Log2T = std.math.Log2Int(BackingType);5040 const Log2T = std.math.Log2Int(BackingType);
50415041
5042 const offset_at_end = @bitSizeOf(BackingType) - @bitSizeOf(PackedType);5042 const offset_at_end = @bitSizeOf(BackingType) - @bitSizeOf(PackedType);
...@@ -5103,8 +5103,8 @@ test "read/write(Var)PackedInt" {...@@ -5103,8 +5103,8 @@ test "read/write(Var)PackedInt" {
5103 }5103 }
51045104
5105 const signedness = @typeInfo(PackedType).int.signedness;5105 const signedness = @typeInfo(PackedType).int.signedness;
5106 const NextPowerOfTwoInt = std.meta.Int(signedness, try comptime std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType)));5106 const NextPowerOfTwoInt = @Int(signedness, try std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType)));
5107 const ui64 = std.meta.Int(signedness, 64);5107 const ui64 = @Int(signedness, 64);
5108 inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| {5108 inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| {
5109 { // Variable-size Read/Write (Native-endian)5109 { // Variable-size Read/Write (Native-endian)
51105110
lib/std/meta.zig+3-35
...@@ -751,11 +751,6 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int {...@@ -751,11 +751,6 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int {
751 return null;751 return null;
752}752}
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
759pub fn Float(comptime bit_count: u8) type {754pub fn Float(comptime bit_count: u8) type {
760 return switch (bit_count) {755 return switch (bit_count) {
761 16 => f16,756 16 => f16,
...@@ -796,14 +791,7 @@ pub fn ArgsTuple(comptime Function: type) type {...@@ -796,14 +791,7 @@ pub fn ArgsTuple(comptime Function: type) type {
796 argument_field_list[i] = T;791 argument_field_list[i] = T;
797 }792 }
798793
799 return Tuple(&argument_field_list);794 return @Tuple(&argument_field_list);
800}
801
802/// Deprecated; use `@Tuple` instead.
803///
804/// To be removed after Zig 0.16.0 releases.
805pub fn Tuple(comptime types: []const type) type {
806 return @Tuple(types);
807}795}
808796
809const TupleTester = struct {797const TupleTester = struct {
...@@ -839,33 +827,13 @@ test ArgsTuple {...@@ -839,33 +827,13 @@ test ArgsTuple {
839 TupleTester.assertTuple(.{u32}, ArgsTuple(fn (comptime a: u32) []const u8));827 TupleTester.assertTuple(.{u32}, ArgsTuple(fn (comptime a: u32) []const u8));
840}828}
841829
842test Tuple {
843 TupleTester.assertTuple(.{}, Tuple(&[_]type{}));
844 TupleTester.assertTuple(.{u32}, Tuple(&[_]type{u32}));
845 TupleTester.assertTuple(.{ u32, f16 }, Tuple(&[_]type{ u32, f16 }));
846 TupleTester.assertTuple(.{ u32, f16, []const u8, void }, Tuple(&[_]type{ u32, f16, []const u8, void }));
847}
848
849test "Tuple deduplication" {
850 const T1 = std.meta.Tuple(&.{ u32, f32, i8 });
851 const T2 = std.meta.Tuple(&.{ u32, f32, i8 });
852 const T3 = std.meta.Tuple(&.{ u32, f32, i7 });
853
854 if (T1 != T2) {
855 @compileError("std.meta.Tuple doesn't deduplicate tuple types.");
856 }
857 if (T1 == T3) {
858 @compileError("std.meta.Tuple fails to generate different types.");
859 }
860}
861
862test "ArgsTuple forwarding" {830test "ArgsTuple forwarding" {
863 const T1 = std.meta.Tuple(&.{ u32, f32, i8 });831 const T1 = @Tuple(&.{ u32, f32, i8 });
864 const T2 = std.meta.ArgsTuple(fn (u32, f32, i8) void);832 const T2 = std.meta.ArgsTuple(fn (u32, f32, i8) void);
865 const T3 = std.meta.ArgsTuple(fn (u32, f32, i8) callconv(.c) noreturn);833 const T3 = std.meta.ArgsTuple(fn (u32, f32, i8) callconv(.c) noreturn);
866834
867 if (T1 != T2) {835 if (T1 != T2) {
868 @compileError("std.meta.ArgsTuple produces different types than std.meta.Tuple");836 @compileError("std.meta.ArgsTuple produces different types than @Tuple");
869 }837 }
870 if (T1 != T3) {838 if (T1 != T3) {
871 @compileError("std.meta.ArgsTuple produces different types for the same argument lists.");839 @compileError("std.meta.ArgsTuple produces different types for the same argument lists.");
lib/std/meta/trailer_flags.zig+1-1
...@@ -13,7 +13,7 @@ pub fn TrailerFlags(comptime Fields: type) type {...@@ -13,7 +13,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
13 return struct {13 return struct {
14 bits: Int,14 bits: Int,
1515
16 pub const Int = meta.Int(.unsigned, bit_count);16 pub const Int = @Int(.unsigned, bit_count);
17 pub const bit_count = @typeInfo(Fields).@"struct".fields.len;17 pub const bit_count = @typeInfo(Fields).@"struct".fields.len;
1818
19 pub const FieldEnum = std.meta.FieldEnum(Fields);19 pub const FieldEnum = std.meta.FieldEnum(Fields);
lib/std/os/emscripten.zig+1-1
...@@ -17,7 +17,7 @@ pub const CLOCK = linux.CLOCK;...@@ -17,7 +17,7 @@ pub const CLOCK = linux.CLOCK;
1717
18pub const CPU_SETSIZE = 128;18pub const CPU_SETSIZE = 128;
19pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize;19pub 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
22pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {22pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {
23 var sum: cpu_count_t = 0;23 var sum: cpu_count_t = 0;
lib/std/os/linux.zig+1-1
...@@ -6291,7 +6291,7 @@ pub const dl_phdr_info = extern struct {...@@ -6291,7 +6291,7 @@ pub const dl_phdr_info = extern struct {
62916291
6292pub const CPU_SETSIZE = 128;6292pub const CPU_SETSIZE = 128;
6293pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize;6293pub 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
6296pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {6296pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {
6297 var sum: cpu_count_t = 0;6297 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) {...@@ -15,12 +15,12 @@ const bits = switch (@import("builtin").cpu.arch) {
15 else => .{ .size = 14, .dir = 2, .none = 0, .read = 2, .write = 1 },15 else => .{ .size = 14, .dir = 2, .none = 0, .read = 2, .write = 1 },
16};16};
1717
18const Direction = std.meta.Int(.unsigned, bits.dir);18const Direction = @Int(.unsigned, bits.dir);
1919
20pub const Request = packed struct {20pub const Request = packed struct {
21 nr: u8,21 nr: u8,
22 io_type: u8,22 io_type: u8,
23 size: std.meta.Int(.unsigned, bits.size),23 size: @Int(.unsigned, bits.size),
24 dir: Direction,24 dir: Direction,
25};25};
2626
lib/std/os/uefi/tables/runtime_services.zig+1-1
...@@ -419,7 +419,7 @@ pub const RuntimeServices = extern struct {...@@ -419,7 +419,7 @@ pub const RuntimeServices = extern struct {
419 pub const DebugDisposition = enum(usize) {419 pub const DebugDisposition = enum(usize) {
420 const Bits = packed struct(usize) {420 const Bits = packed struct(usize) {
421 optional_ptr: bool = false,421 optional_ptr: bool = false,
422 _pad: std.meta.Int(.unsigned, @bitSizeOf(usize) - 1) = 0,422 _pad: @Int(.unsigned, @bitSizeOf(usize) - 1) = 0,
423 };423 };
424424
425 pointer = @bitCast(Bits{}),425 pointer = @bitCast(Bits{}),
lib/std/posix.zig+1-1
...@@ -803,7 +803,7 @@ pub fn dl_iterate_phdr(...@@ -803,7 +803,7 @@ pub fn dl_iterate_phdr(
803 }803 }
804 }.callbackC, @ptrCast(@constCast(&context)))) {804 }.callbackC, @ptrCast(@constCast(&context)))) {
805 0 => return,805 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))))),
807 }807 }
808 }808 }
809809
lib/std/testing.zig+1-1
...@@ -163,7 +163,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {...@@ -163,7 +163,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
163 }163 }
164 }164 }
165165
166 const BackingInt = std.meta.Int(.unsigned, @bitSizeOf(T));166 const BackingInt = @Int(.unsigned, @bitSizeOf(T));
167 return expectEqual(167 return expectEqual(
168 @as(BackingInt, @bitCast(expected)),168 @as(BackingInt, @bitCast(expected)),
169 @as(BackingInt, @bitCast(actual)),169 @as(BackingInt, @bitCast(actual)),
lib/std/zig/llvm/Builder.zig+3-3
...@@ -7657,9 +7657,9 @@ pub const Constant = enum(u32) {...@@ -7657,9 +7657,9 @@ pub const Constant = enum(u32) {
7657 .float => {7657 .float => {
7658 const Float = struct {7658 const Float = struct {
7659 fn Repr(comptime T: type) type {7659 fn Repr(comptime T: type) type {
7660 return packed struct(std.meta.Int(.unsigned, @bitSizeOf(T))) {7660 return packed struct(@Int(.unsigned, @bitSizeOf(T))) {
7661 mantissa: std.meta.Int(.unsigned, std.math.floatMantissaBits(T)),7661 mantissa: @Int(.unsigned, std.math.floatMantissaBits(T)),
7662 exponent: std.meta.Int(.unsigned, std.math.floatExponentBits(T)),7662 exponent: @Int(.unsigned, std.math.floatExponentBits(T)),
7663 sign: u1,7663 sign: u1,
7664 };7664 };
7665 }7665 }
lib/std/zig/llvm/bitcode_writer.zig+3-3
...@@ -404,7 +404,7 @@ fn charTo6Bit(c: u8) u8 {...@@ -404,7 +404,7 @@ fn charTo6Bit(c: u8) u8 {
404}404}
405405
406fn BufType(comptime T: type, comptime min_len: usize) type {406fn 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)) {
408 .comptime_int => u32,408 .comptime_int => u32,
409 .int => |info| if (info.signedness == .unsigned)409 .int => |info| if (info.signedness == .unsigned)
410 T410 T
...@@ -414,7 +414,7 @@ fn BufType(comptime T: type, comptime min_len: usize) type {...@@ -414,7 +414,7 @@ fn BufType(comptime T: type, comptime min_len: usize) type {
414 .bool => u1,414 .bool => u1,
415 .@"struct" => |info| switch (info.layout) {415 .@"struct" => |info| switch (info.layout) {
416 .auto, .@"extern" => @compileError("Unsupported type: " ++ @typeName(T)),416 .auto, .@"extern" => @compileError("Unsupported type: " ++ @typeName(T)),
417 .@"packed" => std.meta.Int(.unsigned, @bitSizeOf(T)),417 .@"packed" => @Int(.unsigned, @bitSizeOf(T)),
418 },418 },
419 else => @compileError("Unsupported type: " ++ @typeName(T)),419 else => @compileError("Unsupported type: " ++ @typeName(T)),
420 })));420 })));
...@@ -425,7 +425,7 @@ fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min...@@ -425,7 +425,7 @@ fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min
425 .comptime_int, .int => @intCast(value),425 .comptime_int, .int => @intCast(value),
426 .@"enum" => @intFromEnum(value),426 .@"enum" => @intFromEnum(value),
427 .bool => @intFromBool(value),427 .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))),
429 else => unreachable,429 else => unreachable,
430 };430 };
431}431}
lib/std/zig/llvm/ir.zig+8-8
...@@ -235,7 +235,7 @@ pub const ModuleBlock = struct {...@@ -235,7 +235,7 @@ pub const ModuleBlock = struct {
235 is_const: AddrSpaceAndIsConst,235 is_const: AddrSpaceAndIsConst,
236 initid: u32,236 initid: u32,
237 linkage: Builder.Linkage,237 linkage: Builder.Linkage,
238 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),238 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
239 section: usize,239 section: usize,
240 visibility: Builder.Visibility,240 visibility: Builder.Visibility,
241 thread_local: Builder.ThreadLocal,241 thread_local: Builder.ThreadLocal,
...@@ -275,7 +275,7 @@ pub const ModuleBlock = struct {...@@ -275,7 +275,7 @@ pub const ModuleBlock = struct {
275 is_proto: bool,275 is_proto: bool,
276 linkage: Builder.Linkage,276 linkage: Builder.Linkage,
277 paramattr: usize,277 paramattr: usize,
278 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),278 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
279 section: usize,279 section: usize,
280 visibility: Builder.Visibility,280 visibility: Builder.Visibility,
281 unnamed_addr: Builder.UnnamedAddr,281 unnamed_addr: Builder.UnnamedAddr,
...@@ -1214,7 +1214,7 @@ pub const ModuleBlock = struct {...@@ -1214,7 +1214,7 @@ pub const ModuleBlock = struct {
1214 };1214 };
1215 ptr: u32,1215 ptr: u32,
1216 ty: Builder.Type,1216 ty: Builder.Type,
1217 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),1217 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1218 is_volatile: bool,1218 is_volatile: bool,
1219 };1219 };
12201220
...@@ -1230,7 +1230,7 @@ pub const ModuleBlock = struct {...@@ -1230,7 +1230,7 @@ pub const ModuleBlock = struct {
1230 };1230 };
1231 ptr: u32,1231 ptr: u32,
1232 ty: Builder.Type,1232 ty: Builder.Type,
1233 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),1233 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1234 is_volatile: bool,1234 is_volatile: bool,
1235 success_ordering: Builder.AtomicOrdering,1235 success_ordering: Builder.AtomicOrdering,
1236 sync_scope: Builder.SyncScope,1236 sync_scope: Builder.SyncScope,
...@@ -1246,7 +1246,7 @@ pub const ModuleBlock = struct {...@@ -1246,7 +1246,7 @@ pub const ModuleBlock = struct {
1246 };1246 };
1247 ptr: u32,1247 ptr: u32,
1248 val: u32,1248 val: u32,
1249 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),1249 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1250 is_volatile: bool,1250 is_volatile: bool,
1251 };1251 };
12521252
...@@ -1262,7 +1262,7 @@ pub const ModuleBlock = struct {...@@ -1262,7 +1262,7 @@ pub const ModuleBlock = struct {
1262 };1262 };
1263 ptr: u32,1263 ptr: u32,
1264 val: u32,1264 val: u32,
1265 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),1265 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1266 is_volatile: bool,1266 is_volatile: bool,
1267 success_ordering: Builder.AtomicOrdering,1267 success_ordering: Builder.AtomicOrdering,
1268 sync_scope: Builder.SyncScope,1268 sync_scope: Builder.SyncScope,
...@@ -1317,7 +1317,7 @@ pub const ModuleBlock = struct {...@@ -1317,7 +1317,7 @@ pub const ModuleBlock = struct {
1317 is_volatile: bool,1317 is_volatile: bool,
1318 success_ordering: Builder.AtomicOrdering,1318 success_ordering: Builder.AtomicOrdering,
1319 sync_scope: Builder.SyncScope,1319 sync_scope: Builder.SyncScope,
1320 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),1320 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1321 };1321 };
13221322
1323 pub const CmpXchg = struct {1323 pub const CmpXchg = struct {
...@@ -1341,7 +1341,7 @@ pub const ModuleBlock = struct {...@@ -1341,7 +1341,7 @@ pub const ModuleBlock = struct {
1341 sync_scope: Builder.SyncScope,1341 sync_scope: Builder.SyncScope,
1342 failure_ordering: Builder.AtomicOrdering,1342 failure_ordering: Builder.AtomicOrdering,
1343 is_weak: bool,1343 is_weak: bool,
1344 alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)),1344 alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
1345 };1345 };
13461346
1347 pub const Fence = struct {1347 pub const Fence = struct {
src/Air/Liveness.zig+1-1
...@@ -301,7 +301,7 @@ pub fn iterateBigTomb(l: Liveness, inst: Air.Inst.Index) BigTomb {...@@ -301,7 +301,7 @@ pub fn iterateBigTomb(l: Liveness, inst: Air.Inst.Index) BigTomb {
301301
302/// How many tomb bits per AIR instruction.302/// How many tomb bits per AIR instruction.
303pub const bpi = 4;303pub const bpi = 4;
304pub const Bpi = std.meta.Int(.unsigned, bpi);304pub const Bpi = @Int(.unsigned, bpi);
305pub const OperandInt = std.math.Log2Int(Bpi);305pub const OperandInt = std.math.Log2Int(Bpi);
306306
307/// Useful for decoders of Liveness information.307/// Useful for decoders of Liveness information.
src/InternPool.zig+2-2
...@@ -2660,7 +2660,7 @@ pub const Key = union(enum) {...@@ -2660,7 +2660,7 @@ pub const Key = union(enum) {
2660 switch (float.storage) {2660 switch (float.storage) {
2661 inline else => |val| std.hash.autoHash(2661 inline else => |val| std.hash.autoHash(
2662 &hasher,2662 &hasher,
2663 @as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(val))), @bitCast(val)),2663 @as(@Int(.unsigned, @bitSizeOf(@TypeOf(val))), @bitCast(val)),
2664 ),2664 ),
2665 }2665 }
2666 return hasher.final();2666 return hasher.final();
...@@ -3012,7 +3012,7 @@ pub const Key = union(enum) {...@@ -3012,7 +3012,7 @@ pub const Key = union(enum) {
30123012
3013 switch (a_info.storage) {3013 switch (a_info.storage) {
3014 inline else => |val, tag| {3014 inline else => |val, tag| {
3015 const Bits = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(val)));3015 const Bits = @Int(.unsigned, @bitSizeOf(@TypeOf(val)));
3016 const a_bits: Bits = @bitCast(val);3016 const a_bits: Bits = @bitCast(val);
3017 const b_bits: Bits = @bitCast(@field(b_info.storage, @tagName(tag)));3017 const b_bits: Bits = @bitCast(@field(b_info.storage, @tagName(tag)));
3018 return a_bits == b_bits;3018 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...@@ -7221,7 +7221,7 @@ fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Alt(FormatStringCont
72217221
7222fn undefPattern(comptime IntType: type) IntType {7222fn undefPattern(comptime IntType: type) IntType {
7223 const int_info = @typeInfo(IntType).int;7223 const int_info = @typeInfo(IntType).int;
7224 const UnsignedType = std.meta.Int(.unsigned, int_info.bits);7224 const UnsignedType = @Int(.unsigned, int_info.bits);
7225 return @bitCast(@as(UnsignedType, (1 << (int_info.bits | 1)) / 3));7225 return @bitCast(@as(UnsignedType, (1 << (int_info.bits | 1)) / 3));
7226}7226}
72277227
src/codegen/riscv64/bits.zig+1-1
...@@ -118,7 +118,7 @@ pub const Immediate = union(enum) {...@@ -118,7 +118,7 @@ pub const Immediate = union(enum) {
118 const int_info = @typeInfo(T).int;118 const int_info = @typeInfo(T).int;
119 if (int_info.signedness != .unsigned) @compileError("Immediate.asBits needs unsigned T");119 if (int_info.signedness != .unsigned) @compileError("Immediate.asBits needs unsigned T");
120 return switch (imm) {120 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))),
122 .unsigned => |x| @intCast(x),122 .unsigned => |x| @intCast(x),
123 };123 };
124 }124 }
src/codegen/spirv/Assembler.zig+1-1
...@@ -821,7 +821,7 @@ fn parseContextDependentFloat(ass: *Assembler, comptime width: u16) !void {...@@ -821,7 +821,7 @@ fn parseContextDependentFloat(ass: *Assembler, comptime width: u16) !void {
821 const gpa = ass.cg.module.gpa;821 const gpa = ass.cg.module.gpa;
822822
823 const Float = std.meta.Float(width);823 const Float = std.meta.Float(width);
824 const Int = std.meta.Int(.unsigned, width);824 const Int = @Int(.unsigned, width);
825825
826 const tok = ass.currentToken();826 const tok = ass.currentToken();
827 try ass.expectToken(.value);827 try ass.expectToken(.value);
src/codegen/spirv/Section.zig+1-1
...@@ -8,7 +8,7 @@ const testing = std.testing;...@@ -8,7 +8,7 @@ const testing = std.testing;
88
9const spec = @import("spec.zig");9const spec = @import("spec.zig");
10const Word = spec.Word;10const Word = spec.Word;
11const DoubleWord = std.meta.Int(.unsigned, @bitSizeOf(Word) * 2);11const DoubleWord = @Int(.unsigned, @bitSizeOf(Word) * 2);
12const Log2Word = std.math.Log2Int(Word);12const Log2Word = std.math.Log2Int(Word);
1313
14const Opcode = spec.Opcode;14const Opcode = spec.Opcode;
test/behavior/abs.zig+1-1
...@@ -155,7 +155,7 @@ test "@abs big int <= 128 bits" {...@@ -155,7 +155,7 @@ test "@abs big int <= 128 bits" {
155 try testAbsUnsignedBigInt();155 try testAbsUnsignedBigInt();
156}156}
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) {
159 return @abs(a);159 return @abs(a);
160}160}
161161
test/behavior/atomics.zig+3-3
...@@ -232,7 +232,7 @@ fn testAtomicRmwInts() !void {...@@ -232,7 +232,7 @@ fn testAtomicRmwInts() !void {
232}232}
233233
234fn testAtomicRmwInt(comptime signedness: std.builtin.Signedness, comptime N: usize) !void {234fn 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
237 var x: int = 1;237 var x: int = 1;
238 var res = @atomicRmw(int, &x, .Xchg, 3, .seq_cst);238 var res = @atomicRmw(int, &x, .Xchg, 3, .seq_cst);
...@@ -293,8 +293,8 @@ test "atomicrmw with 128-bit ints" {...@@ -293,8 +293,8 @@ test "atomicrmw with 128-bit ints" {
293}293}
294294
295fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void {295fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void {
296 const uint = std.meta.Int(.unsigned, 128);296 const uint = @Int(.unsigned, 128);
297 const int = std.meta.Int(signedness, 128);297 const int = @Int(signedness, 128);
298298
299 const initial: int = @as(int, @bitCast(@as(uint, 0xaaaaaaaa_bbbbbbbb_cccccccc_dddddddd)));299 const initial: int = @as(int, @bitCast(@as(uint, 0xaaaaaaaa_bbbbbbbb_cccccccc_dddddddd)));
300 const replacement: int = 0x00000000_00000005_00000000_00000003;300 const replacement: int = 0x00000000_00000005_00000000_00000003;
test/behavior/bit_shifting.zig+2-2
...@@ -5,10 +5,10 @@ const builtin = @import("builtin");...@@ -5,10 +5,10 @@ const builtin = @import("builtin");
55
6fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type {6fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type {
7 const key_bits = @typeInfo(Key).int.bits;7 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));
9 std.debug.assert(key_bits >= mask_bit_count);9 std.debug.assert(key_bits >= mask_bit_count);
10 const shard_key_bits = mask_bit_count;10 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);
12 const shift_amount = key_bits - shard_key_bits;12 const shift_amount = key_bits - shard_key_bits;
13 return struct {13 return struct {
14 const Self = @This();14 const Self = @This();
test/behavior/bitcast.zig+7-7
...@@ -49,8 +49,8 @@ test "@bitCast iX -> uX exotic integers" {...@@ -49,8 +49,8 @@ test "@bitCast iX -> uX exotic integers" {
49}49}
5050
51fn testBitCast(comptime N: usize) !void {51fn testBitCast(comptime N: usize) !void {
52 const iN = std.meta.Int(.signed, N);52 const iN = @Int(.signed, N);
53 const uN = std.meta.Int(.unsigned, N);53 const uN = @Int(.unsigned, N);
5454
55 try expect(conv_iN(N, -1) == maxInt(uN));55 try expect(conv_iN(N, -1) == maxInt(uN));
56 try expect(conv_uN(N, maxInt(uN)) == -1);56 try expect(conv_uN(N, maxInt(uN)) == -1);
...@@ -69,12 +69,12 @@ fn testBitCast(comptime N: usize) !void {...@@ -69,12 +69,12 @@ fn testBitCast(comptime N: usize) !void {
69 }69 }
70}70}
7171
72fn conv_iN(comptime N: usize, x: std.meta.Int(.signed, N)) std.meta.Int(.unsigned, N) {72fn conv_iN(comptime N: usize, x: @Int(.signed, N)) @Int(.unsigned, N) {
73 return @as(std.meta.Int(.unsigned, N), @bitCast(x));73 return @as(@Int(.unsigned, N), @bitCast(x));
74}74}
7575
76fn conv_uN(comptime N: usize, x: std.meta.Int(.unsigned, N)) std.meta.Int(.signed, N) {76fn conv_uN(comptime N: usize, x: @Int(.unsigned, N)) @Int(.signed, N) {
77 return @as(std.meta.Int(.signed, N), @bitCast(x));77 return @as(@Int(.signed, N), @bitCast(x));
78}78}
7979
80test "bitcast uX to bytes" {80test "bitcast uX to bytes" {
...@@ -101,7 +101,7 @@ fn testBitCastuXToBytes(comptime N: usize) !void {...@@ -101,7 +101,7 @@ fn testBitCastuXToBytes(comptime N: usize) !void {
101 // on the platforms we target. If the above behavior is restricted after all,101 // on the platforms we target. If the above behavior is restricted after all,
102 // this test should be deleted.102 // this test should be deleted.
103103
104 const T = std.meta.Int(.unsigned, N);104 const T = @Int(.unsigned, N);
105 for ([_]T{ 0, ~@as(T, 0) }) |init_value| {105 for ([_]T{ 0, ~@as(T, 0) }) |init_value| {
106 var x: T = init_value;106 var x: T = init_value;
107 const bytes = std.mem.asBytes(&x);107 const bytes = std.mem.asBytes(&x);
test/behavior/math.zig+1-1
...@@ -2359,7 +2359,7 @@ test "signed zeros are represented properly" {...@@ -2359,7 +2359,7 @@ test "signed zeros are represented properly" {
2359 }2359 }
23602360
2361 fn testOne(comptime T: type) !void {2361 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);
2363 var as_fp_val = -@as(T, 0.0);2363 var as_fp_val = -@as(T, 0.0);
2364 _ = &as_fp_val;2364 _ = &as_fp_val;
2365 const as_uint_val: ST = @bitCast(as_fp_val);2365 const as_uint_val: ST = @bitCast(as_fp_val);
test/behavior/tuple.zig+4-4
...@@ -233,7 +233,7 @@ test "tuple in tuple passed to generic function" {...@@ -233,7 +233,7 @@ test "tuple in tuple passed to generic function" {
233 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;233 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
234234
235 const S = struct {235 const S = struct {
236 fn pair(x: f32, y: f32) std.meta.Tuple(&.{ f32, f32 }) {236 fn pair(x: f32, y: f32) @Tuple(&.{ f32, f32 }) {
237 return .{ x, y };237 return .{ x, y };
238 }238 }
239239
...@@ -251,7 +251,7 @@ test "coerce tuple to tuple" {...@@ -251,7 +251,7 @@ test "coerce tuple to tuple" {
251 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO251 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
252 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;252 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
253253
254 const T = std.meta.Tuple(&.{u8});254 const T = @Tuple(&.{u8});
255 const S = struct {255 const S = struct {
256 fn foo(x: T) !void {256 fn foo(x: T) !void {
257 try expect(x[0] == 123);257 try expect(x[0] == 123);
...@@ -265,7 +265,7 @@ test "tuple type with void field" {...@@ -265,7 +265,7 @@ test "tuple type with void field" {
265 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO265 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
266 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;266 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
267267
268 const T = std.meta.Tuple(&[_]type{void});268 const T = @Tuple(&.{void});
269 const x = T{{}};269 const x = T{{}};
270 try expect(@TypeOf(x[0]) == void);270 try expect(@TypeOf(x[0]) == void);
271}271}
...@@ -290,7 +290,7 @@ test "tuple type with void field and a runtime field" {...@@ -290,7 +290,7 @@ test "tuple type with void field and a runtime field" {
290 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO290 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
291 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;291 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
292292
293 const T = std.meta.Tuple(&[_]type{ usize, void });293 const T = @Tuple(&.{ usize, void });
294 var t: T = .{ 5, {} };294 var t: T = .{ 5, {} };
295 _ = &t;295 _ = &t;
296 try expect(t[0] == 5);296 try expect(t[0] == 5);