| author | |
| committer | |
| log | cd23f7a814bf81b3c06f4d016bcb006520a3158e |
| tree | 5cbff0f206ee77e8bbbde9a46071ea860c655ced |
| parent | 3d56df1716601440f580df3eee7e12bea44d919b |
| parent | bf953c4d6af5225d27cdfade564814a92321befb |
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 | 43 | try self.errors.append(self.allocator, error_details); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | const SmallestStringIndexType = std.meta.Int(.unsigned, @min( | |
| 46 | const SmallestStringIndexType = @Int(.unsigned, @min( | |
| 47 | 47 | @bitSizeOf(ErrorDetails.FileOpenError.FilenameStringIndex), |
| 48 | 48 | @min( |
| 49 | 49 | @bitSizeOf(ErrorDetails.IconReadError.FilenameStringIndex), |
| ... | ... | @@ -165,7 +165,7 @@ pub const ErrorDetails = struct { |
| 165 | 165 | err: FileOpenErrorEnum, |
| 166 | 166 | filename_string_index: FilenameStringIndex, |
| 167 | 167 | |
| 168 | pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(FileOpenErrorEnum)); | |
| 168 | pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(FileOpenErrorEnum)); | |
| 169 | 169 | pub const FileOpenErrorEnum = std.meta.FieldEnum(Io.File.OpenError || Io.File.StatError); |
| 170 | 170 | |
| 171 | 171 | pub fn enumFromError(err: (Io.File.OpenError || Io.File.StatError)) FileOpenErrorEnum { |
| ... | ... | @@ -180,7 +180,7 @@ pub const ErrorDetails = struct { |
| 180 | 180 | icon_type: enum(u1) { cursor, icon }, |
| 181 | 181 | filename_string_index: FilenameStringIndex, |
| 182 | 182 | |
| 183 | pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(IconReadErrorEnum) - 1); | |
| 183 | pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(IconReadErrorEnum) - 1); | |
| 184 | 184 | pub const IconReadErrorEnum = std.meta.FieldEnum(ico.ReadError); |
| 185 | 185 | |
| 186 | 186 | pub fn enumFromError(err: ico.ReadError) IconReadErrorEnum { |
| ... | ... | @@ -197,14 +197,14 @@ pub const ErrorDetails = struct { |
| 197 | 197 | bitmap_version: ico.BitmapHeader.Version = .unknown, |
| 198 | 198 | _: Padding = 0, |
| 199 | 199 | |
| 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 | }; |
| 202 | 202 | |
| 203 | 203 | pub const BitmapReadError = packed struct(u32) { |
| 204 | 204 | err: BitmapReadErrorEnum, |
| 205 | 205 | filename_string_index: FilenameStringIndex, |
| 206 | 206 | |
| 207 | pub const FilenameStringIndex = std.meta.Int(.unsigned, 32 - @bitSizeOf(BitmapReadErrorEnum)); | |
| 207 | pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(BitmapReadErrorEnum)); | |
| 208 | 208 | pub const BitmapReadErrorEnum = std.meta.FieldEnum(bmp.ReadError); |
| 209 | 209 | |
| 210 | 210 | pub fn enumFromError(err: bmp.ReadError) BitmapReadErrorEnum { |
| ... | ... | @@ -218,14 +218,14 @@ pub const ErrorDetails = struct { |
| 218 | 218 | dib_version: ico.BitmapHeader.Version, |
| 219 | 219 | filename_string_index: FilenameStringIndex, |
| 220 | 220 | |
| 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 | }; |
| 223 | 223 | |
| 224 | 224 | pub const AcceleratorError = packed struct(u32) { |
| 225 | 225 | err: AcceleratorErrorEnum, |
| 226 | 226 | _: Padding = 0, |
| 227 | 227 | |
| 228 | pub const Padding = std.meta.Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum)); | |
| 228 | pub const Padding = @Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum)); | |
| 229 | 229 | pub const AcceleratorErrorEnum = std.meta.FieldEnum(res.ParseAcceleratorKeyStringError); |
| 230 | 230 | |
| 231 | 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 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 { | |
| 578 | const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits); | |
| 577 | pub fn normalize(comptime T: type, significand: *@Int(.unsigned, @typeInfo(T).float.bits)) i32 { | |
| 578 | const Z = @Int(.unsigned, @typeInfo(T).float.bits); | |
| 579 | 579 | const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T); |
| 580 | 580 | |
| 581 | 581 | const shift = @clz(significand.*) - @clz(integerBit); |
| ... | ... | @@ -625,8 +625,8 @@ fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 { |
| 625 | 625 | pub fn HalveInt(comptime T: type, comptime signed_half: bool) type { |
| 626 | 626 | return extern union { |
| 627 | 627 | pub const bits = @divExact(@typeInfo(T).int.bits, 2); |
| 628 | pub const HalfTU = std.meta.Int(.unsigned, bits); | |
| 629 | pub const HalfTS = std.meta.Int(.signed, bits); | |
| 628 | pub const HalfTU = @Int(.unsigned, bits); | |
| 629 | pub const HalfTS = @Int(.signed, bits); | |
| 630 | 630 | pub const HalfT = if (signed_half) HalfTS else HalfTU; |
| 631 | 631 | |
| 632 | 632 | all: T, |
lib/compiler_rt/addf3.zig+1-1| ... | ... | @@ -8,7 +8,7 @@ const normalize = compiler_rt.normalize; |
| 8 | 8 | /// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/lib/builtins/fp_add_impl.inc |
| 9 | 9 | pub inline fn addf3(comptime T: type, a: T, b: T) T { |
| 10 | 10 | const bits = @typeInfo(T).float.bits; |
| 11 | const Z = std.meta.Int(.unsigned, bits); | |
| 11 | const Z = @Int(.unsigned, bits); | |
| 12 | 12 | |
| 13 | 13 | const typeWidth = bits; |
| 14 | 14 | const significandBits = math.floatMantissaBits(T); |
lib/compiler_rt/comparef.zig+3-3| ... | ... | @@ -162,8 +162,8 @@ pub const GE = enum(i32) { |
| 162 | 162 | |
| 163 | 163 | pub inline fn cmpf2(comptime T: type, comptime RT: type, a: T, b: T) RT { |
| 164 | 164 | const bits = @typeInfo(T).float.bits; |
| 165 | const srep_t = std.meta.Int(.signed, bits); | |
| 166 | const rep_t = std.meta.Int(.unsigned, bits); | |
| 165 | const srep_t = @Int(.signed, bits); | |
| 166 | const rep_t = @Int(.unsigned, bits); | |
| 167 | 167 | |
| 168 | 168 | const significandBits = std.math.floatMantissaBits(T); |
| 169 | 169 | const exponentBits = std.math.floatExponentBits(T); |
| ... | ... | @@ -253,7 +253,7 @@ test "cmp_f80" { |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | pub 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); | |
| 257 | 257 | |
| 258 | 258 | const significandBits = std.math.floatMantissaBits(T); |
| 259 | 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 | 198 | } |
| 199 | 199 | |
| 200 | 200 | inline 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 | 202 | var n: T = 1; |
| 203 | 203 | // adapted from Number of trailing zeroes (see ctzXi2) |
| 204 | 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 | 26 | } |
| 27 | 27 | |
| 28 | 28 | inline fn div(a: f64, b: f64) f64 { |
| 29 | const Z = std.meta.Int(.unsigned, 64); | |
| 30 | const SignedZ = std.meta.Int(.signed, 64); | |
| 29 | const Z = @Int(.unsigned, 64); | |
| 30 | const SignedZ = @Int(.signed, 64); | |
| 31 | 31 | |
| 32 | 32 | const significandBits = std.math.floatMantissaBits(f64); |
| 33 | 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 | 25 | } |
| 26 | 26 | |
| 27 | 27 | inline fn div(a: f32, b: f32) f32 { |
| 28 | const Z = std.meta.Int(.unsigned, 32); | |
| 28 | const Z = @Int(.unsigned, 32); | |
| 29 | 29 | |
| 30 | 30 | const significandBits = std.math.floatMantissaBits(f32); |
| 31 | 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 | 24 | } |
| 25 | 25 | |
| 26 | 26 | inline fn div(a: f128, b: f128) f128 { |
| 27 | const Z = std.meta.Int(.unsigned, 128); | |
| 27 | const Z = @Int(.unsigned, 128); | |
| 28 | 28 | |
| 29 | 29 | const significandBits = std.math.floatMantissaBits(f128); |
| 30 | 30 | const exponentBits = std.math.floatExponentBits(f128); |
lib/compiler_rt/divxf3.zig+1-1| ... | ... | @@ -13,7 +13,7 @@ comptime { |
| 13 | 13 | |
| 14 | 14 | pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 { |
| 15 | 15 | const T = f80; |
| 16 | const Z = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 16 | const Z = @Int(.unsigned, @bitSizeOf(T)); | |
| 17 | 17 | |
| 18 | 18 | const significandBits = std.math.floatMantissaBits(T); |
| 19 | 19 | const fractionalBits = std.math.floatFractionalBits(T); |
lib/compiler_rt/extendf.zig+5-5| ... | ... | @@ -3,10 +3,10 @@ const std = @import("std"); |
| 3 | 3 | pub inline fn extendf( |
| 4 | 4 | comptime dst_t: type, |
| 5 | 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 | 7 | ) dst_t { |
| 8 | const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits); | |
| 9 | const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits); | |
| 8 | const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits); | |
| 9 | const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits); | |
| 10 | 10 | const srcSigBits = std.math.floatMantissaBits(src_t); |
| 11 | 11 | const dstSigBits = std.math.floatMantissaBits(dst_t); |
| 12 | 12 | |
| ... | ... | @@ -70,8 +70,8 @@ pub inline fn extendf( |
| 70 | 70 | return @bitCast(result); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits)) f80 { | |
| 74 | const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits); | |
| 73 | pub inline fn extend_f80(comptime src_t: type, a: @Int(.unsigned, @typeInfo(src_t).float.bits)) f80 { | |
| 74 | const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits); | |
| 75 | 75 | const src_sig_bits = std.math.floatMantissaBits(src_t); |
| 76 | 76 | const dst_int_bit = 0x8000000000000000; |
| 77 | 77 | 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 | 47 | |
| 48 | 48 | inline fn generic_fabs(x: anytype) @TypeOf(x) { |
| 49 | 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 | 51 | const float_bits: TBits = @bitCast(x); |
| 52 | 52 | const remove_sign = ~@as(TBits, 0) >> 1; |
| 53 | 53 | return @bitCast(float_bits & remove_sign); |
lib/compiler_rt/float_from_int.zig+3-4| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const Int = std.meta.Int; | |
| 3 | 2 | const math = std.math; |
| 4 | 3 | |
| 5 | 4 | pub fn floatFromInt(comptime T: type, x: anytype) T { |
| ... | ... | @@ -7,14 +6,14 @@ pub fn floatFromInt(comptime T: type, x: anytype) T { |
| 7 | 6 | |
| 8 | 7 | // Various constants whose values follow from the type parameters. |
| 9 | 8 | // Any reasonable optimizer will fold and propagate all of these. |
| 10 | const Z = Int(.unsigned, @bitSizeOf(@TypeOf(x))); | |
| 11 | const uT = Int(.unsigned, @bitSizeOf(T)); | |
| 9 | const Z = @Int(.unsigned, @bitSizeOf(@TypeOf(x))); | |
| 10 | const uT = @Int(.unsigned, @bitSizeOf(T)); | |
| 12 | 11 | const inf = math.inf(T); |
| 13 | 12 | const float_bits = @bitSizeOf(T); |
| 14 | 13 | const int_bits = @bitSizeOf(@TypeOf(x)); |
| 15 | 14 | const exp_bits = math.floatExponentBits(T); |
| 16 | 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 | 17 | const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0; |
| 19 | 18 | const max_exp = exp_bias; |
| 20 | 19 |
lib/compiler_rt/fmax.zig+1-1| ... | ... | @@ -59,7 +59,7 @@ inline fn generic_fmax(comptime T: type, x: T, y: T) T { |
| 59 | 59 | test "generic_fmax" { |
| 60 | 60 | inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| { |
| 61 | 61 | const nan_val = math.nan(T); |
| 62 | const Int = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 62 | const Int = @Int(.unsigned, @bitSizeOf(T)); | |
| 63 | 63 | |
| 64 | 64 | try std.testing.expect(math.isNan(generic_fmax(T, nan_val, nan_val))); |
| 65 | 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 | 59 | test "generic_fmin" { |
| 60 | 60 | inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| { |
| 61 | 61 | const nan_val = math.nan(T); |
| 62 | const Int = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 62 | const Int = @Int(.unsigned, @bitSizeOf(T)); | |
| 63 | 63 | |
| 64 | 64 | try std.testing.expect(math.isNan(generic_fmin(T, nan_val, nan_val))); |
| 65 | 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 | 36 | /// Logic and flow heavily inspired by MUSL fmodl for 113 mantissa digits |
| 37 | 37 | pub fn __fmodx(a: f80, b: f80) callconv(.c) f80 { |
| 38 | 38 | const T = f80; |
| 39 | const Z = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 39 | const Z = @Int(.unsigned, @bitSizeOf(T)); | |
| 40 | 40 | |
| 41 | 41 | const significandBits = math.floatMantissaBits(T); |
| 42 | 42 | const fractionalBits = math.floatFractionalBits(T); |
| ... | ... | @@ -260,7 +260,7 @@ pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.c) c_longdouble { |
| 260 | 260 | |
| 261 | 261 | inline fn generic_fmod(comptime T: type, x: T, y: T) T { |
| 262 | 262 | const bits = @typeInfo(T).float.bits; |
| 263 | const uint = std.meta.Int(.unsigned, bits); | |
| 263 | const uint = @Int(.unsigned, bits); | |
| 264 | 264 | comptime assert(T == f32 or T == f64); |
| 265 | 265 | const digits = if (T == f32) 23 else 52; |
| 266 | 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 | 12 | const fractionalBits = math.floatFractionalBits(T); |
| 13 | 13 | const exponentBits = math.floatExponentBits(T); |
| 14 | 14 | |
| 15 | const Z = std.meta.Int(.unsigned, typeWidth); | |
| 15 | const Z = @Int(.unsigned, typeWidth); | |
| 16 | 16 | |
| 17 | 17 | // ZSignificand is large enough to contain the significand, including an explicit integer bit |
| 18 | 18 | const ZSignificand = PowerOfTwoSignificandZ(T); |
| ... | ... | @@ -195,7 +195,7 @@ fn normalize(comptime T: type, significand: *PowerOfTwoSignificandZ(T)) i32 { |
| 195 | 195 | /// the significand of T, including an explicit integer bit |
| 196 | 196 | fn PowerOfTwoSignificandZ(comptime T: type) type { |
| 197 | 197 | const bits = math.ceilPowerOfTwoAssert(u16, math.floatFractionalBits(T) + 1); |
| 198 | return std.meta.Int(.unsigned, bits); | |
| 198 | return @Int(.unsigned, bits); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | test { |
lib/compiler_rt/truncf.zig+3-3| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | |
| 3 | 3 | pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { |
| 4 | const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits); | |
| 5 | const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits); | |
| 4 | const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits); | |
| 5 | const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits); | |
| 6 | 6 | const srcSigBits = std.math.floatMantissaBits(src_t); |
| 7 | 7 | const dstSigBits = std.math.floatMantissaBits(dst_t); |
| 8 | 8 | |
| ... | ... | @@ -100,7 +100,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | pub 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 | 104 | const src_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit |
| 105 | 105 | const dst_sig_bits = std.math.floatMantissaBits(dst_t); |
| 106 | 106 |
lib/std/Build/abi.zig+1-1| ... | ... | @@ -266,7 +266,7 @@ pub const fuzz = struct { |
| 266 | 266 | .comptime_int => x, |
| 267 | 267 | .bool => @intFromBool(x), |
| 268 | 268 | .@"enum" => @intFromEnum(x), |
| 269 | else => @as(std.meta.Int(.unsigned, @bitSizeOf(T)), @bitCast(x)), | |
| 269 | else => @as(@Int(.unsigned, @bitSizeOf(T)), @bitCast(x)), | |
| 270 | 270 | |
| 271 | 271 | .int => |i| x: { |
| 272 | 272 | comptime { |
lib/std/Io/Threaded.zig+1-1| ... | ... | @@ -15574,7 +15574,7 @@ fn readIntFd(fd: posix.fd_t) !ErrInt { |
| 15574 | 15574 | return @intCast(std.mem.readInt(u64, &buffer, .little)); |
| 15575 | 15575 | } |
| 15576 | 15576 | |
| 15577 | const ErrInt = std.meta.Int(.unsigned, @sizeOf(anyerror) * 8); | |
| 15577 | const ErrInt = @Int(.unsigned, @sizeOf(anyerror) * 8); | |
| 15578 | 15578 | |
| 15579 | 15579 | fn destroyPipe(pipe: [2]posix.fd_t) void { |
| 15580 | 15580 | if (pipe[0] != -1) closeFd(pipe[0]); |
lib/std/Io/Writer.zig+2-2| ... | ... | @@ -1517,7 +1517,7 @@ pub fn printIntAny( |
| 1517 | 1517 | // The type must have the same size as `base` or be wider in order for the |
| 1518 | 1518 | // division to work |
| 1519 | 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); | |
| 1521 | 1521 | |
| 1522 | 1522 | const abs_value = @abs(value); |
| 1523 | 1523 | // 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 | 1637 | }); |
| 1638 | 1638 | |
| 1639 | 1639 | const T = @TypeOf(v); |
| 1640 | const TU = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 1640 | const TU = @Int(.unsigned, @bitSizeOf(T)); | |
| 1641 | 1641 | |
| 1642 | 1642 | const mantissa_bits = std.math.floatMantissaBits(T); |
| 1643 | 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 | 125 | /// `i` is evenly distributed. |
| 126 | 126 | pub fn int(r: Random, comptime T: type) T { |
| 127 | 127 | const bits = @typeInfo(T).int.bits; |
| 128 | const UnsignedT = std.meta.Int(.unsigned, bits); | |
| 128 | const UnsignedT = @Int(.unsigned, bits); | |
| 129 | 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); | |
| 131 | 131 | |
| 132 | 132 | var rand_bytes: [ceil_bytes]u8 = undefined; |
| 133 | 133 | r.bytes(&rand_bytes); |
| ... | ... | @@ -215,7 +215,7 @@ pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_tha |
| 215 | 215 | const info = @typeInfo(T).int; |
| 216 | 216 | if (info.signedness == .signed) { |
| 217 | 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 | 219 | const lo: UnsignedT = @bitCast(at_least); |
| 220 | 220 | const hi: UnsignedT = @bitCast(less_than); |
| 221 | 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 | 234 | const info = @typeInfo(T).int; |
| 235 | 235 | if (info.signedness == .signed) { |
| 236 | 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 | 238 | const lo: UnsignedT = @bitCast(at_least); |
| 239 | 239 | const hi: UnsignedT = @bitCast(less_than); |
| 240 | 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 | 252 | const info = @typeInfo(T).int; |
| 253 | 253 | if (info.signedness == .signed) { |
| 254 | 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 | 256 | const lo: UnsignedT = @bitCast(at_least); |
| 257 | 257 | const hi: UnsignedT = @bitCast(at_most); |
| 258 | 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 | 271 | const info = @typeInfo(T).int; |
| 272 | 272 | if (info.signedness == .signed) { |
| 273 | 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 | 275 | const lo: UnsignedT = @bitCast(at_least); |
| 276 | 276 | const hi: UnsignedT = @bitCast(at_most); |
| 277 | 277 | const result = lo +% r.uintAtMost(UnsignedT, hi -% lo); |
lib/std/Target.zig+1-1| ... | ... | @@ -1228,7 +1228,7 @@ pub const Cpu = struct { |
| 1228 | 1228 | pub const needed_bit_count = 347; |
| 1229 | 1229 | pub const byte_count = (needed_bit_count + 7) / 8; |
| 1230 | 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 | 1232 | pub const ShiftInt = std.math.Log2Int(usize); |
| 1233 | 1233 | |
| 1234 | 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 | 65 | pub const bit_length: usize = size; |
| 66 | 66 | |
| 67 | 67 | /// 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); | |
| 69 | 69 | |
| 70 | 70 | /// The integer type used to shift a mask in this bit set |
| 71 | 71 | pub const ShiftInt = std.math.Log2Int(MaskInt); |
| ... | ... | @@ -359,7 +359,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type { |
| 359 | 359 | if (!std.math.isPowerOfTwo(@bitSizeOf(MaskIntType))) { |
| 360 | 360 | var desired_bits = std.math.ceilPowerOfTwoAssert(usize, @bitSizeOf(MaskIntType)); |
| 361 | 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 | 363 | @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++ |
| 364 | 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 | 370 | if (@bitSizeOf(MaskIntType) != @sizeOf(MaskIntType) * byte_size) { |
| 371 | 371 | var desired_bits = @sizeOf(MaskIntType) * byte_size; |
| 372 | 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 | 374 | @compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++ |
| 375 | 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 | 7186 | NOW: bool = false, |
| 7187 | 7187 | GLOBAL: bool = false, |
| 7188 | 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 | 7191 | else => void, |
| 7192 | 7192 | }; |
| ... | ... | @@ -7366,7 +7366,7 @@ pub const AI = if (builtin.abi.isAndroid()) packed struct(u32) { |
| 7366 | 7366 | V4MAPPED: bool = false, |
| 7367 | 7367 | ALL: bool = false, |
| 7368 | 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 | 7371 | else => void, |
| 7372 | 7372 | }; |
| ... | ... | @@ -7399,7 +7399,7 @@ pub const NI = switch (native_os) { |
| 7399 | 7399 | NAMEREQD: bool = false, |
| 7400 | 7400 | NOFQDN: bool = false, |
| 7401 | 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 | 7404 | .freebsd, .haiku => packed struct(u32) { |
| 7405 | 7405 | NOFQDN: bool = false, |
| ... | ... | @@ -8635,7 +8635,7 @@ pub const O = switch (native_os) { |
| 8635 | 8635 | CLOEXEC: bool = false, |
| 8636 | 8636 | DIRECT: bool = false, |
| 8637 | 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 | 8640 | else => void, |
| 8641 | 8641 | }; |
| ... | ... | @@ -8789,7 +8789,7 @@ pub const MAP = switch (native_os) { |
| 8789 | 8789 | RANDOMIZED: bool = false, |
| 8790 | 8790 | PURGEABLE: bool = false, |
| 8791 | 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 | 8794 | else => void, |
| 8795 | 8795 | }; |
lib/std/compress/zstd/Decompress.zig+5-5| ... | ... | @@ -533,7 +533,7 @@ pub const Frame = struct { |
| 533 | 533 | table: Table, |
| 534 | 534 | accuracy_log: u8, |
| 535 | 535 | |
| 536 | const State = std.meta.Int(.unsigned, max_accuracy_log); | |
| 536 | const State = @Int(.unsigned, max_accuracy_log); | |
| 537 | 537 | }; |
| 538 | 538 | } |
| 539 | 539 | |
| ... | ... | @@ -1783,7 +1783,7 @@ const ReverseBitReader = struct { |
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 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 | 1787 | return .{ |
| 1788 | 1788 | @bitCast(@as(UT, @intCast(out))), |
| 1789 | 1789 | num, |
| ... | ... | @@ -1803,7 +1803,7 @@ const ReverseBitReader = struct { |
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | 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 | 1807 | const U = if (@bitSizeOf(T) < 8) u8 else UT; |
| 1808 | 1808 | |
| 1809 | 1809 | if (num <= self.count) return initBits(T, self.removeBits(@intCast(num)), num); |
| ... | ... | @@ -1871,7 +1871,7 @@ const BitReader = struct { |
| 1871 | 1871 | count: u4 = 0, |
| 1872 | 1872 | |
| 1873 | 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 | 1875 | return .{ |
| 1876 | 1876 | @bitCast(@as(UT, @intCast(out))), |
| 1877 | 1877 | num, |
| ... | ... | @@ -1891,7 +1891,7 @@ const BitReader = struct { |
| 1891 | 1891 | } |
| 1892 | 1892 | |
| 1893 | 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 | 1895 | const U = if (@bitSizeOf(T) < 8) u8 else UT; |
| 1896 | 1896 | |
| 1897 | 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 | 171 | block[0] = L - 1; // flags |
| 172 | 172 | @memcpy(block[1..][0..nonce_length], &npub); |
| 173 | 173 | // Counter goes in the last L bytes |
| 174 | const CounterInt = std.meta.Int(.unsigned, L * 8); | |
| 174 | const CounterInt = @Int(.unsigned, L * 8); | |
| 175 | 175 | mem.writeInt(CounterInt, block[1 + nonce_length ..][0..L], @as(CounterInt, @intCast(counter)), .big); |
| 176 | 176 | } |
| 177 | 177 | |
| ... | ... | @@ -229,7 +229,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le |
| 229 | 229 | @memcpy(block[1..][0..nonce_length], &npub); |
| 230 | 230 | |
| 231 | 231 | // Encode message length in last L bytes |
| 232 | const LengthInt = std.meta.Int(.unsigned, L * 8); | |
| 232 | const LengthInt = @Int(.unsigned, L * 8); | |
| 233 | 233 | mem.writeInt(LengthInt, block[1 + nonce_length ..][0..L], @as(LengthInt, @intCast(msg_len)), .big); |
| 234 | 234 | } |
| 235 | 235 |
lib/std/crypto/cmac.zig+1-1| ... | ... | @@ -74,7 +74,7 @@ pub fn Cmac(comptime BlockCipher: type) type { |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 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 | 78 | const l_ = mem.readInt(Int, &l, .big); |
| 79 | 79 | const l_2 = switch (block_length) { |
| 80 | 80 | 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 | 129 | const needs_padding: u1 = if (value == 0) |
| 130 | 130 | 1 |
| 131 | 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 | 133 | const right_shift: RightShift = @intCast(bits_needed - 9); |
| 134 | 134 | break :brk if (value >> right_shift == 0x1ff) 1 else 0; |
| 135 | 135 | } else 0; |
lib/std/crypto/ff.zig+2-3| ... | ... | @@ -10,7 +10,6 @@ const builtin = @import("builtin"); |
| 10 | 10 | const crypto = std.crypto; |
| 11 | 11 | const math = std.math; |
| 12 | 12 | const mem = std.mem; |
| 13 | const meta = std.meta; | |
| 14 | 13 | const testing = std.testing; |
| 15 | 14 | const assert = std.debug.assert; |
| 16 | 15 | const Endian = std.builtin.Endian; |
| ... | ... | @@ -25,7 +24,7 @@ const carry_bits = 1; |
| 25 | 24 | const t_bits: usize = @bitSizeOf(Limb) - carry_bits; |
| 26 | 25 | |
| 27 | 26 | // A TLimb is a Limb that is truncated to t_bits. |
| 28 | const TLimb = meta.Int(.unsigned, t_bits); | |
| 27 | const TLimb = @Int(.unsigned, t_bits); | |
| 29 | 28 | |
| 30 | 29 | const native_endian = builtin.target.cpu.arch.endian(); |
| 31 | 30 | |
| ... | ... | @@ -906,7 +905,7 @@ const ct_protected = struct { |
| 906 | 905 | // Multiplies two limbs and returns the result as a wide limb. |
| 907 | 906 | fn mulWide(x: Limb, y: Limb) WideLimb { |
| 908 | 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 | 909 | const x0 = @as(Half, @truncate(x)); |
| 911 | 910 | const x1 = @as(Half, @truncate(x >> half_bits)); |
| 912 | 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 | 9 | /// The Keccak-f permutation. |
| 10 | 10 | pub fn KeccakF(comptime f: u11) type { |
| 11 | 11 | 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 | 13 | const Block = [25]T; |
| 14 | 14 | |
| 15 | 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 | 3413 | // Use a signed type for EEA computation |
| 3414 | 3414 | const type_info = @typeInfo(T); |
| 3415 | 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 | 3417 | else |
| 3418 | 3418 | T; |
| 3419 | 3419 | |
| ... | ... | @@ -3436,7 +3436,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T { |
| 3436 | 3436 | fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T { |
| 3437 | 3437 | const type_info = @typeInfo(T); |
| 3438 | 3438 | const bits = type_info.int.bits; |
| 3439 | const WideT = std.meta.Int(.unsigned, bits * 2); | |
| 3439 | const WideT = @Int(.unsigned, bits * 2); | |
| 3440 | 3440 | |
| 3441 | 3441 | var ret: T = 1; |
| 3442 | 3442 | var base: T = a; |
| ... | ... | @@ -3465,14 +3465,14 @@ fn bitMask(comptime T: type, bit: T) T { |
| 3465 | 3465 | |
| 3466 | 3466 | /// Creates a mask from the sign bit of a signed integer. |
| 3467 | 3467 | /// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0. |
| 3468 | fn signMask(comptime T: type, x: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) { | |
| 3468 | fn signMask(comptime T: type, x: T) @Int(.unsigned, @typeInfo(T).int.bits) { | |
| 3469 | 3469 | const type_info = @typeInfo(T); |
| 3470 | 3470 | if (type_info != .int) { |
| 3471 | 3471 | @compileError("signMask requires an integer type"); |
| 3472 | 3472 | } |
| 3473 | 3473 | |
| 3474 | 3474 | const bits = type_info.int.bits; |
| 3475 | const SignedT = std.meta.Int(.signed, bits); | |
| 3475 | const SignedT = @Int(.signed, bits); | |
| 3476 | 3476 | |
| 3477 | 3477 | // Convert to signed if needed, arithmetic right shift to propagate sign bit |
| 3478 | 3478 | const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x); |
| ... | ... | @@ -3499,8 +3499,8 @@ fn montgomeryReduce( |
| 3499 | 3499 | const m: OutT = @truncate(m_full); |
| 3500 | 3500 | |
| 3501 | 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; | |
| 3503 | return @bitCast(@as(std.meta.Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted))); | |
| 3502 | const y_shifted = @as(@Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits; | |
| 3503 | return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted))); | |
| 3504 | 3504 | } |
| 3505 | 3505 | |
| 3506 | 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 | 1794 | // Use a signed type for EEA computation |
| 1795 | 1795 | const type_info = @typeInfo(T); |
| 1796 | 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 | 1798 | else |
| 1799 | 1799 | T; |
| 1800 | 1800 | |
| ... | ... | @@ -1817,7 +1817,7 @@ fn modularInverse(comptime T: type, comptime a: T, comptime p: T) T { |
| 1817 | 1817 | fn modularPow(comptime T: type, comptime a: T, s: T, comptime p: T) T { |
| 1818 | 1818 | const type_info = @typeInfo(T); |
| 1819 | 1819 | const bits = type_info.int.bits; |
| 1820 | const WideT = std.meta.Int(.unsigned, bits * 2); | |
| 1820 | const WideT = @Int(.unsigned, bits * 2); | |
| 1821 | 1821 | |
| 1822 | 1822 | var ret: T = 1; |
| 1823 | 1823 | var base: T = a; |
| ... | ... | @@ -1846,14 +1846,14 @@ fn bitMask(comptime T: type, bit: T) T { |
| 1846 | 1846 | |
| 1847 | 1847 | /// Creates a mask from the sign bit of a signed integer. |
| 1848 | 1848 | /// Returns all 1s (0xFF...FF) if x < 0, all 0s if x >= 0. |
| 1849 | fn signMask(comptime T: type, x: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) { | |
| 1849 | fn signMask(comptime T: type, x: T) @Int(.unsigned, @typeInfo(T).int.bits) { | |
| 1850 | 1850 | const type_info = @typeInfo(T); |
| 1851 | 1851 | if (type_info != .int) { |
| 1852 | 1852 | @compileError("signMask requires an integer type"); |
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | 1855 | const bits = type_info.int.bits; |
| 1856 | const SignedT = std.meta.Int(.signed, bits); | |
| 1856 | const SignedT = @Int(.signed, bits); | |
| 1857 | 1857 | |
| 1858 | 1858 | // Convert to signed if needed, arithmetic right shift to propagate sign bit |
| 1859 | 1859 | const x_signed: SignedT = if (type_info.int.signedness == .signed) x else @bitCast(x); |
| ... | ... | @@ -1898,8 +1898,8 @@ fn montgomeryReduce( |
| 1898 | 1898 | const m: OutT = @truncate(m_full); |
| 1899 | 1899 | |
| 1900 | 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; | |
| 1902 | return @bitCast(@as(std.meta.Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted))); | |
| 1901 | const y_shifted = @as(@Int(.unsigned, @typeInfo(InT).Int.bits), @bitCast(yR)) >> r_bits; | |
| 1902 | return @bitCast(@as(@Int(.unsigned, @typeInfo(OutT).Int.bits), @truncate(y_shifted))); | |
| 1903 | 1903 | } |
| 1904 | 1904 | |
| 1905 | 1905 | /// Uniform sampling using SHAKE-128 with rejection sampling. |
lib/std/crypto/modes.zig+1-1| ... | ... | @@ -40,7 +40,7 @@ pub fn ctrSlice( |
| 40 | 40 | var counterBlock = iv; |
| 41 | 41 | var i: usize = 0; |
| 42 | 42 | |
| 43 | const CounterInt = std.meta.Int(.unsigned, counter_size * 8); | |
| 43 | const CounterInt = @Int(.unsigned, counter_size * 8); | |
| 44 | 44 | |
| 45 | 45 | const parallel_count = BlockCipher.block.parallel.optimal_parallel_blocks; |
| 46 | 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 | 2 | const crypto = std.crypto; |
| 3 | 3 | const debug = std.debug; |
| 4 | 4 | const mem = std.mem; |
| 5 | const meta = std.meta; | |
| 6 | 5 | |
| 7 | 6 | const NonCanonicalError = crypto.errors.NonCanonicalError; |
| 8 | 7 | const NotSquareError = crypto.errors.NotSquareError; |
| ... | ... | @@ -54,7 +53,7 @@ pub fn Field(comptime params: FieldParams) type { |
| 54 | 53 | var s = if (endian == .little) s_ else orderSwap(s_); |
| 55 | 54 | const field_order_s = comptime fos: { |
| 56 | 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 | 57 | break :fos fos; |
| 59 | 58 | }; |
| 60 | 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 | 89 | } |
| 91 | 90 | |
| 92 | 91 | /// Element as an integer. |
| 93 | pub const IntRepr = meta.Int(.unsigned, params.field_bits); | |
| 92 | pub const IntRepr = @Int(.unsigned, params.field_bits); | |
| 94 | 93 | |
| 95 | 94 | /// Create a field element from an integer. |
| 96 | 95 | pub fn fromInt(comptime x: IntRepr) NonCanonicalError!Fe { |
| ... | ... | @@ -270,7 +269,7 @@ pub fn Field(comptime params: FieldParams) type { |
| 270 | 269 | const ls = x126.sqn(126).mul(x126).sqn(3).mul(t111).sqn(33).mul(x32).sqn(95).mul(x31); |
| 271 | 270 | return ls.equivalent(Fe.one); |
| 272 | 271 | } else { |
| 273 | const ls = x2.pow(std.meta.Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol | |
| 272 | const ls = x2.pow(@Int(.unsigned, field_bits), (field_order - 1) / 2); // Legendre symbol | |
| 274 | 273 | return ls.equivalent(Fe.one); |
| 275 | 274 | } |
| 276 | 275 | } |
| ... | ... | @@ -307,7 +306,7 @@ pub fn Field(comptime params: FieldParams) type { |
| 307 | 306 | const x108 = x54.sqn(54).mul(x54); |
| 308 | 307 | return x108.sqn(108).mul(x108).sqn(7).mul(t1111111).sqn(23).mul(x22).sqn(6).mul(t11).sqn(2); |
| 309 | 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 | } |
| 313 | 312 |
lib/std/crypto/timing_safe.zig+5-5| ... | ... | @@ -21,8 +21,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool { |
| 21 | 21 | acc |= x ^ b[i]; |
| 22 | 22 | } |
| 23 | 23 | const s = @typeInfo(C).int.bits; |
| 24 | const Cu = std.meta.Int(.unsigned, s); | |
| 25 | const Cext = std.meta.Int(.unsigned, s + 1); | |
| 24 | const Cu = @Int(.unsigned, s); | |
| 25 | const Cext = @Int(.unsigned, s + 1); | |
| 26 | 26 | return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s)))); |
| 27 | 27 | }, |
| 28 | 28 | .vector => |info| { |
| ... | ... | @@ -32,8 +32,8 @@ pub fn eql(comptime T: type, a: T, b: T) bool { |
| 32 | 32 | } |
| 33 | 33 | const acc = @reduce(.Or, a ^ b); |
| 34 | 34 | const s = @typeInfo(C).int.bits; |
| 35 | const Cu = std.meta.Int(.unsigned, s); | |
| 36 | const Cext = std.meta.Int(.unsigned, s + 1); | |
| 35 | const Cu = @Int(.unsigned, s); | |
| 36 | const Cext = @Int(.unsigned, s + 1); | |
| 37 | 37 | return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s)))); |
| 38 | 38 | }, |
| 39 | 39 | else => { |
| ... | ... | @@ -50,7 +50,7 @@ pub fn compare(comptime T: type, a: []const T, b: []const T, endian: Endian) Ord |
| 50 | 50 | .int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits, |
| 51 | 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 | 54 | var gt: T = 0; |
| 55 | 55 | var eq: T = 1; |
| 56 | 56 | if (endian == .little) { |
lib/std/enums.zig+5-5| ... | ... | @@ -1291,7 +1291,7 @@ pub fn EnumIndexer(comptime E: type) type { |
| 1291 | 1291 | const min_value = std.math.minInt(BackingInt); |
| 1292 | 1292 | const max_value = std.math.maxInt(BackingInt); |
| 1293 | 1293 | |
| 1294 | const RangeType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt)); | |
| 1294 | const RangeType = @Int(.unsigned, @bitSizeOf(BackingInt)); | |
| 1295 | 1295 | pub const count: comptime_int = std.math.maxInt(RangeType) + 1; |
| 1296 | 1296 | |
| 1297 | 1297 | pub fn indexOf(e: E) usize { |
| ... | ... | @@ -1307,7 +1307,7 @@ pub fn EnumIndexer(comptime E: type) type { |
| 1307 | 1307 | if (backing_int_sign == .unsigned) |
| 1308 | 1308 | return @enumFromInt(i); |
| 1309 | 1309 | |
| 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 | 1380 | i4, |
| 1381 | 1381 | i8, |
| 1382 | 1382 | i16, |
| 1383 | std.meta.Int(.signed, @bitSizeOf(isize) - 1), | |
| 1383 | @Int(.signed, @bitSizeOf(isize) - 1), | |
| 1384 | 1384 | isize, |
| 1385 | 1385 | u1, |
| 1386 | 1386 | u2, |
| 1387 | 1387 | u3, |
| 1388 | 1388 | u4, |
| 1389 | 1389 | u16, |
| 1390 | std.meta.Int(.unsigned, @bitSizeOf(usize) - 1), | |
| 1390 | @Int(.unsigned, @bitSizeOf(usize) - 1), | |
| 1391 | 1391 | usize, |
| 1392 | 1392 | }; |
| 1393 | 1393 | inline for (backing_ints) |BackingInt| { |
| ... | ... | @@ -1400,7 +1400,7 @@ test "EnumIndexer non-exhaustive" { |
| 1400 | 1400 | const min_tag: E = @enumFromInt(std.math.minInt(BackingInt)); |
| 1401 | 1401 | const max_tag: E = @enumFromInt(std.math.maxInt(BackingInt)); |
| 1402 | 1402 | |
| 1403 | const RangedType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt)); | |
| 1403 | const RangedType = @Int(.unsigned, @bitSizeOf(BackingInt)); | |
| 1404 | 1404 | const max_index: comptime_int = std.math.maxInt(RangedType); |
| 1405 | 1405 | const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).int.signedness) { |
| 1406 | 1406 | .unsigned => 0, |
lib/std/fmt.zig+1-1| ... | ... | @@ -433,7 +433,7 @@ fn parseIntWithSign( |
| 433 | 433 | // accumulate into Accumulate which is always 8 bits or larger. this prevents |
| 434 | 434 | // `buf_base` from overflowing Result. |
| 435 | 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 | 437 | var accumulate: Accumulate = 0; |
| 438 | 438 | |
| 439 | 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 | 128 | |
| 129 | 129 | test "nan and inf" { |
| 130 | 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); | |
| 132 | 132 | |
| 133 | 133 | try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T)))); |
| 134 | 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 | 130 | |
| 131 | 131 | inline fn read(comptime bytes: usize, data: []const u8) u64 { |
| 132 | 132 | std.debug.assert(bytes <= 8); |
| 133 | const T = std.meta.Int(.unsigned, 8 * bytes); | |
| 133 | const T = @Int(.unsigned, 8 * bytes); | |
| 134 | 134 | return @as(u64, std.mem.readInt(T, data[0..bytes], .little)); |
| 135 | 135 | } |
| 136 | 136 |
lib/std/heap/debug_allocator.zig+1-1| ... | ... | @@ -189,7 +189,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 189 | 189 | const page_size = config.page_size; |
| 190 | 190 | const page_align: mem.Alignment = .fromByteUnits(page_size); |
| 191 | 191 | /// 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); | |
| 193 | 193 | |
| 194 | 194 | const total_requested_bytes_init = if (config.enable_memory_limit) @as(usize, 0) else {}; |
| 195 | 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 | 663 | float: f64, |
| 664 | 664 | string: []const u8, |
| 665 | 665 | }; |
| 666 | const T = std.meta.Tuple(&.{ | |
| 666 | const T = @Tuple(&.{ | |
| 667 | 667 | i64, |
| 668 | 668 | f64, |
| 669 | 669 | bool, |
| ... | ... | @@ -673,7 +673,7 @@ test "parse into tuple" { |
| 673 | 673 | foo: i32, |
| 674 | 674 | bar: []const u8, |
| 675 | 675 | }, |
| 676 | std.meta.Tuple(&.{ u8, []const u8, u8 }), | |
| 676 | @Tuple(&.{ u8, []const u8, u8 }), | |
| 677 | 677 | Union, |
| 678 | 678 | }); |
| 679 | 679 | const str = |
lib/std/leb128.zig+2-2| ... | ... | @@ -9,7 +9,7 @@ const testing = std.testing; |
| 9 | 9 | /// An example use case of this is in emitting DWARF info where one wants to make a ULEB128 field |
| 10 | 10 | /// "relocatable", meaning that it becomes possible to later go back and patch the number to be a |
| 11 | 11 | /// different value without shifting all the following code. |
| 12 | pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.unsigned, l * 7)) void { | |
| 12 | pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: @Int(.unsigned, l * 7)) void { | |
| 13 | 13 | writeUnsignedExtended(ptr, int); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -65,7 +65,7 @@ test writeUnsignedFixed { |
| 65 | 65 | /// An example use case of this is in emitting DWARF info where one wants to make a ILEB128 field |
| 66 | 66 | /// "relocatable", meaning that it becomes possible to later go back and patch the number to be a |
| 67 | 67 | /// different value without shifting all the following code. |
| 68 | pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.signed, l * 7)) void { | |
| 68 | pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: @Int(.signed, l * 7)) void { | |
| 69 | 69 | const T = @TypeOf(int); |
| 70 | 70 | const U = if (@typeInfo(T).int.bits < 8) u8 else T; |
| 71 | 71 | var value: U = @intCast(int); |
lib/std/math.zig+8-8| ... | ... | @@ -779,7 +779,7 @@ pub fn Log2Int(comptime T: type) type { |
| 779 | 779 | if (T == comptime_int) return comptime_int; |
| 780 | 780 | const bits: u16 = @typeInfo(T).int.bits; |
| 781 | 781 | const log2_bits = 16 - @clz(bits - 1); |
| 782 | return std.meta.Int(.unsigned, log2_bits); | |
| 782 | return @Int(.unsigned, log2_bits); | |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 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 | 788 | if (T == comptime_int) return comptime_int; |
| 789 | 789 | const bits: u16 = @typeInfo(T).int.bits; |
| 790 | 790 | const log2_bits = 16 - @clz(bits); |
| 791 | return std.meta.Int(.unsigned, log2_bits); | |
| 791 | return @Int(.unsigned, log2_bits); | |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | /// Returns the smallest integer type that can hold both from and to. |
| ... | ... | @@ -1048,10 +1048,10 @@ fn testRem() !void { |
| 1048 | 1048 | |
| 1049 | 1049 | /// Returns the negation of the integer parameter. |
| 1050 | 1050 | /// Result is a signed integer. |
| 1051 | pub fn negateCast(x: anytype) !std.meta.Int(.signed, @bitSizeOf(@TypeOf(x))) { | |
| 1051 | pub fn negateCast(x: anytype) !@Int(.signed, @bitSizeOf(@TypeOf(x))) { | |
| 1052 | 1052 | if (@typeInfo(@TypeOf(x)).int.signedness == .signed) return negate(x); |
| 1053 | 1053 | |
| 1054 | const int = std.meta.Int(.signed, @bitSizeOf(@TypeOf(x))); | |
| 1054 | const int = @Int(.signed, @bitSizeOf(@TypeOf(x))); | |
| 1055 | 1055 | if (x > -minInt(int)) return error.Overflow; |
| 1056 | 1056 | |
| 1057 | 1057 | if (x == -minInt(int)) return minInt(int); |
| ... | ... | @@ -1177,7 +1177,7 @@ pub inline fn floor(value: anytype) @TypeOf(value) { |
| 1177 | 1177 | /// Returns the nearest power of two less than or equal to value, or |
| 1178 | 1178 | /// zero if value is less than or equal to zero. |
| 1179 | 1179 | pub 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 | 1181 | if (value <= 0) return 0; |
| 1182 | 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 | 1212 | /// Returns the next power of two (if the value is not already a power of two). |
| 1213 | 1213 | /// Only unsigned integers can be used. Zero is not an allowed input. |
| 1214 | 1214 | /// Result is a type with 1 more bit than the input type. |
| 1215 | pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1) { | |
| 1215 | pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) @Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1) { | |
| 1216 | 1216 | comptime assert(@typeInfo(T) == .int); |
| 1217 | 1217 | comptime assert(@typeInfo(T).int.signedness == .unsigned); |
| 1218 | 1218 | assert(value != 0); |
| ... | ... | @@ -1497,11 +1497,11 @@ test "max value type" { |
| 1497 | 1497 | |
| 1498 | 1498 | /// Multiply a and b. Return type is wide enough to guarantee no |
| 1499 | 1499 | /// overflow. |
| 1500 | pub fn mulWide(comptime T: type, a: T, b: T) std.meta.Int( | |
| 1500 | pub fn mulWide(comptime T: type, a: T, b: T) @Int( | |
| 1501 | 1501 | @typeInfo(T).int.signedness, |
| 1502 | 1502 | @typeInfo(T).int.bits * 2, |
| 1503 | 1503 | ) { |
| 1504 | const ResultInt = std.meta.Int( | |
| 1504 | const ResultInt = @Int( | |
| 1505 | 1505 | @typeInfo(T).int.signedness, |
| 1506 | 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 | 4 | pub const int = @import("big/int.zig"); |
| 5 | 5 | pub const Limb = usize; |
| 6 | 6 | const limb_info = @typeInfo(Limb).int; |
| 7 | pub const SignedLimb = std.meta.Int(.signed, limb_info.bits); | |
| 8 | pub const DoubleLimb = std.meta.Int(.unsigned, 2 * limb_info.bits); | |
| 9 | pub const HalfLimb = std.meta.Int(.unsigned, limb_info.bits / 2); | |
| 10 | pub const SignedDoubleLimb = std.meta.Int(.signed, 2 * limb_info.bits); | |
| 7 | pub const SignedLimb = @Int(.signed, limb_info.bits); | |
| 8 | pub const DoubleLimb = @Int(.unsigned, 2 * limb_info.bits); | |
| 9 | pub const HalfLimb = @Int(.unsigned, limb_info.bits / 2); | |
| 10 | pub const SignedDoubleLimb = @Int(.signed, 2 * limb_info.bits); | |
| 11 | 11 | pub const Log2Limb = std.math.Log2Int(Limb); |
| 12 | 12 | |
| 13 | 13 | comptime { |
lib/std/math/big/int.zig+2-2| ... | ... | @@ -2047,7 +2047,7 @@ pub const Mutable = struct { |
| 2047 | 2047 | var limb = switch (signedness) { |
| 2048 | 2048 | .unsigned => mem.readVarPackedInt(Limb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .unsigned), |
| 2049 | 2049 | .signed => b: { |
| 2050 | const SLimb = std.meta.Int(.signed, @bitSizeOf(Limb)); | |
| 2050 | const SLimb = @Int(.signed, @bitSizeOf(Limb)); | |
| 2051 | 2051 | const limb = mem.readVarPackedInt(SLimb, buffer, bit_index + bit_offset, bit_count - bit_index, endian, .signed); |
| 2052 | 2052 | break :b @as(Limb, @bitCast(limb)); |
| 2053 | 2053 | }, |
| ... | ... | @@ -2284,7 +2284,7 @@ pub const Const = struct { |
| 2284 | 2284 | // Make sure -0 is handled correctly. |
| 2285 | 2285 | if (self.eqlZero()) return 0; |
| 2286 | 2286 | |
| 2287 | const Unsigned = std.meta.Int(.unsigned, info.bits); | |
| 2287 | const Unsigned = @Int(.unsigned, info.bits); | |
| 2288 | 2288 | |
| 2289 | 2289 | if (!self.fitsInTwosComp(info.signedness, info.bits)) { |
| 2290 | 2290 | return error.TargetTooSmall; |
lib/std/math/big/int_test.zig+2-2| ... | ... | @@ -2370,7 +2370,7 @@ test "truncate multi to single signed" { |
| 2370 | 2370 | |
| 2371 | 2371 | test "truncate multi to multi unsigned" { |
| 2372 | 2372 | const bits = @typeInfo(SignedDoubleLimb).int.bits; |
| 2373 | const Int = std.meta.Int(.unsigned, bits - 1); | |
| 2373 | const Int = @Int(.unsigned, bits - 1); | |
| 2374 | 2374 | |
| 2375 | 2375 | var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb)); |
| 2376 | 2376 | defer a.deinit(); |
| ... | ... | @@ -2386,7 +2386,7 @@ test "truncate multi to multi signed" { |
| 2386 | 2386 | |
| 2387 | 2387 | try a.truncate(&a, .signed, @bitSizeOf(Limb) + 1); |
| 2388 | 2388 | |
| 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 | } |
| 2391 | 2391 | |
| 2392 | 2392 | test "truncate negative multi to single" { |
lib/std/math/copysign.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ const expect = std.testing.expect; |
| 5 | 5 | /// Returns a value with the magnitude of `magnitude` and the sign of `sign`. |
| 6 | 6 | pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) { |
| 7 | 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 | 9 | const sign_bit_mask = @as(TBits, 1) << (@bitSizeOf(T) - 1); |
| 10 | 10 | const mag = @as(TBits, @bitCast(magnitude)) & ~sign_bit_mask; |
| 11 | 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 | 22 | const T: type = @TypeOf(x); |
| 23 | 23 | |
| 24 | 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); | |
| 26 | 26 | |
| 27 | 27 | const exp_bits: comptime_int = math.floatExponentBits(T); |
| 28 | 28 | const mant_bits: comptime_int = math.floatMantissaBits(T); |
| 29 | 29 | const frac_bits: comptime_int = math.floatFractionalBits(T); |
| 30 | 30 | const exp_min: comptime_int = math.floatExponentMin(T); |
| 31 | 31 | |
| 32 | const ExpInt: type = std.meta.Int(.unsigned, exp_bits); | |
| 33 | const MantInt: type = std.meta.Int(.unsigned, mant_bits); | |
| 34 | const FracInt: type = std.meta.Int(.unsigned, frac_bits); | |
| 32 | const ExpInt: type = @Int(.unsigned, exp_bits); | |
| 33 | const MantInt: type = @Int(.unsigned, mant_bits); | |
| 34 | const FracInt: type = @Int(.unsigned, frac_bits); | |
| 35 | 35 | |
| 36 | 36 | const unreal_exponent: comptime_int = (1 << exp_bits) - 1; |
| 37 | 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 | 30 | const significandBits = math.floatMantissaBits(T); |
| 31 | 31 | const exponentBits = math.floatExponentBits(T); |
| 32 | 32 | |
| 33 | const Z = std.meta.Int(.unsigned, typeWidth); | |
| 33 | const Z = @Int(.unsigned, typeWidth); | |
| 34 | 34 | |
| 35 | 35 | const signBit = (@as(Z, 1) << (significandBits + exponentBits)); |
| 36 | 36 | const maxExponent = ((1 << exponentBits) - 1); |
lib/std/math/isfinite.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ const expect = std.testing.expect; |
| 5 | 5 | /// Returns whether x is a finite value. |
| 6 | 6 | pub fn isFinite(x: anytype) bool { |
| 7 | 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 | 9 | const remove_sign = ~@as(TBits, 0) >> 1; |
| 10 | 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 | 5 | /// Returns whether x is an infinity, ignoring sign. |
| 6 | 6 | pub inline fn isInf(x: anytype) bool { |
| 7 | 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 | 9 | const remove_sign = ~@as(TBits, 0) >> 1; |
| 10 | 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 | 1 | const std = @import("../std.zig"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const math = std.math; |
| 4 | const meta = std.meta; | |
| 5 | 4 | const expect = std.testing.expect; |
| 6 | 5 | |
| 7 | 6 | pub fn isNan(x: anytype) bool { |
| ... | ... | @@ -12,7 +11,7 @@ pub fn isNan(x: anytype) bool { |
| 12 | 11 | /// this is tracked by https://github.com/ziglang/zig/issues/14366 |
| 13 | 12 | pub fn isSignalNan(x: anytype) bool { |
| 14 | 13 | const T = @TypeOf(x); |
| 15 | const U = meta.Int(.unsigned, @bitSizeOf(T)); | |
| 14 | const U = @Int(.unsigned, @bitSizeOf(T)); | |
| 16 | 15 | const quiet_signal_bit_mask = 1 << (math.floatFractionalBits(T) - 1); |
| 17 | 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 | 5 | /// Returns whether x is neither zero, subnormal, infinity, or NaN. |
| 6 | 6 | pub fn isNormal(x: anytype) bool { |
| 7 | 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 | 9 | |
| 10 | 10 | const increment_exp = 1 << math.floatMantissaBits(T); |
| 11 | 11 | const remove_sign = ~@as(TBits, 0) >> 1; |
| ... | ... | @@ -22,7 +22,7 @@ pub fn isNormal(x: anytype) bool { |
| 22 | 22 | test isNormal { |
| 23 | 23 | // TODO add `c_longdouble' when math.inf(T) supports it |
| 24 | 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)); | |
| 26 | 26 | |
| 27 | 27 | // normals |
| 28 | 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 | 6 | pub inline fn isPositiveZero(x: anytype) bool { |
| 7 | 7 | const T = @TypeOf(x); |
| 8 | 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 | 10 | return @as(TBits, @bitCast(x)) == @as(TBits, 0); |
| 11 | 11 | } |
| 12 | 12 | |
| ... | ... | @@ -14,7 +14,7 @@ pub inline fn isPositiveZero(x: anytype) bool { |
| 14 | 14 | pub inline fn isNegativeZero(x: anytype) bool { |
| 15 | 15 | const T = @TypeOf(x); |
| 16 | 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 | 18 | return @as(TBits, @bitCast(x)) == @as(TBits, 1) << (bit_count - 1); |
| 19 | 19 | } |
| 20 | 20 |
lib/std/math/ldexp.zig+2-2| ... | ... | @@ -7,7 +7,7 @@ const expect = std.testing.expect; |
| 7 | 7 | /// Returns x * 2^n. |
| 8 | 8 | pub fn ldexp(x: anytype, n: i32) @TypeOf(x) { |
| 9 | 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); | |
| 11 | 11 | |
| 12 | 12 | const exponent_bits = math.floatExponentBits(T); |
| 13 | 13 | const mantissa_bits = math.floatMantissaBits(T); |
| ... | ... | @@ -103,7 +103,7 @@ test ldexp { |
| 103 | 103 | |
| 104 | 104 | // Multiplications might flush the denormals to zero, esp. at |
| 105 | 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 | 107 | const EightTimesTrueMin = @as(T, @bitCast(@as(Z, 8))); |
| 108 | 108 | const TwoTimesTrueMin = @as(T, @bitCast(@as(Z, 2))); |
| 109 | 109 |
lib/std/math/nextafter.zig+2-2| ... | ... | @@ -90,7 +90,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T { |
| 90 | 90 | |
| 91 | 91 | return x_parts.toFloat(); |
| 92 | 92 | } else { |
| 93 | const Bits = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 93 | const Bits = @Int(.unsigned, @bitSizeOf(T)); | |
| 94 | 94 | var x_bits: Bits = @bitCast(x); |
| 95 | 95 | if ((x > 0.0) == (y > x)) { |
| 96 | 96 | x_bits += 1; |
| ... | ... | @@ -320,6 +320,6 @@ test "float" { |
| 320 | 320 | /// Helps ensure that 0.0 doesn't compare equal to -0.0. |
| 321 | 321 | fn bitwiseEqual(comptime T: type, x: T, y: T) bool { |
| 322 | 322 | comptime assert(@typeInfo(T) == .float); |
| 323 | const Bits = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 323 | const Bits = @Int(.unsigned, @bitSizeOf(T)); | |
| 324 | 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 | 147 | var xe = r2.exponent; |
| 148 | 148 | var x1 = r2.significand; |
| 149 | 149 | |
| 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 | 151 | while (i != 0) : (i >>= 1) { |
| 152 | 152 | const overflow_shift = math.floatExponentBits(T) + 1; |
| 153 | 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 | 1777 | assert(@typeInfo(ReturnType).int.bits >= bytes.len * 8); |
| 1778 | 1778 | const bits = @typeInfo(ReturnType).int.bits; |
| 1779 | 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 | 1781 | var result: WorkType = 0; |
| 1782 | 1782 | switch (endian) { |
| 1783 | 1783 | .big => { |
| ... | ... | @@ -1828,8 +1828,8 @@ pub fn readVarPackedInt( |
| 1828 | 1828 | endian: std.builtin.Endian, |
| 1829 | 1829 | signedness: std.builtin.Signedness, |
| 1830 | 1830 | ) T { |
| 1831 | const uN = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 1832 | const iN = std.meta.Int(.signed, @bitSizeOf(T)); | |
| 1831 | const uN = @Int(.unsigned, @bitSizeOf(T)); | |
| 1832 | const iN = @Int(.signed, @bitSizeOf(T)); | |
| 1833 | 1833 | const Log2N = std.math.Log2Int(T); |
| 1834 | 1834 | |
| 1835 | 1835 | const read_size = (bit_count + (bit_offset % 8) + 7) / 8; |
| ... | ... | @@ -1921,7 +1921,7 @@ test readInt { |
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | 1923 | fn 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 | 1925 | const Log2N = std.math.Log2Int(T); |
| 1926 | 1926 | |
| 1927 | 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 | 1929 | |
| 1930 | 1930 | const load_size = (bit_count + 7) / 8; |
| 1931 | 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); | |
| 1933 | 1933 | |
| 1934 | 1934 | if (bit_count == 0) |
| 1935 | 1935 | return 0; |
| ... | ... | @@ -1947,7 +1947,7 @@ fn readPackedIntLittle(comptime T: type, bytes: []const u8, bit_offset: usize) T |
| 1947 | 1947 | } |
| 1948 | 1948 | |
| 1949 | 1949 | fn 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 | 1951 | const Log2N = std.math.Log2Int(T); |
| 1952 | 1952 | |
| 1953 | 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 | 1956 | |
| 1957 | 1957 | const load_size = (bit_count + 7) / 8; |
| 1958 | 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); | |
| 1960 | 1960 | |
| 1961 | 1961 | if (bit_count == 0) |
| 1962 | 1962 | return 0; |
| ... | ... | @@ -2061,7 +2061,7 @@ test writeInt { |
| 2061 | 2061 | } |
| 2062 | 2062 | |
| 2063 | 2063 | fn 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 | 2065 | const Log2N = std.math.Log2Int(T); |
| 2066 | 2066 | |
| 2067 | 2067 | const bit_count = @as(usize, @bitSizeOf(T)); |
| ... | ... | @@ -2069,7 +2069,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: |
| 2069 | 2069 | |
| 2070 | 2070 | const store_size = (@bitSizeOf(T) + 7) / 8; |
| 2071 | 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); | |
| 2073 | 2073 | |
| 2074 | 2074 | if (bit_count == 0) |
| 2075 | 2075 | return; |
| ... | ... | @@ -2094,7 +2094,7 @@ fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: |
| 2094 | 2094 | } |
| 2095 | 2095 | |
| 2096 | 2096 | fn 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 | 2098 | const Log2N = std.math.Log2Int(T); |
| 2099 | 2099 | |
| 2100 | 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 | 2103 | |
| 2104 | 2104 | const store_size = (@bitSizeOf(T) + 7) / 8; |
| 2105 | 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); | |
| 2107 | 2107 | |
| 2108 | 2108 | if (bit_count == 0) |
| 2109 | 2109 | return; |
| ... | ... | @@ -2160,7 +2160,7 @@ test writePackedInt { |
| 2160 | 2160 | /// If negative, the written value is sign-extended. |
| 2161 | 2161 | pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value: anytype, endian: std.builtin.Endian) void { |
| 2162 | 2162 | const T = @TypeOf(value); |
| 2163 | const uN = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 2163 | const uN = @Int(.unsigned, @bitSizeOf(T)); | |
| 2164 | 2164 | |
| 2165 | 2165 | const bit_shift = @as(u3, @intCast(bit_offset % 8)); |
| 2166 | 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 | 2242 | }, |
| 2243 | 2243 | .bool => {}, |
| 2244 | 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 | 2247 | else => { |
| 2248 | 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 | 2262 | } |
| 2263 | 2263 | } |
| 2264 | 2264 | |
| 2265 | const BackingInt = std.meta.Int(.unsigned, @bitSizeOf(S)); | |
| 2265 | const BackingInt = @Int(.unsigned, @bitSizeOf(S)); | |
| 2266 | 2266 | ptr.* = @bitCast(@byteSwap(@as(BackingInt, @bitCast(ptr.*)))); |
| 2267 | 2267 | }, |
| 2268 | 2268 | .array => |info| { |
| ... | ... | @@ -2370,7 +2370,7 @@ pub fn byteSwapAllElements(comptime Elem: type, slice: []Elem) void { |
| 2370 | 2370 | }, |
| 2371 | 2371 | .bool => {}, |
| 2372 | 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 | 2375 | else => { |
| 2376 | 2376 | elem.* = @byteSwap(elem.*); |
| ... | ... | @@ -4800,7 +4800,7 @@ pub fn doNotOptimizeAway(val: anytype) void { |
| 4800 | 4800 | const bits = t.int.bits; |
| 4801 | 4801 | if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) { |
| 4802 | 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 | 4804 | val, |
| 4805 | 4805 | ); |
| 4806 | 4806 | asm volatile ("" |
| ... | ... | @@ -5035,8 +5035,8 @@ test "read/write(Var)PackedInt" { |
| 5035 | 5035 | if (@bitSizeOf(PackedType) > @bitSizeOf(BackingType)) |
| 5036 | 5036 | continue; |
| 5037 | 5037 | |
| 5038 | const iPackedType = std.meta.Int(.signed, @bitSizeOf(PackedType)); | |
| 5039 | const uPackedType = std.meta.Int(.unsigned, @bitSizeOf(PackedType)); | |
| 5038 | const iPackedType = @Int(.signed, @bitSizeOf(PackedType)); | |
| 5039 | const uPackedType = @Int(.unsigned, @bitSizeOf(PackedType)); | |
| 5040 | 5040 | const Log2T = std.math.Log2Int(BackingType); |
| 5041 | 5041 | |
| 5042 | 5042 | const offset_at_end = @bitSizeOf(BackingType) - @bitSizeOf(PackedType); |
| ... | ... | @@ -5103,8 +5103,8 @@ test "read/write(Var)PackedInt" { |
| 5103 | 5103 | } |
| 5104 | 5104 | |
| 5105 | 5105 | const signedness = @typeInfo(PackedType).int.signedness; |
| 5106 | const NextPowerOfTwoInt = std.meta.Int(signedness, try comptime std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType))); | |
| 5107 | const ui64 = std.meta.Int(signedness, 64); | |
| 5106 | const NextPowerOfTwoInt = @Int(signedness, try std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType))); | |
| 5107 | const ui64 = @Int(signedness, 64); | |
| 5108 | 5108 | inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| { |
| 5109 | 5109 | { // Variable-size Read/Write (Native-endian) |
| 5110 | 5110 |
lib/std/meta.zig+3-35| ... | ... | @@ -751,11 +751,6 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int { |
| 751 | 751 | return null; |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | /// Deprecated: use @Int | |
| 755 | pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type { | |
| 756 | return @Int(signedness, bit_count); | |
| 757 | } | |
| 758 | ||
| 759 | 754 | pub fn Float(comptime bit_count: u8) type { |
| 760 | 755 | return switch (bit_count) { |
| 761 | 756 | 16 => f16, |
| ... | ... | @@ -796,14 +791,7 @@ pub fn ArgsTuple(comptime Function: type) type { |
| 796 | 791 | argument_field_list[i] = T; |
| 797 | 792 | } |
| 798 | 793 | |
| 799 | return Tuple(&argument_field_list); | |
| 800 | } | |
| 801 | ||
| 802 | /// Deprecated; use `@Tuple` instead. | |
| 803 | /// | |
| 804 | /// To be removed after Zig 0.16.0 releases. | |
| 805 | pub fn Tuple(comptime types: []const type) type { | |
| 806 | return @Tuple(types); | |
| 794 | return @Tuple(&argument_field_list); | |
| 807 | 795 | } |
| 808 | 796 | |
| 809 | 797 | const TupleTester = struct { |
| ... | ... | @@ -839,33 +827,13 @@ test ArgsTuple { |
| 839 | 827 | TupleTester.assertTuple(.{u32}, ArgsTuple(fn (comptime a: u32) []const u8)); |
| 840 | 828 | } |
| 841 | 829 | |
| 842 | test 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 | ||
| 849 | test "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 | ||
| 862 | 830 | test "ArgsTuple forwarding" { |
| 863 | const T1 = std.meta.Tuple(&.{ u32, f32, i8 }); | |
| 831 | const T1 = @Tuple(&.{ u32, f32, i8 }); | |
| 864 | 832 | const T2 = std.meta.ArgsTuple(fn (u32, f32, i8) void); |
| 865 | 833 | const T3 = std.meta.ArgsTuple(fn (u32, f32, i8) callconv(.c) noreturn); |
| 866 | 834 | |
| 867 | 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 | 838 | if (T1 != T3) { |
| 871 | 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 | 13 | return struct { |
| 14 | 14 | bits: Int, |
| 15 | 15 | |
| 16 | pub const Int = meta.Int(.unsigned, bit_count); | |
| 16 | pub const Int = @Int(.unsigned, bit_count); | |
| 17 | 17 | pub const bit_count = @typeInfo(Fields).@"struct".fields.len; |
| 18 | 18 | |
| 19 | 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 | 17 | |
| 18 | 18 | pub const CPU_SETSIZE = 128; |
| 19 | 19 | pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize; |
| 20 | pub const cpu_count_t = std.meta.Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); | |
| 20 | pub const cpu_count_t = @Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); | |
| 21 | 21 | |
| 22 | 22 | pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { |
| 23 | 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 | 6291 | |
| 6292 | 6292 | pub const CPU_SETSIZE = 128; |
| 6293 | 6293 | pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize; |
| 6294 | pub const cpu_count_t = std.meta.Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); | |
| 6294 | pub const cpu_count_t = @Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); | |
| 6295 | 6295 | |
| 6296 | 6296 | pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { |
| 6297 | 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 | 15 | else => .{ .size = 14, .dir = 2, .none = 0, .read = 2, .write = 1 }, |
| 16 | 16 | }; |
| 17 | 17 | |
| 18 | const Direction = std.meta.Int(.unsigned, bits.dir); | |
| 18 | const Direction = @Int(.unsigned, bits.dir); | |
| 19 | 19 | |
| 20 | 20 | pub const Request = packed struct { |
| 21 | 21 | nr: u8, |
| 22 | 22 | io_type: u8, |
| 23 | size: std.meta.Int(.unsigned, bits.size), | |
| 23 | size: @Int(.unsigned, bits.size), | |
| 24 | 24 | dir: Direction, |
| 25 | 25 | }; |
| 26 | 26 |
lib/std/os/uefi/tables/runtime_services.zig+1-1| ... | ... | @@ -419,7 +419,7 @@ pub const RuntimeServices = extern struct { |
| 419 | 419 | pub const DebugDisposition = enum(usize) { |
| 420 | 420 | const Bits = packed struct(usize) { |
| 421 | 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 | }; |
| 424 | 424 | |
| 425 | 425 | pointer = @bitCast(Bits{}), |
lib/std/posix.zig+1-1| ... | ... | @@ -803,7 +803,7 @@ pub fn dl_iterate_phdr( |
| 803 | 803 | } |
| 804 | 804 | }.callbackC, @ptrCast(@constCast(&context)))) { |
| 805 | 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 | } |
| 809 | 809 |
lib/std/testing.zig+1-1| ... | ... | @@ -163,7 +163,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void { |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | const BackingInt = std.meta.Int(.unsigned, @bitSizeOf(T)); | |
| 166 | const BackingInt = @Int(.unsigned, @bitSizeOf(T)); | |
| 167 | 167 | return expectEqual( |
| 168 | 168 | @as(BackingInt, @bitCast(expected)), |
| 169 | 169 | @as(BackingInt, @bitCast(actual)), |
lib/std/zig/llvm/Builder.zig+3-3| ... | ... | @@ -7657,9 +7657,9 @@ pub const Constant = enum(u32) { |
| 7657 | 7657 | .float => { |
| 7658 | 7658 | const Float = struct { |
| 7659 | 7659 | fn Repr(comptime T: type) type { |
| 7660 | return packed struct(std.meta.Int(.unsigned, @bitSizeOf(T))) { | |
| 7661 | mantissa: std.meta.Int(.unsigned, std.math.floatMantissaBits(T)), | |
| 7662 | exponent: std.meta.Int(.unsigned, std.math.floatExponentBits(T)), | |
| 7660 | return packed struct(@Int(.unsigned, @bitSizeOf(T))) { | |
| 7661 | mantissa: @Int(.unsigned, std.math.floatMantissaBits(T)), | |
| 7662 | exponent: @Int(.unsigned, std.math.floatExponentBits(T)), | |
| 7663 | 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 | 404 | } |
| 405 | 405 | |
| 406 | 406 | fn 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 | 408 | .comptime_int => u32, |
| 409 | 409 | .int => |info| if (info.signedness == .unsigned) |
| 410 | 410 | T |
| ... | ... | @@ -414,7 +414,7 @@ fn BufType(comptime T: type, comptime min_len: usize) type { |
| 414 | 414 | .bool => u1, |
| 415 | 415 | .@"struct" => |info| switch (info.layout) { |
| 416 | 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 | 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 | 425 | .comptime_int, .int => @intCast(value), |
| 426 | 426 | .@"enum" => @intFromEnum(value), |
| 427 | 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 | 429 | else => unreachable, |
| 430 | 430 | }; |
| 431 | 431 | } |
lib/std/zig/llvm/ir.zig+8-8| ... | ... | @@ -235,7 +235,7 @@ pub const ModuleBlock = struct { |
| 235 | 235 | is_const: AddrSpaceAndIsConst, |
| 236 | 236 | initid: u32, |
| 237 | 237 | linkage: Builder.Linkage, |
| 238 | alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 238 | alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 239 | 239 | section: usize, |
| 240 | 240 | visibility: Builder.Visibility, |
| 241 | 241 | thread_local: Builder.ThreadLocal, |
| ... | ... | @@ -275,7 +275,7 @@ pub const ModuleBlock = struct { |
| 275 | 275 | is_proto: bool, |
| 276 | 276 | linkage: Builder.Linkage, |
| 277 | 277 | paramattr: usize, |
| 278 | alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 278 | alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 279 | 279 | section: usize, |
| 280 | 280 | visibility: Builder.Visibility, |
| 281 | 281 | unnamed_addr: Builder.UnnamedAddr, |
| ... | ... | @@ -1214,7 +1214,7 @@ pub const ModuleBlock = struct { |
| 1214 | 1214 | }; |
| 1215 | 1215 | ptr: u32, |
| 1216 | 1216 | ty: Builder.Type, |
| 1217 | alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1217 | alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1218 | 1218 | is_volatile: bool, |
| 1219 | 1219 | }; |
| 1220 | 1220 | |
| ... | ... | @@ -1230,7 +1230,7 @@ pub const ModuleBlock = struct { |
| 1230 | 1230 | }; |
| 1231 | 1231 | ptr: u32, |
| 1232 | 1232 | ty: Builder.Type, |
| 1233 | alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1233 | alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1234 | 1234 | is_volatile: bool, |
| 1235 | 1235 | success_ordering: Builder.AtomicOrdering, |
| 1236 | 1236 | sync_scope: Builder.SyncScope, |
| ... | ... | @@ -1246,7 +1246,7 @@ pub const ModuleBlock = struct { |
| 1246 | 1246 | }; |
| 1247 | 1247 | ptr: u32, |
| 1248 | 1248 | val: u32, |
| 1249 | alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1249 | alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1250 | 1250 | is_volatile: bool, |
| 1251 | 1251 | }; |
| 1252 | 1252 | |
| ... | ... | @@ -1262,7 +1262,7 @@ pub const ModuleBlock = struct { |
| 1262 | 1262 | }; |
| 1263 | 1263 | ptr: u32, |
| 1264 | 1264 | val: u32, |
| 1265 | alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1265 | alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1266 | 1266 | is_volatile: bool, |
| 1267 | 1267 | success_ordering: Builder.AtomicOrdering, |
| 1268 | 1268 | sync_scope: Builder.SyncScope, |
| ... | ... | @@ -1317,7 +1317,7 @@ pub const ModuleBlock = struct { |
| 1317 | 1317 | is_volatile: bool, |
| 1318 | 1318 | success_ordering: Builder.AtomicOrdering, |
| 1319 | 1319 | sync_scope: Builder.SyncScope, |
| 1320 | alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1320 | alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1321 | 1321 | }; |
| 1322 | 1322 | |
| 1323 | 1323 | pub const CmpXchg = struct { |
| ... | ... | @@ -1341,7 +1341,7 @@ pub const ModuleBlock = struct { |
| 1341 | 1341 | sync_scope: Builder.SyncScope, |
| 1342 | 1342 | failure_ordering: Builder.AtomicOrdering, |
| 1343 | 1343 | is_weak: bool, |
| 1344 | alignment: std.meta.Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1344 | alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)), | |
| 1345 | 1345 | }; |
| 1346 | 1346 | |
| 1347 | 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 | 301 | |
| 302 | 302 | /// How many tomb bits per AIR instruction. |
| 303 | 303 | pub const bpi = 4; |
| 304 | pub const Bpi = std.meta.Int(.unsigned, bpi); | |
| 304 | pub const Bpi = @Int(.unsigned, bpi); | |
| 305 | 305 | pub const OperandInt = std.math.Log2Int(Bpi); |
| 306 | 306 | |
| 307 | 307 | /// Useful for decoders of Liveness information. |
src/InternPool.zig+2-2| ... | ... | @@ -2660,7 +2660,7 @@ pub const Key = union(enum) { |
| 2660 | 2660 | switch (float.storage) { |
| 2661 | 2661 | inline else => |val| std.hash.autoHash( |
| 2662 | 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 | 2666 | return hasher.final(); |
| ... | ... | @@ -3012,7 +3012,7 @@ pub const Key = union(enum) { |
| 3012 | 3012 | |
| 3013 | 3013 | switch (a_info.storage) { |
| 3014 | 3014 | inline else => |val, tag| { |
| 3015 | const Bits = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(val))); | |
| 3015 | const Bits = @Int(.unsigned, @bitSizeOf(@TypeOf(val))); | |
| 3016 | 3016 | const a_bits: Bits = @bitCast(val); |
| 3017 | 3017 | const b_bits: Bits = @bitCast(@field(b_info.storage, @tagName(tag))); |
| 3018 | 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 | 7221 | |
| 7222 | 7222 | fn undefPattern(comptime IntType: type) IntType { |
| 7223 | 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 | 7225 | return @bitCast(@as(UnsignedType, (1 << (int_info.bits | 1)) / 3)); |
| 7226 | 7226 | } |
| 7227 | 7227 |
src/codegen/riscv64/bits.zig+1-1| ... | ... | @@ -118,7 +118,7 @@ pub const Immediate = union(enum) { |
| 118 | 118 | const int_info = @typeInfo(T).int; |
| 119 | 119 | if (int_info.signedness != .unsigned) @compileError("Immediate.asBits needs unsigned T"); |
| 120 | 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 | 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 | 821 | const gpa = ass.cg.module.gpa; |
| 822 | 822 | |
| 823 | 823 | const Float = std.meta.Float(width); |
| 824 | const Int = std.meta.Int(.unsigned, width); | |
| 824 | const Int = @Int(.unsigned, width); | |
| 825 | 825 | |
| 826 | 826 | const tok = ass.currentToken(); |
| 827 | 827 | try ass.expectToken(.value); |
src/codegen/spirv/Section.zig+1-1| ... | ... | @@ -8,7 +8,7 @@ const testing = std.testing; |
| 8 | 8 | |
| 9 | 9 | const spec = @import("spec.zig"); |
| 10 | 10 | const Word = spec.Word; |
| 11 | const DoubleWord = std.meta.Int(.unsigned, @bitSizeOf(Word) * 2); | |
| 11 | const DoubleWord = @Int(.unsigned, @bitSizeOf(Word) * 2); | |
| 12 | 12 | const Log2Word = std.math.Log2Int(Word); |
| 13 | 13 | |
| 14 | 14 | const Opcode = spec.Opcode; |
test/behavior/abs.zig+1-1| ... | ... | @@ -155,7 +155,7 @@ test "@abs big int <= 128 bits" { |
| 155 | 155 | try testAbsUnsignedBigInt(); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | fn abs(comptime T: type, a: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) { | |
| 158 | fn abs(comptime T: type, a: T) @Int(.unsigned, @typeInfo(T).int.bits) { | |
| 159 | 159 | return @abs(a); |
| 160 | 160 | } |
| 161 | 161 |
test/behavior/atomics.zig+3-3| ... | ... | @@ -232,7 +232,7 @@ fn testAtomicRmwInts() !void { |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | fn testAtomicRmwInt(comptime signedness: std.builtin.Signedness, comptime N: usize) !void { |
| 235 | const int = std.meta.Int(signedness, N); | |
| 235 | const int = @Int(signedness, N); | |
| 236 | 236 | |
| 237 | 237 | var x: int = 1; |
| 238 | 238 | var res = @atomicRmw(int, &x, .Xchg, 3, .seq_cst); |
| ... | ... | @@ -293,8 +293,8 @@ test "atomicrmw with 128-bit ints" { |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void { |
| 296 | const uint = std.meta.Int(.unsigned, 128); | |
| 297 | const int = std.meta.Int(signedness, 128); | |
| 296 | const uint = @Int(.unsigned, 128); | |
| 297 | const int = @Int(signedness, 128); | |
| 298 | 298 | |
| 299 | 299 | const initial: int = @as(int, @bitCast(@as(uint, 0xaaaaaaaa_bbbbbbbb_cccccccc_dddddddd))); |
| 300 | 300 | const replacement: int = 0x00000000_00000005_00000000_00000003; |
test/behavior/bit_shifting.zig+2-2| ... | ... | @@ -5,10 +5,10 @@ const builtin = @import("builtin"); |
| 5 | 5 | |
| 6 | 6 | fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type { |
| 7 | 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 | 9 | std.debug.assert(key_bits >= mask_bit_count); |
| 10 | 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 | 12 | const shift_amount = key_bits - shard_key_bits; |
| 13 | 13 | return struct { |
| 14 | 14 | const Self = @This(); |
test/behavior/bitcast.zig+7-7| ... | ... | @@ -49,8 +49,8 @@ test "@bitCast iX -> uX exotic integers" { |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | fn testBitCast(comptime N: usize) !void { |
| 52 | const iN = std.meta.Int(.signed, N); | |
| 53 | const uN = std.meta.Int(.unsigned, N); | |
| 52 | const iN = @Int(.signed, N); | |
| 53 | const uN = @Int(.unsigned, N); | |
| 54 | 54 | |
| 55 | 55 | try expect(conv_iN(N, -1) == maxInt(uN)); |
| 56 | 56 | try expect(conv_uN(N, maxInt(uN)) == -1); |
| ... | ... | @@ -69,12 +69,12 @@ fn testBitCast(comptime N: usize) !void { |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | fn conv_iN(comptime N: usize, x: std.meta.Int(.signed, N)) std.meta.Int(.unsigned, N) { | |
| 73 | return @as(std.meta.Int(.unsigned, N), @bitCast(x)); | |
| 72 | fn conv_iN(comptime N: usize, x: @Int(.signed, N)) @Int(.unsigned, N) { | |
| 73 | return @as(@Int(.unsigned, N), @bitCast(x)); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | fn conv_uN(comptime N: usize, x: std.meta.Int(.unsigned, N)) std.meta.Int(.signed, N) { | |
| 77 | return @as(std.meta.Int(.signed, N), @bitCast(x)); | |
| 76 | fn conv_uN(comptime N: usize, x: @Int(.unsigned, N)) @Int(.signed, N) { | |
| 77 | return @as(@Int(.signed, N), @bitCast(x)); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | test "bitcast uX to bytes" { |
| ... | ... | @@ -101,7 +101,7 @@ fn testBitCastuXToBytes(comptime N: usize) !void { |
| 101 | 101 | // on the platforms we target. If the above behavior is restricted after all, |
| 102 | 102 | // this test should be deleted. |
| 103 | 103 | |
| 104 | const T = std.meta.Int(.unsigned, N); | |
| 104 | const T = @Int(.unsigned, N); | |
| 105 | 105 | for ([_]T{ 0, ~@as(T, 0) }) |init_value| { |
| 106 | 106 | var x: T = init_value; |
| 107 | 107 | const bytes = std.mem.asBytes(&x); |
test/behavior/math.zig+1-1| ... | ... | @@ -2359,7 +2359,7 @@ test "signed zeros are represented properly" { |
| 2359 | 2359 | } |
| 2360 | 2360 | |
| 2361 | 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 | 2363 | var as_fp_val = -@as(T, 0.0); |
| 2364 | 2364 | _ = &as_fp_val; |
| 2365 | 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 | 233 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 234 | 234 | |
| 235 | 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 | 237 | return .{ x, y }; |
| 238 | 238 | } |
| 239 | 239 | |
| ... | ... | @@ -251,7 +251,7 @@ test "coerce tuple to tuple" { |
| 251 | 251 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 252 | 252 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 253 | 253 | |
| 254 | const T = std.meta.Tuple(&.{u8}); | |
| 254 | const T = @Tuple(&.{u8}); | |
| 255 | 255 | const S = struct { |
| 256 | 256 | fn foo(x: T) !void { |
| 257 | 257 | try expect(x[0] == 123); |
| ... | ... | @@ -265,7 +265,7 @@ test "tuple type with void field" { |
| 265 | 265 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 266 | 266 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 267 | 267 | |
| 268 | const T = std.meta.Tuple(&[_]type{void}); | |
| 268 | const T = @Tuple(&.{void}); | |
| 269 | 269 | const x = T{{}}; |
| 270 | 270 | try expect(@TypeOf(x[0]) == void); |
| 271 | 271 | } |
| ... | ... | @@ -290,7 +290,7 @@ test "tuple type with void field and a runtime field" { |
| 290 | 290 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 291 | 291 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 292 | 292 | |
| 293 | const T = std.meta.Tuple(&[_]type{ usize, void }); | |
| 293 | const T = @Tuple(&.{ usize, void }); | |
| 294 | 294 | var t: T = .{ 5, {} }; |
| 295 | 295 | _ = &t; |
| 296 | 296 | try expect(t[0] == 5); |