From 991f56fd6b23db0e6a6c78cac8ad62e869a39711 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 3 May 2026 20:50:09 +0100 Subject: [PATCH] std.meta: Remove Int in favor of @Int --- lib/compiler/resinator/errors.zig | 14 ++++---- lib/compiler_rt.zig | 8 ++--- lib/compiler_rt/addf3.zig | 2 +- lib/compiler_rt/comparef.zig | 6 ++-- lib/compiler_rt/count0bits.zig | 2 +- lib/compiler_rt/divdf3.zig | 4 +-- lib/compiler_rt/divsf3.zig | 2 +- lib/compiler_rt/divtf3.zig | 2 +- lib/compiler_rt/divxf3.zig | 2 +- lib/compiler_rt/extendf.zig | 10 +++--- lib/compiler_rt/fabs.zig | 2 +- lib/compiler_rt/float_from_int.zig | 7 ++-- lib/compiler_rt/fmax.zig | 2 +- lib/compiler_rt/fmin.zig | 2 +- lib/compiler_rt/fmod.zig | 4 +-- lib/compiler_rt/mulf3.zig | 4 +-- lib/compiler_rt/truncf.zig | 6 ++-- lib/std/Build/abi.zig | 2 +- lib/std/Io/Threaded.zig | 2 +- lib/std/Io/Writer.zig | 4 +-- lib/std/Random.zig | 12 +++---- lib/std/Target.zig | 2 +- lib/std/bit_set.zig | 6 ++-- lib/std/c.zig | 10 +++--- lib/std/compress/zstd/Decompress.zig | 10 +++--- lib/std/crypto/aes_ccm.zig | 4 +-- lib/std/crypto/cmac.zig | 2 +- lib/std/crypto/codecs/asn1/der/Encoder.zig | 2 +- lib/std/crypto/ff.zig | 5 ++- lib/std/crypto/keccak_p.zig | 2 +- lib/std/crypto/ml_dsa.zig | 12 +++---- lib/std/crypto/ml_kem.zig | 12 +++---- lib/std/crypto/modes.zig | 2 +- lib/std/crypto/pcurves/common.zig | 9 +++-- lib/std/crypto/timing_safe.zig | 10 +++--- lib/std/enums.zig | 10 +++--- lib/std/fmt.zig | 2 +- lib/std/fmt/parse_float.zig | 2 +- lib/std/hash/wyhash.zig | 2 +- lib/std/heap/debug_allocator.zig | 2 +- lib/std/leb128.zig | 4 +-- lib/std/math.zig | 16 ++++----- lib/std/math/big.zig | 8 ++--- lib/std/math/big/int.zig | 4 +-- lib/std/math/big/int_test.zig | 4 +-- lib/std/math/copysign.zig | 2 +- lib/std/math/frexp.zig | 8 ++--- lib/std/math/ilogb.zig | 2 +- lib/std/math/isfinite.zig | 2 +- lib/std/math/isinf.zig | 2 +- lib/std/math/isnan.zig | 3 +- lib/std/math/isnormal.zig | 4 +-- lib/std/math/iszero.zig | 4 +-- lib/std/math/ldexp.zig | 4 +-- lib/std/math/nextafter.zig | 4 +-- lib/std/math/pow.zig | 2 +- lib/std/mem.zig | 40 ++++++++++----------- lib/std/meta.zig | 5 --- lib/std/meta/trailer_flags.zig | 2 +- lib/std/os/emscripten.zig | 2 +- lib/std/os/linux.zig | 2 +- lib/std/os/linux/ioctl.zig | 4 +-- lib/std/os/uefi/tables/runtime_services.zig | 2 +- lib/std/posix.zig | 2 +- lib/std/testing.zig | 2 +- lib/std/zig/llvm/Builder.zig | 6 ++-- lib/std/zig/llvm/bitcode_writer.zig | 6 ++-- lib/std/zig/llvm/ir.zig | 16 ++++----- src/Air/Liveness.zig | 2 +- src/InternPool.zig | 4 +-- src/codegen/c.zig | 2 +- src/codegen/riscv64/bits.zig | 2 +- src/codegen/spirv/Assembler.zig | 2 +- src/codegen/spirv/Section.zig | 2 +- test/behavior/abs.zig | 2 +- test/behavior/atomics.zig | 6 ++-- test/behavior/bit_shifting.zig | 4 +-- test/behavior/bitcast.zig | 14 ++++---- test/behavior/math.zig | 2 +- 79 files changed, 200 insertions(+), 209 deletions(-) diff --git a/lib/compiler/resinator/errors.zig b/lib/compiler/resinator/errors.zig index 9270cc74b8ff7d4a092be9bbdf30a12c4c670a1e..d4b6e25d2f19c0f99d5757e9bff228b70bcf3213 100644 --- a/lib/compiler/resinator/errors.zig +++ b/lib/compiler/resinator/errors.zig @@ -43,7 +43,7 @@ pub const Diagnostics = struct { try self.errors.append(self.allocator, error_details); } - const SmallestStringIndexType = std.meta.Int(.unsigned, @min( + const SmallestStringIndexType = @Int(.unsigned, @min( @bitSizeOf(ErrorDetails.FileOpenError.FilenameStringIndex), @min( @bitSizeOf(ErrorDetails.IconReadError.FilenameStringIndex), @@ -165,7 +165,7 @@ pub const ErrorDetails = struct { err: FileOpenErrorEnum, filename_string_index: FilenameStringIndex, - pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(FileOpenErrorEnum)); + pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(FileOpenErrorEnum)); pub const FileOpenErrorEnum = std.meta.FieldEnum(Io.File.OpenError || Io.File.StatError); pub fn enumFromError(err: (Io.File.OpenError || Io.File.StatError)) FileOpenErrorEnum { @@ -180,7 +180,7 @@ pub const ErrorDetails = struct { icon_type: enum(u1) { cursor, icon }, filename_string_index: FilenameStringIndex, - pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(IconReadErrorEnum) - 1); + pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(IconReadErrorEnum) - 1); pub const IconReadErrorEnum = std.meta.FieldEnum(ico.ReadError); pub fn enumFromError(err: ico.ReadError) IconReadErrorEnum { @@ -197,14 +197,14 @@ pub const ErrorDetails = struct { bitmap_version: ico.BitmapHeader.Version = .unknown, _: Padding = 0, - pub const Padding = std.meta.Int(.unsigned, 15 - @bitSizeOf(ico.BitmapHeader.Version) - @bitSizeOf(ico.ImageFormat)); + pub const Padding = @Int(.unsigned, 15 - @bitSizeOf(ico.BitmapHeader.Version) - @bitSizeOf(ico.ImageFormat)); }; pub const BitmapReadError = packed struct(u32) { err: BitmapReadErrorEnum, filename_string_index: FilenameStringIndex, - pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(BitmapReadErrorEnum)); + pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(BitmapReadErrorEnum)); pub const BitmapReadErrorEnum = std.meta.FieldEnum(bmp.ReadError); pub fn enumFromError(err: bmp.ReadError) BitmapReadErrorEnum { @@ -218,14 +218,14 @@ pub const ErrorDetails = struct { dib_version: ico.BitmapHeader.Version, filename_string_index: FilenameStringIndex, - pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(ico.BitmapHeader.Version)); + pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(ico.BitmapHeader.Version)); }; pub const AcceleratorError = packed struct(u32) { err: AcceleratorErrorEnum, _: Padding = 0, - pub const Padding = std.meta.Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum)); + pub const Padding = @Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum)); pub const AcceleratorErrorEnum = std.meta.FieldEnum(res.ParseAcceleratorKeyStringError); pub fn enumFromError(err: res.ParseAcceleratorKeyStringError) AcceleratorErrorEnum { diff --git a/lib/compiler_rt.zig b/lib/compiler_rt.zig index 9e62f047bb732cfd1f604df15ab9c1b721adc01b..04370b2fd86f6febda129b81a516173f3f8f6e1d 100644 --- a/lib/compiler_rt.zig +++ b/lib/compiler_rt.zig @@ -574,8 +574,8 @@ pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void { } } -pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 { - const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits); +pub fn normalize(comptime T: type, significand: *@Int(.unsigned, @typeInfo(T).float.bits)) i32 { + const Z = @Int(.unsigned, @typeInfo(T).float.bits); const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T); const shift = @clz(significand.*) - @clz(integerBit); @@ -625,8 +625,8 @@ fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 { pub fn HalveInt(comptime T: type, comptime signed_half: bool) type { return extern union { pub const bits = @divExact(@typeInfo(T).int.bits, 2); - pub const HalfTU = std.meta.Int(.unsigned, bits); - pub const HalfTS = std.meta.Int(.signed, bits); + pub const HalfTU = @Int(.unsigned, bits); + pub const HalfTS = @Int(.signed, bits); pub const HalfT = if (signed_half) HalfTS else HalfTU; all: T, diff --git a/lib/compiler_rt/addf3.zig b/lib/compiler_rt/addf3.zig index 91152735f445bbaa8abf459b17f9d597a1a030af..1e68c82f0fbcf3a4a28d4d9c0d877b997496d7a2 100644 --- a/lib/compiler_rt/addf3.zig +++ b/lib/compiler_rt/addf3.zig @@ -8,7 +8,7 @@ const normalize = compiler_rt.normalize; /// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/lib/builtins/fp_add_impl.inc pub inline fn addf3(comptime T: type, a: T, b: T) T { const bits = @typeInfo(T).float.bits; - const Z = std.meta.Int(.unsigned, bits); + const Z = @Int(.unsigned, bits); const typeWidth = bits; const significandBits = math.floatMantissaBits(T); diff --git a/lib/compiler_rt/comparef.zig b/lib/compiler_rt/comparef.zig index 3e9747758966f1c11d0e0a2a72eee0782e928a83..ae5ffd8820cbdae16260ff7babcf2a110775ef20 100644 --- a/lib/compiler_rt/comparef.zig +++ b/lib/compiler_rt/comparef.zig @@ -162,8 +162,8 @@ pub const GE = enum(i32) { pub inline fn cmpf2(comptime T: type, comptime RT: type, a: T, b: T) RT { const bits = @typeInfo(T).float.bits; - const srep_t = std.meta.Int(.signed, bits); - const rep_t = std.meta.Int(.unsigned, bits); + const srep_t = @Int(.signed, bits); + const rep_t = @Int(.unsigned, bits); const significandBits = std.math.floatMantissaBits(T); const exponentBits = std.math.floatExponentBits(T); @@ -253,7 +253,7 @@ test "cmp_f80" { } pub inline fn unordcmp(comptime T: type, a: T, b: T) i32 { - const rep_t = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const rep_t = @Int(.unsigned, @typeInfo(T).float.bits); const significandBits = std.math.floatMantissaBits(T); const exponentBits = std.math.floatExponentBits(T); diff --git a/lib/compiler_rt/count0bits.zig b/lib/compiler_rt/count0bits.zig index 12084864646b6d9e58c5c6147ce2b582dd7d4f9b..a8d0445dc69276e4639211818eb42707a8782c6c 100644 --- a/lib/compiler_rt/count0bits.zig +++ b/lib/compiler_rt/count0bits.zig @@ -198,7 +198,7 @@ pub fn __ctzti2(a: i128) callconv(.c) i32 { } inline fn ffsXi2(comptime T: type, a: T) i32 { - var x: std.meta.Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a); + var x: @Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a); var n: T = 1; // adapted from Number of trailing zeroes (see ctzXi2) var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x)); diff --git a/lib/compiler_rt/divdf3.zig b/lib/compiler_rt/divdf3.zig index b8a9c1914e2cecbaa04bf3f3386a2cb028356a14..489c556186e2b3c2edd865efc26adcbf16b2e179 100644 --- a/lib/compiler_rt/divdf3.zig +++ b/lib/compiler_rt/divdf3.zig @@ -26,8 +26,8 @@ fn __aeabi_ddiv(a: f64, b: f64) callconv(.{ .arm_aapcs = .{} }) f64 { } inline fn div(a: f64, b: f64) f64 { - const Z = std.meta.Int(.unsigned, 64); - const SignedZ = std.meta.Int(.signed, 64); + const Z = @Int(.unsigned, 64); + const SignedZ = @Int(.signed, 64); const significandBits = std.math.floatMantissaBits(f64); const exponentBits = std.math.floatExponentBits(f64); diff --git a/lib/compiler_rt/divsf3.zig b/lib/compiler_rt/divsf3.zig index 5406dc8ccf72161b2b70200467cad051ba311b16..dc017dbde1fee6973e140a25e9b416f701460459 100644 --- a/lib/compiler_rt/divsf3.zig +++ b/lib/compiler_rt/divsf3.zig @@ -25,7 +25,7 @@ fn __aeabi_fdiv(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) f32 { } inline fn div(a: f32, b: f32) f32 { - const Z = std.meta.Int(.unsigned, 32); + const Z = @Int(.unsigned, 32); const significandBits = std.math.floatMantissaBits(f32); const exponentBits = std.math.floatExponentBits(f32); diff --git a/lib/compiler_rt/divtf3.zig b/lib/compiler_rt/divtf3.zig index d5d76c3c8cbed966e6eb03fb3e555d2b2e948160..e12d762a71eba01caa8479b15ee5ca99df7d85d7 100644 --- a/lib/compiler_rt/divtf3.zig +++ b/lib/compiler_rt/divtf3.zig @@ -24,7 +24,7 @@ fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.c) void { } inline fn div(a: f128, b: f128) f128 { - const Z = std.meta.Int(.unsigned, 128); + const Z = @Int(.unsigned, 128); const significandBits = std.math.floatMantissaBits(f128); const exponentBits = std.math.floatExponentBits(f128); diff --git a/lib/compiler_rt/divxf3.zig b/lib/compiler_rt/divxf3.zig index 46210a500f09ee68f2bd2c259925fa1fa415a8ee..fdf43dc83bce6adbb53995826c516aecd7310fe2 100644 --- a/lib/compiler_rt/divxf3.zig +++ b/lib/compiler_rt/divxf3.zig @@ -13,7 +13,7 @@ comptime { pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 { const T = f80; - const Z = std.meta.Int(.unsigned, @bitSizeOf(T)); + const Z = @Int(.unsigned, @bitSizeOf(T)); const significandBits = std.math.floatMantissaBits(T); const fractionalBits = std.math.floatFractionalBits(T); diff --git a/lib/compiler_rt/extendf.zig b/lib/compiler_rt/extendf.zig index 6e546b182c164b495bcdc9b6b3a2651b666a5a4c..b923e9d25b7fe41a733b0aeb10db9d51b24176df 100644 --- a/lib/compiler_rt/extendf.zig +++ b/lib/compiler_rt/extendf.zig @@ -3,10 +3,10 @@ const std = @import("std"); pub inline fn extendf( comptime dst_t: type, comptime src_t: type, - a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits), + a: @Int(.unsigned, @typeInfo(src_t).float.bits), ) dst_t { - const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits); - const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits); + const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits); + const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits); const srcSigBits = std.math.floatMantissaBits(src_t); const dstSigBits = std.math.floatMantissaBits(dst_t); @@ -70,8 +70,8 @@ pub inline fn extendf( return @bitCast(result); } -pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits)) f80 { - const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits); +pub inline fn extend_f80(comptime src_t: type, a: @Int(.unsigned, @typeInfo(src_t).float.bits)) f80 { + const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits); const src_sig_bits = std.math.floatMantissaBits(src_t); const dst_int_bit = 0x8000000000000000; const dst_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit diff --git a/lib/compiler_rt/fabs.zig b/lib/compiler_rt/fabs.zig index 3e2104da6af1f8263678f06127f1ee0eb9201136..abdf21df8f33de1c080aba1452ae233287283540 100644 --- a/lib/compiler_rt/fabs.zig +++ b/lib/compiler_rt/fabs.zig @@ -47,7 +47,7 @@ pub fn fabsl(x: c_longdouble) callconv(.c) c_longdouble { inline fn generic_fabs(x: anytype) @TypeOf(x) { const T = @TypeOf(x); - const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const TBits = @Int(.unsigned, @typeInfo(T).float.bits); const float_bits: TBits = @bitCast(x); const remove_sign = ~@as(TBits, 0) >> 1; return @bitCast(float_bits & remove_sign); diff --git a/lib/compiler_rt/float_from_int.zig b/lib/compiler_rt/float_from_int.zig index 9ce43b4d701eb55f254b21bcd28e57e377ee59ca..2fddcaea9505ce31fb7bb4a0c0299b4f00590b8c 100644 --- a/lib/compiler_rt/float_from_int.zig +++ b/lib/compiler_rt/float_from_int.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const Int = std.meta.Int; const math = std.math; pub fn floatFromInt(comptime T: type, x: anytype) T { @@ -7,14 +6,14 @@ pub fn floatFromInt(comptime T: type, x: anytype) T { // Various constants whose values follow from the type parameters. // Any reasonable optimizer will fold and propagate all of these. - const Z = Int(.unsigned, @bitSizeOf(@TypeOf(x))); - const uT = Int(.unsigned, @bitSizeOf(T)); + const Z = @Int(.unsigned, @bitSizeOf(@TypeOf(x))); + const uT = @Int(.unsigned, @bitSizeOf(T)); const inf = math.inf(T); const float_bits = @bitSizeOf(T); const int_bits = @bitSizeOf(@TypeOf(x)); const exp_bits = math.floatExponentBits(T); const fractional_bits = math.floatFractionalBits(T); - const exp_bias = math.maxInt(Int(.unsigned, exp_bits - 1)); + const exp_bias = math.maxInt(@Int(.unsigned, exp_bits - 1)); const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0; const max_exp = exp_bias; diff --git a/lib/compiler_rt/fmax.zig b/lib/compiler_rt/fmax.zig index 0afdf9ee2be581c9296eac6d308f7f8fd7ecae35..317d93f2d3e42fcfb88c4f36fe2203dab6bfeed2 100644 --- a/lib/compiler_rt/fmax.zig +++ b/lib/compiler_rt/fmax.zig @@ -59,7 +59,7 @@ inline fn generic_fmax(comptime T: type, x: T, y: T) T { test "generic_fmax" { inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| { const nan_val = math.nan(T); - const Int = std.meta.Int(.unsigned, @bitSizeOf(T)); + const Int = @Int(.unsigned, @bitSizeOf(T)); try std.testing.expect(math.isNan(generic_fmax(T, nan_val, nan_val))); try std.testing.expectEqual(@as(T, 1.0), generic_fmax(T, nan_val, 1.0)); diff --git a/lib/compiler_rt/fmin.zig b/lib/compiler_rt/fmin.zig index 60b58cef3a6793efd5a53c24b380ea2178243bc9..36cf9c121bbf17c1e282cfcf982f69ce7f1ec17c 100644 --- a/lib/compiler_rt/fmin.zig +++ b/lib/compiler_rt/fmin.zig @@ -59,7 +59,7 @@ inline fn generic_fmin(comptime T: type, x: T, y: T) T { test "generic_fmin" { inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| { const nan_val = math.nan(T); - const Int = std.meta.Int(.unsigned, @bitSizeOf(T)); + const Int = @Int(.unsigned, @bitSizeOf(T)); try std.testing.expect(math.isNan(generic_fmin(T, nan_val, nan_val))); try std.testing.expectEqual(@as(T, 1.0), generic_fmin(T, nan_val, 1.0)); diff --git a/lib/compiler_rt/fmod.zig b/lib/compiler_rt/fmod.zig index 0279206f51b7977ff98c7007dfdf524320da3680..009eedd8ac84ab7eb905a74900fc17d07e8be421 100644 --- a/lib/compiler_rt/fmod.zig +++ b/lib/compiler_rt/fmod.zig @@ -36,7 +36,7 @@ pub fn fmod(x: f64, y: f64) callconv(.c) f64 { /// Logic and flow heavily inspired by MUSL fmodl for 113 mantissa digits pub fn __fmodx(a: f80, b: f80) callconv(.c) f80 { const T = f80; - const Z = std.meta.Int(.unsigned, @bitSizeOf(T)); + const Z = @Int(.unsigned, @bitSizeOf(T)); const significandBits = math.floatMantissaBits(T); const fractionalBits = math.floatFractionalBits(T); @@ -260,7 +260,7 @@ pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.c) c_longdouble { inline fn generic_fmod(comptime T: type, x: T, y: T) T { const bits = @typeInfo(T).float.bits; - const uint = std.meta.Int(.unsigned, bits); + const uint = @Int(.unsigned, bits); comptime assert(T == f32 or T == f64); const digits = if (T == f32) 23 else 52; const exp_bits = if (T == f32) 9 else 12; diff --git a/lib/compiler_rt/mulf3.zig b/lib/compiler_rt/mulf3.zig index d85b0bf8d57185f5c3a86b6bf1ffde0efa567750..d6b5a4719068cf2e27345f73e5f29994fc72e6d3 100644 --- a/lib/compiler_rt/mulf3.zig +++ b/lib/compiler_rt/mulf3.zig @@ -12,7 +12,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T { const fractionalBits = math.floatFractionalBits(T); const exponentBits = math.floatExponentBits(T); - const Z = std.meta.Int(.unsigned, typeWidth); + const Z = @Int(.unsigned, typeWidth); // ZSignificand is large enough to contain the significand, including an explicit integer bit const ZSignificand = PowerOfTwoSignificandZ(T); @@ -195,7 +195,7 @@ fn normalize(comptime T: type, significand: *PowerOfTwoSignificandZ(T)) i32 { /// the significand of T, including an explicit integer bit fn PowerOfTwoSignificandZ(comptime T: type) type { const bits = math.ceilPowerOfTwoAssert(u16, math.floatFractionalBits(T) + 1); - return std.meta.Int(.unsigned, bits); + return @Int(.unsigned, bits); } test { diff --git a/lib/compiler_rt/truncf.zig b/lib/compiler_rt/truncf.zig index 5c116811dc7e92f5f913497c464f19cfee184c9e..a03f3b67113028ba8a69c4fc72023b9d26f87e23 100644 --- a/lib/compiler_rt/truncf.zig +++ b/lib/compiler_rt/truncf.zig @@ -1,8 +1,8 @@ const std = @import("std"); pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { - const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits); - const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits); + const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits); + const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits); const srcSigBits = std.math.floatMantissaBits(src_t); const dstSigBits = std.math.floatMantissaBits(dst_t); @@ -100,7 +100,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t } pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t { - const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits); + const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits); const src_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit const dst_sig_bits = std.math.floatMantissaBits(dst_t); diff --git a/lib/std/Build/abi.zig b/lib/std/Build/abi.zig index af29935d8e57e4120c7514e70c923c2cd73fdd4f..d0c56bd1a7529d484525f3da5a532fe41785c049 100644 --- a/lib/std/Build/abi.zig +++ b/lib/std/Build/abi.zig @@ -266,7 +266,7 @@ pub const fuzz = struct { .comptime_int => x, .bool => @intFromBool(x), .@"enum" => @intFromEnum(x), - else => @as(std.meta.Int(.unsigned, @bitSizeOf(T)), @bitCast(x)), + else => @as(@Int(.unsigned, @bitSizeOf(T)), @bitCast(x)), .int => |i| x: { comptime { diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index 9cac2f12a41052cbfe347feeafd3954a1e4983b9..4544f260ab2285ab00843d04910881cd03f28a45 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -15574,7 +15574,7 @@ fn readIntFd(fd: posix.fd_t) !ErrInt { return @intCast(std.mem.readInt(u64, &buffer, .little)); } -const ErrInt = std.meta.Int(.unsigned, @sizeOf(anyerror) * 8); +const ErrInt = @Int(.unsigned, @sizeOf(anyerror) * 8); fn destroyPipe(pipe: [2]posix.fd_t) void { if (pipe[0] != -1) closeFd(pipe[0]); diff --git a/lib/std/Io/Writer.zig b/lib/std/Io/Writer.zig index 1f0d18f951576e8556e341737d1d3c95ce40fb25..5bb813913ae9b622e1ca9f30bd33ce87c1857a7d 100644 --- a/lib/std/Io/Writer.zig +++ b/lib/std/Io/Writer.zig @@ -1517,7 +1517,7 @@ pub fn printIntAny( // The type must have the same size as `base` or be wider in order for the // division to work const min_int_bits = comptime @max(value_info.bits, 8); - const MinInt = std.meta.Int(.unsigned, min_int_bits); + const MinInt = @Int(.unsigned, min_int_bits); const abs_value = @abs(value); // 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 }); const T = @TypeOf(v); - const TU = std.meta.Int(.unsigned, @bitSizeOf(T)); + const TU = @Int(.unsigned, @bitSizeOf(T)); const mantissa_bits = std.math.floatMantissaBits(T); const fractional_bits = std.math.floatFractionalBits(T); diff --git a/lib/std/Random.zig b/lib/std/Random.zig index ee2185d30144c945d1851295f7ad7c3b962872fa..7593e9680f9f714d9853275c115acfdbe95d13fb 100644 --- a/lib/std/Random.zig +++ b/lib/std/Random.zig @@ -125,9 +125,9 @@ pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: ty /// `i` is evenly distributed. pub fn int(r: Random, comptime T: type) T { const bits = @typeInfo(T).int.bits; - const UnsignedT = std.meta.Int(.unsigned, bits); + const UnsignedT = @Int(.unsigned, bits); const ceil_bytes = comptime std.math.divCeil(u16, bits, 8) catch unreachable; - const ByteAlignedT = std.meta.Int(.unsigned, ceil_bytes * 8); + const ByteAlignedT = @Int(.unsigned, ceil_bytes * 8); var rand_bytes: [ceil_bytes]u8 = undefined; r.bytes(&rand_bytes); @@ -215,7 +215,7 @@ pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_tha const info = @typeInfo(T).int; if (info.signedness == .signed) { // Two's complement makes this math pretty easy. - const UnsignedT = std.meta.Int(.unsigned, info.bits); + const UnsignedT = @Int(.unsigned, info.bits); const lo: UnsignedT = @bitCast(at_least); const hi: UnsignedT = @bitCast(less_than); 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) const info = @typeInfo(T).int; if (info.signedness == .signed) { // Two's complement makes this math pretty easy. - const UnsignedT = std.meta.Int(.unsigned, info.bits); + const UnsignedT = @Int(.unsigned, info.bits); const lo: UnsignedT = @bitCast(at_least); const hi: UnsignedT = @bitCast(less_than); 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 const info = @typeInfo(T).int; if (info.signedness == .signed) { // Two's complement makes this math pretty easy. - const UnsignedT = std.meta.Int(.unsigned, info.bits); + const UnsignedT = @Int(.unsigned, info.bits); const lo: UnsignedT = @bitCast(at_least); const hi: UnsignedT = @bitCast(at_most); 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 { const info = @typeInfo(T).int; if (info.signedness == .signed) { // Two's complement makes this math pretty easy. - const UnsignedT = std.meta.Int(.unsigned, info.bits); + const UnsignedT = @Int(.unsigned, info.bits); const lo: UnsignedT = @bitCast(at_least); const hi: UnsignedT = @bitCast(at_most); const result = lo +% r.uintAtMost(UnsignedT, hi -% lo); diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 815c2776a563a378c8dfc434faad904dacae7465..ca1562e3f7a632d9bce758839cbbc0711327c47e 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -1228,7 +1228,7 @@ pub const Cpu = struct { pub const needed_bit_count = 347; pub const byte_count = (needed_bit_count + 7) / 8; pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize); - pub const Index = std.math.Log2Int(std.meta.Int(.unsigned, usize_count * @bitSizeOf(usize))); + pub const Index = std.math.Log2Int(@Int(.unsigned, usize_count * @bitSizeOf(usize))); pub const ShiftInt = std.math.Log2Int(usize); pub const empty: Set = .{ .ints = @splat(0) }; diff --git a/lib/std/bit_set.zig b/lib/std/bit_set.zig index 51212e8c293157de622dde1bdeb120d19991a6ad..a0388cd82b4dad52699b4aca320d669ae9c5b8b8 100644 --- a/lib/std/bit_set.zig +++ b/lib/std/bit_set.zig @@ -65,7 +65,7 @@ pub fn Integer(comptime size: u16) type { pub const bit_length: usize = size; /// The integer type used to represent a mask in this bit set - pub const MaskInt = std.meta.Int(.unsigned, size); + pub const MaskInt = @Int(.unsigned, size); /// The integer type used to shift a mask in this bit set pub const ShiftInt = std.math.Log2Int(MaskInt); @@ -359,7 +359,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type { if (!std.math.isPowerOfTwo(@bitSizeOf(MaskIntType))) { var desired_bits = std.math.ceilPowerOfTwoAssert(usize, @bitSizeOf(MaskIntType)); if (desired_bits < byte_size) desired_bits = byte_size; - const FixedMaskType = std.meta.Int(.unsigned, desired_bits); + const FixedMaskType = @Int(.unsigned, desired_bits); @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++ ", which is not a power of two. Please round this up to a power of two integer size (i.e. " ++ @typeName(FixedMaskType) ++ ")."); } @@ -370,7 +370,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type { if (@bitSizeOf(MaskIntType) != @sizeOf(MaskIntType) * byte_size) { var desired_bits = @sizeOf(MaskIntType) * byte_size; desired_bits = std.math.ceilPowerOfTwoAssert(usize, desired_bits); - const FixedMaskType = std.meta.Int(.unsigned, desired_bits); + const FixedMaskType = @Int(.unsigned, desired_bits); @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++ ", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ")."); } diff --git a/lib/std/c.zig b/lib/std/c.zig index 057183be7ae64a98242c7cdf774f7607f7c32548..0b9178761e6c2d09357525e138268dd32b6e7fc8 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -7185,7 +7185,7 @@ pub const RTLD = switch (native_os) { NOW: bool = false, GLOBAL: bool = false, LOCAL: bool = false, - _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 6) = 0, + _: @Int(.unsigned, @bitSizeOf(c_int) - 6) = 0, }, else => void, }; @@ -7365,7 +7365,7 @@ pub const AI = if (builtin.abi.isAndroid()) packed struct(u32) { V4MAPPED: bool = false, ALL: bool = false, ADDRCONFIG: bool = false, - _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 7) = 0, + _: @Int(.unsigned, @bitSizeOf(c_int) - 7) = 0, }, else => void, }; @@ -7398,7 +7398,7 @@ pub const NI = switch (native_os) { NAMEREQD: bool = false, NOFQDN: bool = false, DGRAM: bool = false, - _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 5) = 0, + _: @Int(.unsigned, @bitSizeOf(c_int) - 5) = 0, }, .freebsd, .haiku => packed struct(u32) { NOFQDN: bool = false, @@ -8634,7 +8634,7 @@ pub const O = switch (native_os) { CLOEXEC: bool = false, DIRECT: bool = false, SYNC: bool = false, - _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 14) = 0, + _: @Int(.unsigned, @bitSizeOf(c_int) - 14) = 0, }, else => void, }; @@ -8788,7 +8788,7 @@ pub const MAP = switch (native_os) { RANDOMIZED: bool = false, PURGEABLE: bool = false, FIXED_NOREPLACE: bool = false, - _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 11) = 0, + _: @Int(.unsigned, @bitSizeOf(c_int) - 11) = 0, }, else => void, }; diff --git a/lib/std/compress/zstd/Decompress.zig b/lib/std/compress/zstd/Decompress.zig index abca7c1862a59655f9533e07a6448f3601630168..8acb2650a293e9d5f72cfefd585f6f10585d86e5 100644 --- a/lib/std/compress/zstd/Decompress.zig +++ b/lib/std/compress/zstd/Decompress.zig @@ -533,7 +533,7 @@ pub const Frame = struct { table: Table, accuracy_log: u8, - const State = std.meta.Int(.unsigned, max_accuracy_log); + const State = @Int(.unsigned, max_accuracy_log); }; } @@ -1783,7 +1783,7 @@ const ReverseBitReader = struct { } fn initBits(comptime T: type, out: anytype, num: u16) Bits(T) { - const UT = std.meta.Int(.unsigned, @bitSizeOf(T)); + const UT = @Int(.unsigned, @bitSizeOf(T)); return .{ @bitCast(@as(UT, @intCast(out))), num, @@ -1803,7 +1803,7 @@ const ReverseBitReader = struct { } fn readBitsTuple(self: *ReverseBitReader, comptime T: type, num: u16) !Bits(T) { - const UT = std.meta.Int(.unsigned, @bitSizeOf(T)); + const UT = @Int(.unsigned, @bitSizeOf(T)); const U = if (@bitSizeOf(T) < 8) u8 else UT; if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num); @@ -1871,7 +1871,7 @@ const BitReader = struct { count: u4 = 0, fn initBits(comptime T: type, out: anytype, num: u16) Bits(T) { - const UT = std.meta.Int(.unsigned, @bitSizeOf(T)); + const UT = @Int(.unsigned, @bitSizeOf(T)); return .{ @bitCast(@as(UT, @intCast(out))), num, @@ -1891,7 +1891,7 @@ const BitReader = struct { } fn readBitsTuple(self: *@This(), comptime T: type, num: u16) !Bits(T) { - const UT = std.meta.Int(.unsigned, @bitSizeOf(T)); + const UT = @Int(.unsigned, @bitSizeOf(T)); const U = if (@bitSizeOf(T) < 8) u8 else UT; if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num); diff --git a/lib/std/crypto/aes_ccm.zig b/lib/std/crypto/aes_ccm.zig index 773295fd7bd00c6415959369b4aa30fd202b6c68..2f14e61d6092054858c3e3bb5c4cfd3a706a3519 100644 --- a/lib/std/crypto/aes_ccm.zig +++ b/lib/std/crypto/aes_ccm.zig @@ -171,7 +171,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le block[0] = L - 1; // flags @memcpy(block[1..][0..nonce_length], &npub); // Counter goes in the last L bytes - const CounterInt = std.meta.Int(.unsigned, L * 8); + const CounterInt = @Int(.unsigned, L * 8); mem.writeInt(CounterInt, block[1 + nonce_length ..][0..L], @as(CounterInt, @intCast(counter)), .big); } @@ -229,7 +229,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le @memcpy(block[1..][0..nonce_length], &npub); // Encode message length in last L bytes - const LengthInt = std.meta.Int(.unsigned, L * 8); + const LengthInt = @Int(.unsigned, L * 8); mem.writeInt(LengthInt, block[1 + nonce_length ..][0..L], @as(LengthInt, @intCast(msg_len)), .big); } diff --git a/lib/std/crypto/cmac.zig b/lib/std/crypto/cmac.zig index 5510165cc8b749c94136cd9a72ba04b1ff1fae51..4f3858b50ee36e40d93a8103c4dbfe6527bd64c2 100644 --- a/lib/std/crypto/cmac.zig +++ b/lib/std/crypto/cmac.zig @@ -74,7 +74,7 @@ pub fn Cmac(comptime BlockCipher: type) type { } fn double(l: Block) Block { - const Int = std.meta.Int(.unsigned, block_length * 8); + const Int = @Int(.unsigned, block_length * 8); const l_ = mem.readInt(Int, &l, .big); const l_2 = switch (block_length) { 8 => (l_ << 1) ^ (0x1b & -%(l_ >> 63)), // mod x^64 + x^4 + x^3 + x + 1 diff --git a/lib/std/crypto/codecs/asn1/der/Encoder.zig b/lib/std/crypto/codecs/asn1/der/Encoder.zig index 82b7e62910abbd82fb8ec674a9afe25182e30b02..0000a0660f0d72d5500f3b9d0afce7637cc051b8 100644 --- a/lib/std/crypto/codecs/asn1/der/Encoder.zig +++ b/lib/std/crypto/codecs/asn1/der/Encoder.zig @@ -129,7 +129,7 @@ fn int(self: *Encoder, comptime T: type, value: T) !void { const needs_padding: u1 = if (value == 0) 1 else if (bits_needed > 8) brk: { - const RightShift = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(bits_needed)) - 1); + const RightShift = @Int(.unsigned, @bitSizeOf(@TypeOf(bits_needed)) - 1); const right_shift: RightShift = @intCast(bits_needed - 9); break :brk if (value >> right_shift == 0x1ff) 1 else 0; } else 0; diff --git a/lib/std/crypto/ff.zig b/lib/std/crypto/ff.zig index 9d63e83404d42a7a9536118777dc91338efd07f9..caae9cb33e311cd5bee4c21bcdcfd95d4c7bf7f6 100644 --- a/lib/std/crypto/ff.zig +++ b/lib/std/crypto/ff.zig @@ -10,7 +10,6 @@ const builtin = @import("builtin"); const crypto = std.crypto; const math = std.math; const mem = std.mem; -const meta = std.meta; const testing = std.testing; const assert = std.debug.assert; const Endian = std.builtin.Endian; @@ -25,7 +24,7 @@ const carry_bits = 1; const t_bits: usize = @bitSizeOf(Limb) - carry_bits; // A TLimb is a Limb that is truncated to t_bits. -const TLimb = meta.Int(.unsigned, t_bits); +const TLimb = @Int(.unsigned, t_bits); const native_endian = builtin.target.cpu.arch.endian(); @@ -906,7 +905,7 @@ const ct_protected = struct { // Multiplies two limbs and returns the result as a wide limb. fn mulWide(x: Limb, y: Limb) WideLimb { const half_bits = @typeInfo(Limb).int.bits / 2; - const Half = meta.Int(.unsigned, half_bits); + const Half = @Int(.unsigned, half_bits); const x0 = @as(Half, @truncate(x)); const x1 = @as(Half, @truncate(x >> half_bits)); const y0 = @as(Half, @truncate(y)); diff --git a/lib/std/crypto/keccak_p.zig b/lib/std/crypto/keccak_p.zig index 16c78a7aaf375e3afeff4b53aced8d096c2c20ff..6aa2345aed5550d1d3a320887a8d99e4d115f277 100644 --- a/lib/std/crypto/keccak_p.zig +++ b/lib/std/crypto/keccak_p.zig @@ -9,7 +9,7 @@ const mode = @import("builtin").mode; /// The Keccak-f permutation. pub fn KeccakF(comptime f: u11) type { comptime assert(f >= 200 and f <= 1600 and f % 200 == 0); // invalid bit size - const T = std.meta.Int(.unsigned, f / 25); + const T = @Int(.unsigned, f / 25); const Block = [25]T; const PI = [_]u5{ diff --git a/lib/std/crypto/ml_dsa.zig b/lib/std/crypto/ml_dsa.zig index 67df28a176a4de8ef0c2b47c1b54d1a480bd7556..80572be99b1b8d7bcd9db1a64859960a0de7bded 100644 --- a/lib/std/crypto/ml_dsa.zig +++ b/lib/std/crypto/ml_dsa.zig @@ -3413,7 +3413,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T { // Use a signed type for EEA computation const type_info = @typeInfo(T); const SignedT = if (type_info == .int and type_info.int.signedness == .unsigned) - std.meta.Int(.signed, type_info.int.bits) + @Int(.signed, type_info.int.bits) else T; @@ -3436,7 +3436,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T { fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T { const type_info = @typeInfo(T); const bits = type_info.int.bits; - const WideT = std.meta.Int(.unsigned, bits * 2); + const WideT = @Int(.unsigned, bits * 2); var ret: T = 1; var base: T = a; @@ -3465,14 +3465,14 @@ fn bitMask(comptime T: type, bit: T) T { /// Creates a mask from the sign bit of a signed integer. /// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0. -fn signMask(comptime T: type, x: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) { +fn signMask(comptime T: type, x: T) @Int(.unsigned, @typeInfo(T).int.bits) { const type_info = @typeInfo(T); if (type_info != .int) { @compileError("signMask requires an integer type"); } const bits = type_info.int.bits; - const SignedT = std.meta.Int(.signed, bits); + const SignedT = @Int(.signed, bits); // Convert to signed if needed, arithmetic right shift to propagate sign bit const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x); @@ -3499,8 +3499,8 @@ fn montgomeryReduce( const m: OutT = @truncate(m_full); const yR = x -% @as(InT, m) * @as(InT, q); - const y_shifted = @as(std.meta.Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits; - return @bitCast(@as(std.meta.Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted))); + const y_shifted = @as(@Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits; + return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted))); } /// Uniform sampling using SHAKE-128 with rejection sampling. diff --git a/lib/std/crypto/ml_kem.zig b/lib/std/crypto/ml_kem.zig index 119222899f4ea32b57417a33b4fbec20f793ba95..7105c043d8317e26d1552728c366559a64e6981f 100644 --- a/lib/std/crypto/ml_kem.zig +++ b/lib/std/crypto/ml_kem.zig @@ -1794,7 +1794,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T { // Use a signed type for EEA computation const type_info = @typeInfo(T); const SignedT = if (type_info == .int and type_info.int.signedness == .unsigned) - std.meta.Int(.signed, type_info.int.bits) + @Int(.signed, type_info.int.bits) else T; @@ -1817,7 +1817,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T { fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T { const type_info = @typeInfo(T); const bits = type_info.int.bits; - const WideT = std.meta.Int(.unsigned, bits * 2); + const WideT = @Int(.unsigned, bits * 2); var ret: T = 1; var base: T = a; @@ -1846,14 +1846,14 @@ fn bitMask(comptime T: type, bit: T) T { /// Creates a mask from the sign bit of a signed integer. /// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0. -fn signMask(comptime T: type, x: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) { +fn signMask(comptime T: type, x: T) @Int(.unsigned, @typeInfo(T).int.bits) { const type_info = @typeInfo(T); if (type_info != .int) { @compileError("signMask requires an integer type"); } const bits = type_info.int.bits; - const SignedT = std.meta.Int(.signed, bits); + const SignedT = @Int(.signed, bits); // Convert to signed if needed, arithmetic right shift to propagate sign bit const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x); @@ -1898,8 +1898,8 @@ fn montgomeryReduce( const m: OutT = @truncate(m_full); const yR = x -% @as(InT, m) * @as(InT, q); - const y_shifted = @as(std.meta.Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits; - return @bitCast(@as(std.meta.Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted))); + const y_shifted = @as(@Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits; + return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted))); } /// Uniform sampling using SHAKE-128 with rejection sampling. diff --git a/lib/std/crypto/modes.zig b/lib/std/crypto/modes.zig index 323bf2598e3e8ab5da5d35cd40820eaea887dd67..ca8ecb90a6bb5b4b7a42f5da8e2b401d616c7fe5 100644 --- a/lib/std/crypto/modes.zig +++ b/lib/std/crypto/modes.zig @@ -40,7 +40,7 @@ pub fn ctrSlice( var counterBlock = iv; var i: usize = 0; - const CounterInt = std.meta.Int(.unsigned, counter_size * 8); + const CounterInt = @Int(.unsigned, counter_size * 8); const parallel_count = BlockCipher.block.parallel.optimal_parallel_blocks; const wide_block_length = parallel_count * block_length; diff --git a/lib/std/crypto/pcurves/common.zig b/lib/std/crypto/pcurves/common.zig index 2af7c3e8fe945657583b16669f7a8c12adbc3bf6..8364dc8260e016cb218100bd48e6a3ed7fd566bf 100644 --- a/lib/std/crypto/pcurves/common.zig +++ b/lib/std/crypto/pcurves/common.zig @@ -2,7 +2,6 @@ const std = @import("std"); const crypto = std.crypto; const debug = std.debug; const mem = std.mem; -const meta = std.meta; const NonCanonicalError = crypto.errors.NonCanonicalError; const NotSquareError = crypto.errors.NotSquareError; @@ -54,7 +53,7 @@ pub fn Field(comptime params: FieldParams) type { var s = if (endian == .little) s_ else orderSwap(s_); const field_order_s = comptime fos: { var fos: [encoded_length]u8 = undefined; - mem.writeInt(std.meta.Int(.unsigned, encoded_length * 8), &fos, field_order, .little); + mem.writeInt(@Int(.unsigned, encoded_length * 8), &fos, field_order, .little); break :fos fos; }; if (crypto.timing_safe.compare(u8, &s, &field_order_s, .little) != .lt) { @@ -90,7 +89,7 @@ pub fn Field(comptime params: FieldParams) type { } /// Element as an integer. - pub const IntRepr = meta.Int(.unsigned, params.field_bits); + pub const IntRepr = @Int(.unsigned, params.field_bits); /// Create a field element from an integer. pub fn fromInt(comptime x: IntRepr) NonCanonicalError!Fe { @@ -270,7 +269,7 @@ pub fn Field(comptime params: FieldParams) type { const ls = x126.sqn(126).mul(x126).sqn(3).mul(t111).sqn(33).mul(x32).sqn(95).mul(x31); return ls.equivalent(Fe.one); } else { - const ls = x2.pow(std.meta.Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol + const ls = x2.pow(@Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol return ls.equivalent(Fe.one); } } @@ -307,7 +306,7 @@ pub fn Field(comptime params: FieldParams) type { const x108 = x54.sqn(54).mul(x54); return x108.sqn(108).mul(x108).sqn(7).mul(t1111111).sqn(23).mul(x22).sqn(6).mul(t11).sqn(2); } else { - return x2.pow(std.meta.Int(.unsigned, field_bits), (field_order + 1) / 4); + return x2.pow(@Int(.unsigned, field_bits), (field_order + 1) / 4); } } diff --git a/lib/std/crypto/timing_safe.zig b/lib/std/crypto/timing_safe.zig index a7b088855320c591998fcb90e556db055d7cb376..4aeb4ba003f7081721bfaa108bd3bfade649cace 100644 --- a/lib/std/crypto/timing_safe.zig +++ b/lib/std/crypto/timing_safe.zig @@ -21,8 +21,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool { acc |= x ^ b[i]; } const s = @typeInfo(C).int.bits; - const Cu = std.meta.Int(.unsigned, s); - const Cext = std.meta.Int(.unsigned, s + 1); + const Cu = @Int(.unsigned, s); + const Cext = @Int(.unsigned, s + 1); return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s)))); }, .vector => |info| { @@ -32,8 +32,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool { } const acc = @reduce(.Or, a ^ b); const s = @typeInfo(C).int.bits; - const Cu = std.meta.Int(.unsigned, s); - const Cext = std.meta.Int(.unsigned, s + 1); + const Cu = @Int(.unsigned, s); + const Cext = @Int(.unsigned, s + 1); return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s)))); }, else => { @@ -50,7 +50,7 @@ pub fn compare(comptime T: type, a: []const T, b: []const T, endian: Endian) Ord .int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits, else => @compileError("Elements to be compared must be integers"), }; - const Cext = std.meta.Int(.unsigned, bits + 1); + const Cext = @Int(.unsigned, bits + 1); var gt: T = 0; var eq: T = 1; if (endian == .little) { diff --git a/lib/std/enums.zig b/lib/std/enums.zig index 855fe1dc6d19ccc08fe26e7dff0bb1b929af59b4..3e097c25053278c2bcf77bffd7e06ddc9b5adcad 100644 --- a/lib/std/enums.zig +++ b/lib/std/enums.zig @@ -1291,7 +1291,7 @@ pub fn EnumIndexer(comptime E: type) type { const min_value = std.math.minInt(BackingInt); const max_value = std.math.maxInt(BackingInt); - const RangeType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt)); + const RangeType = @Int(.unsigned, @bitSizeOf(BackingInt)); pub const count: comptime_int = std.math.maxInt(RangeType) + 1; pub fn indexOf(e: E) usize { @@ -1307,7 +1307,7 @@ pub fn EnumIndexer(comptime E: type) type { if (backing_int_sign == .unsigned) return @enumFromInt(i); - return @enumFromInt(@as(std.meta.Int(.signed, @bitSizeOf(RangeType) + 1), @intCast(i)) + min_value); + return @enumFromInt(@as(@Int(.signed, @bitSizeOf(RangeType) + 1), @intCast(i)) + min_value); } }; } @@ -1380,14 +1380,14 @@ test "EnumIndexer non-exhaustive" { i4, i8, i16, - std.meta.Int(.signed, @bitSizeOf(isize) - 1), + @Int(.signed, @bitSizeOf(isize) - 1), isize, u1, u2, u3, u4, u16, - std.meta.Int(.unsigned, @bitSizeOf(usize) - 1), + @Int(.unsigned, @bitSizeOf(usize) - 1), usize, }; inline for (backing_ints) |BackingInt| { @@ -1400,7 +1400,7 @@ test "EnumIndexer non-exhaustive" { const min_tag: E = @enumFromInt(std.math.minInt(BackingInt)); const max_tag: E = @enumFromInt(std.math.maxInt(BackingInt)); - const RangedType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt)); + const RangedType = @Int(.unsigned, @bitSizeOf(BackingInt)); const max_index: comptime_int = std.math.maxInt(RangedType); const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).int.signedness) { .unsigned => 0, diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 1fccc065ded47eae0a743b9d43d98106e6314a40..e3ae155de8d92d8c86ce1984efb6d28db832ca0e 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -433,7 +433,7 @@ fn parseIntWithSign( // accumulate into Accumulate which is always 8 bits or larger. this prevents // `buf_base` from overflowing Result. const info = @typeInfo(Result); - const Accumulate = std.meta.Int(info.int.signedness, @max(8, info.int.bits)); + const Accumulate = @Int(info.int.signedness, @max(8, info.int.bits)); var accumulate: Accumulate = 0; if (buf_start[0] == '_' or buf_start[buf_start.len - 1] == '_') return error.InvalidCharacter; diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig index 8b46986baef5692f1f8f58fc9adc1b54aa37c8d8..a2c952ca58306bb754138cdb0920bac2448c6f1f 100644 --- a/lib/std/fmt/parse_float.zig +++ b/lib/std/fmt/parse_float.zig @@ -128,7 +128,7 @@ test parseFloat { test "nan and inf" { inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { - const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const Z = @Int(.unsigned, @typeInfo(T).float.bits); try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T)))); try expectEqual(try parseFloat(T, "inF"), std.math.inf(T)); diff --git a/lib/std/hash/wyhash.zig b/lib/std/hash/wyhash.zig index 3a52b69c751933cdfea89c63a1ca693ad0e2176c..dea4e8f1bca362a15406c62669a21586d2230cd1 100644 --- a/lib/std/hash/wyhash.zig +++ b/lib/std/hash/wyhash.zig @@ -130,7 +130,7 @@ pub const Wyhash = struct { inline fn read(comptime bytes: usize, data: []const u8) u64 { std.debug.assert(bytes <= 8); - const T = std.meta.Int(.unsigned, 8 * bytes); + const T = @Int(.unsigned, 8 * bytes); return @as(u64, std.mem.readInt(T, data[0..bytes], .little)); } diff --git a/lib/std/heap/debug_allocator.zig b/lib/std/heap/debug_allocator.zig index 564cb385053d9785b01489555bd341a837ae3bfc..5c4ac1b44c083a1e5784d022e30726f9b8720485 100644 --- a/lib/std/heap/debug_allocator.zig +++ b/lib/std/heap/debug_allocator.zig @@ -189,7 +189,7 @@ pub fn DebugAllocator(comptime config: Config) type { const page_size = config.page_size; const page_align: mem.Alignment = .fromByteUnits(page_size); /// Integer type for pointing to slots in a small allocation - const SlotIndex = std.meta.Int(.unsigned, math.log2(page_size) + 1); + const SlotIndex = @Int(.unsigned, math.log2(page_size) + 1); const total_requested_bytes_init = if (config.enable_memory_limit) @as(usize, 0) else {}; const requested_memory_limit_init = if (config.enable_memory_limit) @as(usize, math.maxInt(usize)) else {}; diff --git a/lib/std/leb128.zig b/lib/std/leb128.zig index d05c3323a9cc2d8b47e926baaf43921cb795bc02..8849a9f9e30adcd4ff49c2fc434f528689be1e53 100644 --- a/lib/std/leb128.zig +++ b/lib/std/leb128.zig @@ -9,7 +9,7 @@ const testing = std.testing; /// An example use case of this is in emitting DWARF info where one wants to make a ULEB128 field /// "relocatable", meaning that it becomes possible to later go back and patch the number to be a /// different value without shifting all the following code. -pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.unsigned, l * 7)) void { +pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: @Int(.unsigned, l * 7)) void { writeUnsignedExtended(ptr, int); } @@ -65,7 +65,7 @@ test writeUnsignedFixed { /// An example use case of this is in emitting DWARF info where one wants to make a ILEB128 field /// "relocatable", meaning that it becomes possible to later go back and patch the number to be a /// different value without shifting all the following code. -pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.signed, l * 7)) void { +pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: @Int(.signed, l * 7)) void { const T = @TypeOf(int); const U = if (@typeInfo(T).int.bits < 8) u8 else T; var value: U = @intCast(int); diff --git a/lib/std/math.zig b/lib/std/math.zig index c164a48c28db5a4b3d95504e4a19a7cd08cefa18..54488ddeda02e3c1f6bd5e6cfe9d2bc2355d44a4 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -779,7 +779,7 @@ pub fn Log2Int(comptime T: type) type { if (T == comptime_int) return comptime_int; const bits: u16 = @typeInfo(T).int.bits; const log2_bits = 16 - @clz(bits - 1); - return std.meta.Int(.unsigned, log2_bits); + return @Int(.unsigned, log2_bits); } /// 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 { if (T == comptime_int) return comptime_int; const bits: u16 = @typeInfo(T).int.bits; const log2_bits = 16 - @clz(bits); - return std.meta.Int(.unsigned, log2_bits); + return @Int(.unsigned, log2_bits); } /// Returns the smallest integer type that can hold both from and to. @@ -1048,10 +1048,10 @@ fn testRem() !void { /// Returns the negation of the integer parameter. /// Result is a signed integer. -pub fn negateCast(x: anytype) !std.meta.Int(.signed, @bitSizeOf(@TypeOf(x))) { +pub fn negateCast(x: anytype) !@Int(.signed, @bitSizeOf(@TypeOf(x))) { if (@typeInfo(@TypeOf(x)).int.signedness == .signed) return negate(x); - const int = std.meta.Int(.signed, @bitSizeOf(@TypeOf(x))); + const int = @Int(.signed, @bitSizeOf(@TypeOf(x))); if (x > -minInt(int)) return error.Overflow; if (x == -minInt(int)) return minInt(int); @@ -1177,7 +1177,7 @@ pub inline fn floor(value: anytype) @TypeOf(value) { /// Returns the nearest power of two less than or equal to value, or /// zero if value is less than or equal to zero. pub fn floorPowerOfTwo(comptime T: type, value: T) T { - const uT = std.meta.Int(.unsigned, @typeInfo(T).int.bits); + const uT = @Int(.unsigned, @typeInfo(T).int.bits); if (value <= 0) return 0; return @as(T, 1) << log2_int(uT, @as(uT, @intCast(value))); } @@ -1212,7 +1212,7 @@ pub inline fn ceil(value: anytype) @TypeOf(value) { /// Returns the next power of two (if the value is not already a power of two). /// Only unsigned integers can be used. Zero is not an allowed input. /// Result is a type with 1 more bit than the input type. -pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1) { +pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) @Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1) { comptime assert(@typeInfo(T) == .int); comptime assert(@typeInfo(T).int.signedness == .unsigned); assert(value != 0); @@ -1497,11 +1497,11 @@ test "max value type" { /// Multiply a and b. Return type is wide enough to guarantee no /// overflow. -pub fn mulWide(comptime T: type, a: T, b: T) std.meta.Int( +pub fn mulWide(comptime T: type, a: T, b: T) @Int( @typeInfo(T).int.signedness, @typeInfo(T).int.bits * 2, ) { - const ResultInt = std.meta.Int( + const ResultInt = @Int( @typeInfo(T).int.signedness, @typeInfo(T).int.bits * 2, ); diff --git a/lib/std/math/big.zig b/lib/std/math/big.zig index 37f40587c584b5dbf725ce22a8f80d3bfea90233..635a22d9a6adb76aaf1403efb457f2780a8668c7 100644 --- a/lib/std/math/big.zig +++ b/lib/std/math/big.zig @@ -4,10 +4,10 @@ const assert = std.debug.assert; pub const int = @import("big/int.zig"); pub const Limb = usize; const limb_info = @typeInfo(Limb).int; -pub const SignedLimb = std.meta.Int(.signed, limb_info.bits); -pub const DoubleLimb = std.meta.Int(.unsigned, 2 * limb_info.bits); -pub const HalfLimb = std.meta.Int(.unsigned, limb_info.bits / 2); -pub const SignedDoubleLimb = std.meta.Int(.signed, 2 * limb_info.bits); +pub const SignedLimb = @Int(.signed, limb_info.bits); +pub const DoubleLimb = @Int(.unsigned, 2 * limb_info.bits); +pub const HalfLimb = @Int(.unsigned, limb_info.bits / 2); +pub const SignedDoubleLimb = @Int(.signed, 2 * limb_info.bits); pub const Log2Limb = std.math.Log2Int(Limb); comptime { diff --git a/lib/std/math/big/int.zig b/lib/std/math/big/int.zig index e5f490fc2666698eb78a37e9edc39b9d6b26e0cd..75a1eb4c70552e0b7cc3eaf4ef324570df1a1387 100644 --- a/lib/std/math/big/int.zig +++ b/lib/std/math/big/int.zig @@ -2047,7 +2047,7 @@ pub const Mutable = struct { var limb = switch (signedness) { .unsigned => mem.readVarPackedInt(Limb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .unsigned), .signed => b: { - const SLimb = std.meta.Int(.signed, @bitSizeOf(Limb)); + const SLimb = @Int(.signed, @bitSizeOf(Limb)); const limb = mem.readVarPackedInt(SLimb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .signed); break :b @as(Limb, @bitCast(limb)); }, @@ -2284,7 +2284,7 @@ pub const Const = struct { // Make sure -0 is handled correctly. if (self.eqlZero()) return 0; - const Unsigned = std.meta.Int(.unsigned, info.bits); + const Unsigned = @Int(.unsigned, info.bits); if (!self.fitsInTwosComp(info.signedness, info.bits)) { return error.TargetTooSmall; diff --git a/lib/std/math/big/int_test.zig b/lib/std/math/big/int_test.zig index 00c2f49240216aa9e2f140597732d513fe96a0dd..581fd4217ab4ef7abe77016f31327b95315b0ef0 100644 --- a/lib/std/math/big/int_test.zig +++ b/lib/std/math/big/int_test.zig @@ -2370,7 +2370,7 @@ test "truncate multi to single signed" { test "truncate multi to multi unsigned" { const bits = @typeInfo(SignedDoubleLimb).int.bits; - const Int = std.meta.Int(.unsigned, bits - 1); + const Int = @Int(.unsigned, bits - 1); var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb)); defer a.deinit(); @@ -2386,7 +2386,7 @@ test "truncate multi to multi signed" { try a.truncate(&a, .signed, @bitSizeOf(Limb) + 1); - try testing.expectEqual(-1 << @bitSizeOf(Limb), try a.toInt(std.meta.Int(.signed, @bitSizeOf(Limb) + 1))); + try testing.expectEqual(-1 << @bitSizeOf(Limb), try a.toInt(@Int(.signed, @bitSizeOf(Limb) + 1))); } test "truncate negative multi to single" { diff --git a/lib/std/math/copysign.zig b/lib/std/math/copysign.zig index 65144dfe3f2a5004280397271a6c7d7643a727dc..020663c1b9d50e2ad1220771b3c8e4dee291813b 100644 --- a/lib/std/math/copysign.zig +++ b/lib/std/math/copysign.zig @@ -5,7 +5,7 @@ const expect = std.testing.expect; /// Returns a value with the magnitude of `magnitude` and the sign of `sign`. pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) { const T = @TypeOf(magnitude); - const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const TBits = @Int(.unsigned, @typeInfo(T).float.bits); const sign_bit_mask = @as(TBits, 1) << (@bitSizeOf(T) - 1); const mag = @as(TBits, @bitCast(magnitude)) & ~sign_bit_mask; const sgn = @as(TBits, @bitCast(sign)) & sign_bit_mask; diff --git a/lib/std/math/frexp.zig b/lib/std/math/frexp.zig index 3fb34060759960cc5ddcf6a880e5cfd9672761ed..815dd150debbdd663a502329f9ba819252c6f7d1 100644 --- a/lib/std/math/frexp.zig +++ b/lib/std/math/frexp.zig @@ -22,16 +22,16 @@ pub fn frexp(x: anytype) Frexp(@TypeOf(x)) { const T: type = @TypeOf(x); const bits: comptime_int = @typeInfo(T).float.bits; - const Int: type = std.meta.Int(.unsigned, bits); + const Int: type = @Int(.unsigned, bits); const exp_bits: comptime_int = math.floatExponentBits(T); const mant_bits: comptime_int = math.floatMantissaBits(T); const frac_bits: comptime_int = math.floatFractionalBits(T); const exp_min: comptime_int = math.floatExponentMin(T); - const ExpInt: type = std.meta.Int(.unsigned, exp_bits); - const MantInt: type = std.meta.Int(.unsigned, mant_bits); - const FracInt: type = std.meta.Int(.unsigned, frac_bits); + const ExpInt: type = @Int(.unsigned, exp_bits); + const MantInt: type = @Int(.unsigned, mant_bits); + const FracInt: type = @Int(.unsigned, frac_bits); const unreal_exponent: comptime_int = (1 << exp_bits) - 1; const bias: comptime_int = (1 << (exp_bits - 1)) - 2; diff --git a/lib/std/math/ilogb.zig b/lib/std/math/ilogb.zig index ba6075208dce46e694349bb5712b5a91b10bb956..f5f09c265e3b0865b8739b5c9753437e5accd282 100644 --- a/lib/std/math/ilogb.zig +++ b/lib/std/math/ilogb.zig @@ -30,7 +30,7 @@ fn ilogbX(comptime T: type, x: T) i32 { const significandBits = math.floatMantissaBits(T); const exponentBits = math.floatExponentBits(T); - const Z = std.meta.Int(.unsigned, typeWidth); + const Z = @Int(.unsigned, typeWidth); const signBit = (@as(Z, 1) << (significandBits + exponentBits)); const maxExponent = ((1 << exponentBits) - 1); diff --git a/lib/std/math/isfinite.zig b/lib/std/math/isfinite.zig index 8f4e170989e57bc01575f47b093c4f4ac76f63c2..3c07c4b9d3f390e696827e5bf8c85444e7304027 100644 --- a/lib/std/math/isfinite.zig +++ b/lib/std/math/isfinite.zig @@ -5,7 +5,7 @@ const expect = std.testing.expect; /// Returns whether x is a finite value. pub fn isFinite(x: anytype) bool { const T = @TypeOf(x); - const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const TBits = @Int(.unsigned, @typeInfo(T).float.bits); const remove_sign = ~@as(TBits, 0) >> 1; return @as(TBits, @bitCast(x)) & remove_sign < @as(TBits, @bitCast(math.inf(T))); } diff --git a/lib/std/math/isinf.zig b/lib/std/math/isinf.zig index 220f43209d8914dd5a177c17b5255248c6fdc72b..a96d446611914168a24bb7d4a455d275a1d28f16 100644 --- a/lib/std/math/isinf.zig +++ b/lib/std/math/isinf.zig @@ -5,7 +5,7 @@ const expect = std.testing.expect; /// Returns whether x is an infinity, ignoring sign. pub inline fn isInf(x: anytype) bool { const T = @TypeOf(x); - const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const TBits = @Int(.unsigned, @typeInfo(T).float.bits); const remove_sign = ~@as(TBits, 0) >> 1; return @as(TBits, @bitCast(x)) & remove_sign == @as(TBits, @bitCast(math.inf(T))); } diff --git a/lib/std/math/isnan.zig b/lib/std/math/isnan.zig index b3de93597afe3a9416d7261fe07b1990b5777e39..cbfe15a2fd6a37dbe4cd963bdc2310f36c75f60d 100644 --- a/lib/std/math/isnan.zig +++ b/lib/std/math/isnan.zig @@ -1,7 +1,6 @@ const std = @import("../std.zig"); const builtin = @import("builtin"); const math = std.math; -const meta = std.meta; const expect = std.testing.expect; pub fn isNan(x: anytype) bool { @@ -12,7 +11,7 @@ pub fn isNan(x: anytype) bool { /// this is tracked by https://github.com/ziglang/zig/issues/14366 pub fn isSignalNan(x: anytype) bool { const T = @TypeOf(x); - const U = meta.Int(.unsigned, @bitSizeOf(T)); + const U = @Int(.unsigned, @bitSizeOf(T)); const quiet_signal_bit_mask = 1 << (math.floatFractionalBits(T) - 1); return isNan(x) and (@as(U, @bitCast(x)) & quiet_signal_bit_mask == 0); } diff --git a/lib/std/math/isnormal.zig b/lib/std/math/isnormal.zig index f3d09441e7526906a2c08ad10396b3f2d6b53fb4..dadcec7774a86d6240ddffa8bd141aae76ab6301 100644 --- a/lib/std/math/isnormal.zig +++ b/lib/std/math/isnormal.zig @@ -5,7 +5,7 @@ const expect = std.testing.expect; /// Returns whether x is neither zero, subnormal, infinity, or NaN. pub fn isNormal(x: anytype) bool { const T = @TypeOf(x); - const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const TBits = @Int(.unsigned, @typeInfo(T).float.bits); const increment_exp = 1 << math.floatMantissaBits(T); const remove_sign = ~@as(TBits, 0) >> 1; @@ -22,7 +22,7 @@ pub fn isNormal(x: anytype) bool { test isNormal { // TODO add `c_longdouble' when math.inf(T) supports it inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { - const TBits = std.meta.Int(.unsigned, @bitSizeOf(T)); + const TBits = @Int(.unsigned, @bitSizeOf(T)); // normals try expect(isNormal(@as(T, 1.0))); diff --git a/lib/std/math/iszero.zig b/lib/std/math/iszero.zig index 57d8250afd3077c16a208e407fe97cee414f9f57..31ad5da53f55db9bb1f8c4fb1bd0e1a586f3feb4 100644 --- a/lib/std/math/iszero.zig +++ b/lib/std/math/iszero.zig @@ -6,7 +6,7 @@ const expect = std.testing.expect; pub inline fn isPositiveZero(x: anytype) bool { const T = @TypeOf(x); const bit_count = @typeInfo(T).float.bits; - const TBits = std.meta.Int(.unsigned, bit_count); + const TBits = @Int(.unsigned, bit_count); return @as(TBits, @bitCast(x)) == @as(TBits, 0); } @@ -14,7 +14,7 @@ pub inline fn isPositiveZero(x: anytype) bool { pub inline fn isNegativeZero(x: anytype) bool { const T = @TypeOf(x); const bit_count = @typeInfo(T).float.bits; - const TBits = std.meta.Int(.unsigned, bit_count); + const TBits = @Int(.unsigned, bit_count); return @as(TBits, @bitCast(x)) == @as(TBits, 1) << (bit_count - 1); } diff --git a/lib/std/math/ldexp.zig b/lib/std/math/ldexp.zig index 3b982a9bc20082fc0393d7a650bd382ffb7ac551..ecc213a5bfe4f6ca0d0a6c6d9c6331986a8b518d 100644 --- a/lib/std/math/ldexp.zig +++ b/lib/std/math/ldexp.zig @@ -7,7 +7,7 @@ const expect = std.testing.expect; /// Returns x * 2^n. pub fn ldexp(x: anytype, n: i32) @TypeOf(x) { const T = @TypeOf(x); - const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const TBits = @Int(.unsigned, @typeInfo(T).float.bits); const exponent_bits = math.floatExponentBits(T); const mantissa_bits = math.floatMantissaBits(T); @@ -103,7 +103,7 @@ test ldexp { // Multiplications might flush the denormals to zero, esp. at // runtime, so we manually construct the constants here instead. - const Z = std.meta.Int(.unsigned, @bitSizeOf(T)); + const Z = @Int(.unsigned, @bitSizeOf(T)); const EightTimesTrueMin = @as(T, @bitCast(@as(Z, 8))); const TwoTimesTrueMin = @as(T, @bitCast(@as(Z, 2))); diff --git a/lib/std/math/nextafter.zig b/lib/std/math/nextafter.zig index 6586401f4fb4f4e247b7e3180873aba9f51397fe..15957dc4b4beda314dde5e0e16283bc5969a6d90 100644 --- a/lib/std/math/nextafter.zig +++ b/lib/std/math/nextafter.zig @@ -90,7 +90,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T { return x_parts.toFloat(); } else { - const Bits = std.meta.Int(.unsigned, @bitSizeOf(T)); + const Bits = @Int(.unsigned, @bitSizeOf(T)); var x_bits: Bits = @bitCast(x); if ((x > 0.0) == (y > x)) { x_bits += 1; @@ -320,6 +320,6 @@ test "float" { /// Helps ensure that 0.0 doesn't compare equal to -0.0. fn bitwiseEqual(comptime T: type, x: T, y: T) bool { comptime assert(@typeInfo(T) == .float); - const Bits = std.meta.Int(.unsigned, @bitSizeOf(T)); + const Bits = @Int(.unsigned, @bitSizeOf(T)); return @as(Bits, @bitCast(x)) == @as(Bits, @bitCast(y)); } diff --git a/lib/std/math/pow.zig b/lib/std/math/pow.zig index 4eb5fdf1f810fa6f2880cba09fc06c7130aee90c..e445e4f9abd19f7549844113845b662abf321a87 100644 --- a/lib/std/math/pow.zig +++ b/lib/std/math/pow.zig @@ -147,7 +147,7 @@ pub fn pow(comptime T: type, x: T, y: T) T { var xe = r2.exponent; var x1 = r2.significand; - var i = @as(std.meta.Int(.signed, @typeInfo(T).float.bits), @intFromFloat(yi)); + var i = @as(@Int(.signed, @typeInfo(T).float.bits), @intFromFloat(yi)); while (i != 0) : (i >>= 1) { const overflow_shift = math.floatExponentBits(T) + 1; if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) { diff --git a/lib/std/mem.zig b/lib/std/mem.zig index 125f1688d3f1b41beb14e3259717555473beeb8d..e04dfa4353bbd413f1b549c7c589fd72e0101c42 100644 --- a/lib/std/mem.zig +++ b/lib/std/mem.zig @@ -1777,7 +1777,7 @@ pub fn readVarInt(comptime ReturnType: type, bytes: []const u8, endian: Endian) assert(@typeInfo(ReturnType).int.bits >= bytes.len * 8); const bits = @typeInfo(ReturnType).int.bits; const signedness = @typeInfo(ReturnType).int.signedness; - const WorkType = std.meta.Int(signedness, @max(16, bits)); + const WorkType = @Int(signedness, @max(16, bits)); var result: WorkType = 0; switch (endian) { .big => { @@ -1828,8 +1828,8 @@ pub fn readVarPackedInt( endian: std.builtin.Endian, signedness: std.builtin.Signedness, ) T { - const uN = std.meta.Int(.unsigned, @bitSizeOf(T)); - const iN = std.meta.Int(.signed, @bitSizeOf(T)); + const uN = @Int(.unsigned, @bitSizeOf(T)); + const iN = @Int(.signed, @bitSizeOf(T)); const Log2N = std.math.Log2Int(T); const read_size = (bit_count + (bit_offset % 8) + 7) / 8; @@ -1921,7 +1921,7 @@ test readInt { } fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T { - const uN = std.meta.Int(.unsigned, @bitSizeOf(T)); + const uN = @Int(.unsigned, @bitSizeOf(T)); const Log2N = std.math.Log2Int(T); const bit_count = @as(usize, @bitSizeOf(T)); @@ -1929,7 +1929,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T const load_size = (bit_count + 7) / 8; const load_tail_bits = @as(u3, @intCast((load_size * 8) - bit_count)); - const LoadInt = std.meta.Int(.unsigned, load_size * 8); + const LoadInt = @Int(.unsigned, load_size * 8); if (bit_count == 0) return 0; @@ -1947,7 +1947,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T } fn readPackedIntBig(comptime T: type, bytes: []const u8, bit_offset: usize) T { - const uN = std.meta.Int(.unsigned, @bitSizeOf(T)); + const uN = @Int(.unsigned, @bitSizeOf(T)); const Log2N = std.math.Log2Int(T); const bit_count = @as(usize, @bitSizeOf(T)); @@ -1956,7 +1956,7 @@ fn readPackedIntBig(comptime T: type, bytes: []const u8, bit_offset: usize) T { const load_size = (bit_count + 7) / 8; const load_tail_bits = @as(u3, @intCast((load_size * 8) - bit_count)); - const LoadInt = std.meta.Int(.unsigned, load_size * 8); + const LoadInt = @Int(.unsigned, load_size * 8); if (bit_count == 0) return 0; @@ -2061,7 +2061,7 @@ test writeInt { } fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void { - const uN = std.meta.Int(.unsigned, @bitSizeOf(T)); + const uN = @Int(.unsigned, @bitSizeOf(T)); const Log2N = std.math.Log2Int(T); const bit_count = @as(usize, @bitSizeOf(T)); @@ -2069,7 +2069,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: const store_size = (@bitSizeOf(T) + 7) / 8; const store_tail_bits = @as(u3, @intCast((store_size * 8) - bit_count)); - const StoreInt = std.meta.Int(.unsigned, store_size * 8); + const StoreInt = @Int(.unsigned, store_size * 8); if (bit_count == 0) return; @@ -2094,7 +2094,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: } fn writePackedIntBig(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void { - const uN = std.meta.Int(.unsigned, @bitSizeOf(T)); + const uN = @Int(.unsigned, @bitSizeOf(T)); const Log2N = std.math.Log2Int(T); const bit_count = @as(usize, @bitSizeOf(T)); @@ -2103,7 +2103,7 @@ fn writePackedIntBig(comptime T: type, bytes: []u8, bit_offset: usize, value: T) const store_size = (@bitSizeOf(T) + 7) / 8; const store_tail_bits = @as(u3, @intCast((store_size * 8) - bit_count)); - const StoreInt = std.meta.Int(.unsigned, store_size * 8); + const StoreInt = @Int(.unsigned, store_size * 8); if (bit_count == 0) return; @@ -2160,7 +2160,7 @@ test writePackedInt { /// If negative, the written value is sign-extended. pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value: anytype, endian: std.builtin.Endian) void { const T = @TypeOf(value); - const uN = std.meta.Int(.unsigned, @bitSizeOf(T)); + const uN = @Int(.unsigned, @bitSizeOf(T)); const bit_shift = @as(u3, @intCast(bit_offset % 8)); const write_size = (bit_count + bit_shift + 7) / 8; @@ -2242,7 +2242,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a }, .bool => {}, .float => |float_info| { - @field(ptr, f.name) = @bitCast(@byteSwap(@as(std.meta.Int(.unsigned, float_info.bits), @bitCast(@field(ptr, f.name))))); + @field(ptr, f.name) = @bitCast(@byteSwap(@as(@Int(.unsigned, float_info.bits), @bitCast(@field(ptr, f.name))))); }, else => { @field(ptr, f.name) = @byteSwap(@field(ptr, f.name)); @@ -2262,7 +2262,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a } } - const BackingInt = std.meta.Int(.unsigned, @bitSizeOf(S)); + const BackingInt = @Int(.unsigned, @bitSizeOf(S)); ptr.* = @bitCast(@byteSwap(@as(BackingInt, @bitCast(ptr.*)))); }, .array => |info| { @@ -2370,7 +2370,7 @@ pub fn byteSwapAllElements(comptime Elem: type, slice: []Elem) void { }, .bool => {}, .float => |float_info| { - elem.* = @bitCast(@byteSwap(@as(std.meta.Int(.unsigned, float_info.bits), @bitCast(elem.*)))); + elem.* = @bitCast(@byteSwap(@as(@Int(.unsigned, float_info.bits), @bitCast(elem.*)))); }, else => { elem.* = @byteSwap(elem.*); @@ -4800,7 +4800,7 @@ pub fn doNotOptimizeAway(val: anytype) void { const bits = t.int.bits; if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) { const val2 = @as( - std.meta.Int(t.int.signedness, @max(8, std.math.ceilPowerOfTwoAssert(u16, bits))), + @Int(t.int.signedness, @max(8, std.math.ceilPowerOfTwoAssert(u16, bits))), val, ); asm volatile ("" @@ -5035,8 +5035,8 @@ test "read/write(Var)PackedInt" { if (@bitSizeOf(PackedType) > @bitSizeOf(BackingType)) continue; - const iPackedType = std.meta.Int(.signed, @bitSizeOf(PackedType)); - const uPackedType = std.meta.Int(.unsigned, @bitSizeOf(PackedType)); + const iPackedType = @Int(.signed, @bitSizeOf(PackedType)); + const uPackedType = @Int(.unsigned, @bitSizeOf(PackedType)); const Log2T = std.math.Log2Int(BackingType); const offset_at_end = @bitSizeOf(BackingType) - @bitSizeOf(PackedType); @@ -5103,8 +5103,8 @@ test "read/write(Var)PackedInt" { } const signedness = @typeInfo(PackedType).int.signedness; - const NextPowerOfTwoInt = std.meta.Int(signedness, try comptime std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType))); - const ui64 = std.meta.Int(signedness, 64); + const NextPowerOfTwoInt = @Int(signedness, try std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType))); + const ui64 = @Int(signedness, 64); inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| { { // Variable-size Read/Write (Native-endian) diff --git a/lib/std/meta.zig b/lib/std/meta.zig index 02777aa5f848f326070a0218da9d3c3ef1983ff7..ff4c994ad6279ec3cecdbf1b0d6412bbee03a1ad 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -751,11 +751,6 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int { return null; } -/// Deprecated: use @Int -pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type { - return @Int(signedness, bit_count); -} - pub fn Float(comptime bit_count: u8) type { return switch (bit_count) { 16 => f16, diff --git a/lib/std/meta/trailer_flags.zig b/lib/std/meta/trailer_flags.zig index 44a5258a142bb605c30b447d2c30f1d82fe49a9a..d6c2609da111998a25eac3ceb1c15b5da623f6e8 100644 --- a/lib/std/meta/trailer_flags.zig +++ b/lib/std/meta/trailer_flags.zig @@ -13,7 +13,7 @@ pub fn TrailerFlags(comptime Fields: type) type { return struct { bits: Int, - pub const Int = meta.Int(.unsigned, bit_count); + pub const Int = @Int(.unsigned, bit_count); pub const bit_count = @typeInfo(Fields).@"struct".fields.len; pub const FieldEnum = std.meta.FieldEnum(Fields); diff --git a/lib/std/os/emscripten.zig b/lib/std/os/emscripten.zig index bb833a519a0d4561f61eca8ff33cf14158501135..1e1945636de4aeef57444ea9e9a2e265687e130c 100644 --- a/lib/std/os/emscripten.zig +++ b/lib/std/os/emscripten.zig @@ -17,7 +17,7 @@ pub const CLOCK = linux.CLOCK; pub const CPU_SETSIZE = 128; pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize; -pub const cpu_count_t = std.meta.Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); +pub const cpu_count_t = @Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { var sum: cpu_count_t = 0; diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index 14a700ce3f66be5995fe96f83ff88419db9b79e4..98c3f6131ee97a17ac425e376894106979dca7e5 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -6291,7 +6291,7 @@ pub const dl_phdr_info = extern struct { pub const CPU_SETSIZE = 128; pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize; -pub const cpu_count_t = std.meta.Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); +pub const cpu_count_t = @Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { var sum: cpu_count_t = 0; diff --git a/lib/std/os/linux/ioctl.zig b/lib/std/os/linux/ioctl.zig index 8b7cc80af968507062dd356edde08a4ff613a455..a5a6e854f70defa5f9a0e07547bfbb97909cab8c 100644 --- a/lib/std/os/linux/ioctl.zig +++ b/lib/std/os/linux/ioctl.zig @@ -15,12 +15,12 @@ const bits = switch (@import("builtin").cpu.arch) { else => .{ .size = 14, .dir = 2, .none = 0, .read = 2, .write = 1 }, }; -const Direction = std.meta.Int(.unsigned, bits.dir); +const Direction = @Int(.unsigned, bits.dir); pub const Request = packed struct { nr: u8, io_type: u8, - size: std.meta.Int(.unsigned, bits.size), + size: @Int(.unsigned, bits.size), dir: Direction, }; diff --git a/lib/std/os/uefi/tables/runtime_services.zig b/lib/std/os/uefi/tables/runtime_services.zig index 1881aab7f79ec1b675b818ab1134069dbddf7f59..7c3a48a81e9cef3a8897feb55ea2c755f6918eeb 100644 --- a/lib/std/os/uefi/tables/runtime_services.zig +++ b/lib/std/os/uefi/tables/runtime_services.zig @@ -419,7 +419,7 @@ pub const RuntimeServices = extern struct { pub const DebugDisposition = enum(usize) { const Bits = packed struct(usize) { optional_ptr: bool = false, - _pad: std.meta.Int(.unsigned, @bitSizeOf(usize) - 1) = 0, + _pad: @Int(.unsigned, @bitSizeOf(usize) - 1) = 0, }; pointer = @bitCast(Bits{}), diff --git a/lib/std/posix.zig b/lib/std/posix.zig index f61293e20e916550195c86f92fb45c258a55b89f..453dcced31f3c835333212f094574e77f7a59a10 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -803,7 +803,7 @@ pub fn dl_iterate_phdr( } }.callbackC, @ptrCast(@constCast(&context)))) { 0 => return, - else => |err| return @as(Error, @errorCast(@errorFromInt(@as(std.meta.Int(.unsigned, @bitSizeOf(anyerror)), @intCast(err))))), + else => |err| return @as(Error, @errorCast(@errorFromInt(@as(@Int(.unsigned, @bitSizeOf(anyerror)), @intCast(err))))), } } diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 92f086b187c9eda5da3ffe9fa17cfd80f998b895..57bddc49bb9efc0a7a5ea5082a77f2d3c0314e48 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -163,7 +163,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void { } } - const BackingInt = std.meta.Int(.unsigned, @bitSizeOf(T)); + const BackingInt = @Int(.unsigned, @bitSizeOf(T)); return expectEqual( @as(BackingInt, @bitCast(expected)), @as(BackingInt, @bitCast(actual)), diff --git a/lib/std/zig/llvm/Builder.zig b/lib/std/zig/llvm/Builder.zig index f6b59d5c82e936f102f9c9fb654b455f22f97c59..8599160f710999f4f83a9eccefb28afb2d6c99c1 100644 --- a/lib/std/zig/llvm/Builder.zig +++ b/lib/std/zig/llvm/Builder.zig @@ -7657,9 +7657,9 @@ pub const Constant = enum(u32) { .float => { const Float = struct { fn Repr(comptime T: type) type { - return packed struct(std.meta.Int(.unsigned, @bitSizeOf(T))) { - mantissa: std.meta.Int(.unsigned, std.math.floatMantissaBits(T)), - exponent: std.meta.Int(.unsigned, std.math.floatExponentBits(T)), + return packed struct(@Int(.unsigned, @bitSizeOf(T))) { + mantissa: @Int(.unsigned, std.math.floatMantissaBits(T)), + exponent: @Int(.unsigned, std.math.floatExponentBits(T)), sign: u1, }; } diff --git a/lib/std/zig/llvm/bitcode_writer.zig b/lib/std/zig/llvm/bitcode_writer.zig index 3d3246b8971aedbbe608a9abe8226bb028c6b4a2..4fdfb630b94c0e0b172c09e60352528104354301 100644 --- a/lib/std/zig/llvm/bitcode_writer.zig +++ b/lib/std/zig/llvm/bitcode_writer.zig @@ -404,7 +404,7 @@ fn charTo6Bit(c: u8) u8 { } fn BufType(comptime T: type, comptime min_len: usize) type { - return std.meta.Int(.unsigned, @max(min_len, @bitSizeOf(switch (@typeInfo(T)) { + return @Int(.unsigned, @max(min_len, @bitSizeOf(switch (@typeInfo(T)) { .comptime_int => u32, .int => |info| if (info.signedness == .unsigned) T @@ -414,7 +414,7 @@ fn BufType(comptime T: type, comptime min_len: usize) type { .bool => u1, .@"struct" => |info| switch (info.layout) { .auto, .@"extern" => @compileError("Unsupported type: " ++ @typeName(T)), - .@"packed" => std.meta.Int(.unsigned, @bitSizeOf(T)), + .@"packed" => @Int(.unsigned, @bitSizeOf(T)), }, else => @compileError("Unsupported type: " ++ @typeName(T)), }))); @@ -425,7 +425,7 @@ fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min .comptime_int, .int => @intCast(value), .@"enum" => @intFromEnum(value), .bool => @intFromBool(value), - .@"struct" => @intCast(@as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))), + .@"struct" => @intCast(@as(@Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))), else => unreachable, }; } diff --git a/lib/std/zig/llvm/ir.zig b/lib/std/zig/llvm/ir.zig index 13cc180d4d3346a64955be7bc6c488b5951e8bd5..00c20c3b425a10ea17d09941c5c8ce1b57ac1a39 100644 --- a/lib/std/zig/llvm/ir.zig +++ b/lib/std/zig/llvm/ir.zig @@ -235,7 +235,7 @@ pub const ModuleBlock = struct { is_const: AddrSpaceAndIsConst, initid: u32, linkage: Builder.Linkage, - alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), + alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), section: usize, visibility: Builder.Visibility, thread_local: Builder.ThreadLocal, @@ -275,7 +275,7 @@ pub const ModuleBlock = struct { is_proto: bool, linkage: Builder.Linkage, paramattr: usize, - alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), + alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), section: usize, visibility: Builder.Visibility, unnamed_addr: Builder.UnnamedAddr, @@ -1214,7 +1214,7 @@ pub const ModuleBlock = struct { }; ptr: u32, ty: Builder.Type, - alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), + alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), is_volatile: bool, }; @@ -1230,7 +1230,7 @@ pub const ModuleBlock = struct { }; ptr: u32, ty: Builder.Type, - alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), + alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), is_volatile: bool, success_ordering: Builder.AtomicOrdering, sync_scope: Builder.SyncScope, @@ -1246,7 +1246,7 @@ pub const ModuleBlock = struct { }; ptr: u32, val: u32, - alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), + alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), is_volatile: bool, }; @@ -1262,7 +1262,7 @@ pub const ModuleBlock = struct { }; ptr: u32, val: u32, - alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), + alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), is_volatile: bool, success_ordering: Builder.AtomicOrdering, sync_scope: Builder.SyncScope, @@ -1317,7 +1317,7 @@ pub const ModuleBlock = struct { is_volatile: bool, success_ordering: Builder.AtomicOrdering, sync_scope: Builder.SyncScope, - alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), + alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), }; pub const CmpXchg = struct { @@ -1341,7 +1341,7 @@ pub const ModuleBlock = struct { sync_scope: Builder.SyncScope, failure_ordering: Builder.AtomicOrdering, is_weak: bool, - alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), + alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), }; pub const Fence = struct { diff --git a/src/Air/Liveness.zig b/src/Air/Liveness.zig index 9420a6e2c39287d43ff48d7623ac1b5d8079fac1..0178a2244a4deabf4de32c557b2fcc4aef779da2 100644 --- a/src/Air/Liveness.zig +++ b/src/Air/Liveness.zig @@ -301,7 +301,7 @@ pub fn iterateBigTomb(l: Liveness, inst: Air.Inst.Index) BigTomb { /// How many tomb bits per AIR instruction. pub const bpi = 4; -pub const Bpi = std.meta.Int(.unsigned, bpi); +pub const Bpi = @Int(.unsigned, bpi); pub const OperandInt = std.math.Log2Int(Bpi); /// Useful for decoders of Liveness information. diff --git a/src/InternPool.zig b/src/InternPool.zig index 7471fa78f674dcde3d4b080b2e7b42c696151749..5aae9ad9779f5e958f7d0311164c87d9b521d881 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -2660,7 +2660,7 @@ pub const Key = union(enum) { switch (float.storage) { inline else => |val| std.hash.autoHash( &hasher, - @as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(val))), @bitCast(val)), + @as(@Int(.unsigned, @bitSizeOf(@TypeOf(val))), @bitCast(val)), ), } return hasher.final(); @@ -3012,7 +3012,7 @@ pub const Key = union(enum) { switch (a_info.storage) { inline else => |val, tag| { - const Bits = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(val))); + const Bits = @Int(.unsigned, @bitSizeOf(@TypeOf(val))); const a_bits: Bits = @bitCast(val); const b_bits: Bits = @bitCast(@field(b_info.storage, @tagName(tag))); return a_bits == b_bits; diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 4eec8b49a0ae6349208e84ee7fa6809b73520745..400c1ef515e119977ac478f58b2c8b4a54c945e2 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -7221,7 +7221,7 @@ fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Alt(FormatStringCont fn undefPattern(comptime IntType: type) IntType { const int_info = @typeInfo(IntType).int; - const UnsignedType = std.meta.Int(.unsigned, int_info.bits); + const UnsignedType = @Int(.unsigned, int_info.bits); return @bitCast(@as(UnsignedType, (1 << (int_info.bits | 1)) / 3)); } diff --git a/src/codegen/riscv64/bits.zig b/src/codegen/riscv64/bits.zig index 94c64dfc98de50e7ecb8183a2008c7014e222ebd..070252593581f88ae7fa6dc6edfa19c95fc7d565 100644 --- a/src/codegen/riscv64/bits.zig +++ b/src/codegen/riscv64/bits.zig @@ -118,7 +118,7 @@ pub const Immediate = union(enum) { const int_info = @typeInfo(T).int; if (int_info.signedness != .unsigned) @compileError("Immediate.asBits needs unsigned T"); return switch (imm) { - .signed => |x| @bitCast(@as(std.meta.Int(.signed, int_info.bits), @intCast(x))), + .signed => |x| @bitCast(@as(@Int(.signed, int_info.bits), @intCast(x))), .unsigned => |x| @intCast(x), }; } diff --git a/src/codegen/spirv/Assembler.zig b/src/codegen/spirv/Assembler.zig index 5b19f960a7a4f0d4fe8bf342f4224935b8e8146e..c2297c6558e289af7259e9871894bf5fe8bf35c4 100644 --- a/src/codegen/spirv/Assembler.zig +++ b/src/codegen/spirv/Assembler.zig @@ -821,7 +821,7 @@ fn parseContextDependentFloat(ass: *Assembler, comptime width: u16) !void { const gpa = ass.cg.module.gpa; const Float = std.meta.Float(width); - const Int = std.meta.Int(.unsigned, width); + const Int = @Int(.unsigned, width); const tok = ass.currentToken(); try ass.expectToken(.value); diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig index 5059b2c8661750c0a9ac50d821f8c1b6b3d3d46b..42009a7c9dbd5cd27e156d3f20e4e893bc9228a8 100644 --- a/src/codegen/spirv/Section.zig +++ b/src/codegen/spirv/Section.zig @@ -8,7 +8,7 @@ const testing = std.testing; const spec = @import("spec.zig"); const Word = spec.Word; -const DoubleWord = std.meta.Int(.unsigned, @bitSizeOf(Word) * 2); +const DoubleWord = @Int(.unsigned, @bitSizeOf(Word) * 2); const Log2Word = std.math.Log2Int(Word); const Opcode = spec.Opcode; diff --git a/test/behavior/abs.zig b/test/behavior/abs.zig index d50789bc238e28171a667f02e077bce8b8bbe38b..55c7ebf6a7b0704fa88c83e7afec14584eb00d55 100644 --- a/test/behavior/abs.zig +++ b/test/behavior/abs.zig @@ -155,7 +155,7 @@ test "@abs big int <= 128 bits" { try testAbsUnsignedBigInt(); } -fn abs(comptime T: type, a: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) { +fn abs(comptime T: type, a: T) @Int(.unsigned, @typeInfo(T).int.bits) { return @abs(a); } diff --git a/test/behavior/atomics.zig b/test/behavior/atomics.zig index a87b25305a4d8135d1c897a16b87f2ca57f34cf2..a8580904c5be15e8409eafaeac007ba38d00da75 100644 --- a/test/behavior/atomics.zig +++ b/test/behavior/atomics.zig @@ -232,7 +232,7 @@ fn testAtomicRmwInts() !void { } fn testAtomicRmwInt(comptime signedness: std.builtin.Signedness, comptime N: usize) !void { - const int = std.meta.Int(signedness, N); + const int = @Int(signedness, N); var x: int = 1; var res = @atomicRmw(int, &x, .Xchg, 3, .seq_cst); @@ -293,8 +293,8 @@ test "atomicrmw with 128-bit ints" { } fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void { - const uint = std.meta.Int(.unsigned, 128); - const int = std.meta.Int(signedness, 128); + const uint = @Int(.unsigned, 128); + const int = @Int(signedness, 128); const initial: int = @as(int, @bitCast(@as(uint, 0xaaaaaaaa_bbbbbbbb_cccccccc_dddddddd))); const replacement: int = 0x00000000_00000005_00000000_00000003; diff --git a/test/behavior/bit_shifting.zig b/test/behavior/bit_shifting.zig index bbf214fe16621fab044f12fca726a9d6798947fe..9eed252ac8ddc055038a0bf227616f3df49369bd 100644 --- a/test/behavior/bit_shifting.zig +++ b/test/behavior/bit_shifting.zig @@ -5,10 +5,10 @@ const builtin = @import("builtin"); fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type { const key_bits = @typeInfo(Key).int.bits; - std.debug.assert(Key == std.meta.Int(.unsigned, key_bits)); + std.debug.assert(Key == @Int(.unsigned, key_bits)); std.debug.assert(key_bits >= mask_bit_count); const shard_key_bits = mask_bit_count; - const ShardKey = std.meta.Int(.unsigned, mask_bit_count); + const ShardKey = @Int(.unsigned, mask_bit_count); const shift_amount = key_bits - shard_key_bits; return struct { const Self = @This(); diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig index 660ace22803ef0c719029757c4436db3f4e8690f..3bbdfb38d480ce2faef86f0570708cc6285cf826 100644 --- a/test/behavior/bitcast.zig +++ b/test/behavior/bitcast.zig @@ -49,8 +49,8 @@ test "@bitCast iX -> uX exotic integers" { } fn testBitCast(comptime N: usize) !void { - const iN = std.meta.Int(.signed, N); - const uN = std.meta.Int(.unsigned, N); + const iN = @Int(.signed, N); + const uN = @Int(.unsigned, N); try expect(conv_iN(N, -1) == maxInt(uN)); try expect(conv_uN(N, maxInt(uN)) == -1); @@ -69,12 +69,12 @@ fn testBitCast(comptime N: usize) !void { } } -fn conv_iN(comptime N: usize, x: std.meta.Int(.signed, N)) std.meta.Int(.unsigned, N) { - return @as(std.meta.Int(.unsigned, N), @bitCast(x)); +fn conv_iN(comptime N: usize, x: @Int(.signed, N)) @Int(.unsigned, N) { + return @as(@Int(.unsigned, N), @bitCast(x)); } -fn conv_uN(comptime N: usize, x: std.meta.Int(.unsigned, N)) std.meta.Int(.signed, N) { - return @as(std.meta.Int(.signed, N), @bitCast(x)); +fn conv_uN(comptime N: usize, x: @Int(.unsigned, N)) @Int(.signed, N) { + return @as(@Int(.signed, N), @bitCast(x)); } test "bitcast uX to bytes" { @@ -101,7 +101,7 @@ fn testBitCastuXToBytes(comptime N: usize) !void { // on the platforms we target. If the above behavior is restricted after all, // this test should be deleted. - const T = std.meta.Int(.unsigned, N); + const T = @Int(.unsigned, N); for ([_]T{ 0, ~@as(T, 0) }) |init_value| { var x: T = init_value; const bytes = std.mem.asBytes(&x); diff --git a/test/behavior/math.zig b/test/behavior/math.zig index 0d3823022bd979245c2d651918530fcaff4ae9ea..b7b383d358ea084ae2d340b0db8a97c8b44ec5d7 100644 --- a/test/behavior/math.zig +++ b/test/behavior/math.zig @@ -2359,7 +2359,7 @@ test "signed zeros are represented properly" { } fn testOne(comptime T: type) !void { - const ST = std.meta.Int(.unsigned, @typeInfo(T).float.bits); + const ST = @Int(.unsigned, @typeInfo(T).float.bits); var as_fp_val = -@as(T, 0.0); _ = &as_fp_val; const as_uint_val: ST = @bitCast(as_fp_val); -- 2.54.0