| author | |
| committer | |
| log | 350b2adacda217014dc511ccc4cd73f22ddaac22 |
| tree | 519115799840c1abe4be6aa708a3ca5079fbd817 |
| parent | eb183ad9febef775efabb1a4592f84d6cf088c28 |
| signature |
40 files changed, 107 insertions(+), 107 deletions(-)
lib/std/child_process.zig+1-1| ... | ... | @@ -830,7 +830,7 @@ fn forkChildErrReport(fd: i32, err: ChildProcess.SpawnError) noreturn { |
| 830 | 830 | os.exit(1); |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | const ErrInt = std.meta.IntType(false, @sizeOf(anyerror) * 8); | |
| 833 | const ErrInt = std.meta.Int(false, @sizeOf(anyerror) * 8); | |
| 834 | 834 | |
| 835 | 835 | fn writeIntFd(fd: i32, value: ErrInt) !void { |
| 836 | 836 | const file = File{ |
lib/std/debug/leb128.zig+6-6| ... | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | 2 | const testing = std.testing; |
| 3 | 3 | |
| 4 | 4 | pub fn readULEB128(comptime T: type, in_stream: var) !T { |
| 5 | const ShiftT = std.meta.IntType(false, std.math.log2(T.bit_count)); | |
| 5 | const ShiftT = std.meta.Int(false, std.math.log2(T.bit_count)); | |
| 6 | 6 | |
| 7 | 7 | var result: T = 0; |
| 8 | 8 | var shift: usize = 0; |
| ... | ... | @@ -27,7 +27,7 @@ pub fn readULEB128(comptime T: type, in_stream: var) !T { |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn readULEB128Mem(comptime T: type, ptr: *[*]const u8) !T { |
| 30 | const ShiftT = std.meta.IntType(false, std.math.log2(T.bit_count)); | |
| 30 | const ShiftT = std.meta.Int(false, std.math.log2(T.bit_count)); | |
| 31 | 31 | |
| 32 | 32 | var result: T = 0; |
| 33 | 33 | var shift: usize = 0; |
| ... | ... | @@ -55,8 +55,8 @@ pub fn readULEB128Mem(comptime T: type, ptr: *[*]const u8) !T { |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | pub fn readILEB128(comptime T: type, in_stream: var) !T { |
| 58 | const UT = std.meta.IntType(false, T.bit_count); | |
| 59 | const ShiftT = std.meta.IntType(false, std.math.log2(T.bit_count)); | |
| 58 | const UT = std.meta.Int(false, T.bit_count); | |
| 59 | const ShiftT = std.meta.Int(false, std.math.log2(T.bit_count)); | |
| 60 | 60 | |
| 61 | 61 | var result: UT = 0; |
| 62 | 62 | var shift: usize = 0; |
| ... | ... | @@ -87,8 +87,8 @@ pub fn readILEB128(comptime T: type, in_stream: var) !T { |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | pub fn readILEB128Mem(comptime T: type, ptr: *[*]const u8) !T { |
| 90 | const UT = std.meta.IntType(false, T.bit_count); | |
| 91 | const ShiftT = std.meta.IntType(false, std.math.log2(T.bit_count)); | |
| 90 | const UT = std.meta.Int(false, T.bit_count); | |
| 91 | const ShiftT = std.meta.Int(false, std.math.log2(T.bit_count)); | |
| 92 | 92 | |
| 93 | 93 | var result: UT = 0; |
| 94 | 94 | var shift: usize = 0; |
lib/std/fmt.zig+2-2| ... | ... | @@ -906,7 +906,7 @@ fn formatIntSigned( |
| 906 | 906 | .fill = options.fill, |
| 907 | 907 | }; |
| 908 | 908 | const bit_count = @typeInfo(@TypeOf(value)).Int.bits; |
| 909 | const Uint = std.meta.IntType(false, bit_count); | |
| 909 | const Uint = std.meta.Int(false, bit_count); | |
| 910 | 910 | if (value < 0) { |
| 911 | 911 | try out_stream.writeAll("-"); |
| 912 | 912 | const new_value = math.absCast(value); |
| ... | ... | @@ -930,7 +930,7 @@ fn formatIntUnsigned( |
| 930 | 930 | assert(base >= 2); |
| 931 | 931 | var buf: [math.max(@TypeOf(value).bit_count, 1)]u8 = undefined; |
| 932 | 932 | const min_int_bits = comptime math.max(@TypeOf(value).bit_count, @TypeOf(base).bit_count); |
| 933 | const MinInt = std.meta.IntType(@TypeOf(value).is_signed, min_int_bits); | |
| 933 | const MinInt = std.meta.Int(@TypeOf(value).is_signed, min_int_bits); | |
| 934 | 934 | var a: MinInt = value; |
| 935 | 935 | var index: usize = buf.len; |
| 936 | 936 |
lib/std/fmt/parse_float.zig+1-1| ... | ... | @@ -367,7 +367,7 @@ test "fmt.parseFloat" { |
| 367 | 367 | const epsilon = 1e-7; |
| 368 | 368 | |
| 369 | 369 | inline for ([_]type{ f16, f32, f64, f128 }) |T| { |
| 370 | const Z = std.meta.IntType(false, T.bit_count); | |
| 370 | const Z = std.meta.Int(false, T.bit_count); | |
| 371 | 371 | |
| 372 | 372 | testing.expectError(error.InvalidCharacter, parseFloat(T, "")); |
| 373 | 373 | testing.expectError(error.InvalidCharacter, parseFloat(T, " 1")); |
lib/std/hash/auto_hash.zig+1-1| ... | ... | @@ -93,7 +93,7 @@ pub fn hash(hasher: var, key: var, comptime strat: HashStrategy) void { |
| 93 | 93 | // TODO Check if the situation is better after #561 is resolved. |
| 94 | 94 | .Int => @call(.{ .modifier = .always_inline }, hasher.update, .{std.mem.asBytes(&key)}), |
| 95 | 95 | |
| 96 | .Float => |info| hash(hasher, @bitCast(std.meta.IntType(false, info.bits), key), strat), | |
| 96 | .Float => |info| hash(hasher, @bitCast(std.meta.Int(false, info.bits), key), strat), | |
| 97 | 97 | |
| 98 | 98 | .Bool => hash(hasher, @boolToInt(key), strat), |
| 99 | 99 | .Enum => hash(hasher, @enumToInt(key), strat), |
lib/std/hash/wyhash.zig+1-1| ... | ... | @@ -10,7 +10,7 @@ const primes = [_]u64{ |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | 12 | fn read_bytes(comptime bytes: u8, data: []const u8) u64 { |
| 13 | const T = std.meta.IntType(false, 8 * bytes); | |
| 13 | const T = std.meta.Int(false, 8 * bytes); | |
| 14 | 14 | return mem.readIntLittle(T, data[0..bytes]); |
| 15 | 15 | } |
| 16 | 16 |
lib/std/heap.zig+1-1| ... | ... | @@ -1015,7 +1015,7 @@ fn testAllocatorLargeAlignment(allocator: *mem.Allocator) mem.Allocator.Error!vo |
| 1015 | 1015 | // very near usize? |
| 1016 | 1016 | if (mem.page_size << 2 > maxInt(usize)) return; |
| 1017 | 1017 | |
| 1018 | const USizeShift = std.meta.IntType(false, std.math.log2(usize.bit_count)); | |
| 1018 | const USizeShift = std.meta.Int(false, std.math.log2(usize.bit_count)); | |
| 1019 | 1019 | const large_align = @as(u29, mem.page_size << 2); |
| 1020 | 1020 | |
| 1021 | 1021 | var align_mask: usize = undefined; |
lib/std/io/bit_in_stream.zig+1-1| ... | ... | @@ -53,7 +53,7 @@ pub fn BitInStream(endian: builtin.Endian, comptime InStreamType: type) type { |
| 53 | 53 | assert(u_bit_count >= bits); |
| 54 | 54 | break :bc if (u_bit_count <= u8_bit_count) u8_bit_count else u_bit_count; |
| 55 | 55 | }; |
| 56 | const Buf = std.meta.IntType(false, buf_bit_count); | |
| 56 | const Buf = std.meta.Int(false, buf_bit_count); | |
| 57 | 57 | const BufShift = math.Log2Int(Buf); |
| 58 | 58 | |
| 59 | 59 | out_bits.* = @as(usize, 0); |
lib/std/io/bit_out_stream.zig+1-1| ... | ... | @@ -45,7 +45,7 @@ pub fn BitOutStream(endian: builtin.Endian, comptime OutStreamType: type) type { |
| 45 | 45 | assert(u_bit_count >= bits); |
| 46 | 46 | break :bc if (u_bit_count <= u8_bit_count) u8_bit_count else u_bit_count; |
| 47 | 47 | }; |
| 48 | const Buf = std.meta.IntType(false, buf_bit_count); | |
| 48 | const Buf = std.meta.Int(false, buf_bit_count); | |
| 49 | 49 | const BufShift = math.Log2Int(Buf); |
| 50 | 50 | |
| 51 | 51 | const buf_value = @intCast(Buf, value); |
lib/std/io/serialization.zig+7-7| ... | ... | @@ -51,7 +51,7 @@ pub fn Deserializer(comptime endian: builtin.Endian, comptime packing: Packing, |
| 51 | 51 | const u8_bit_count = 8; |
| 52 | 52 | const t_bit_count = comptime meta.bitCount(T); |
| 53 | 53 | |
| 54 | const U = std.meta.IntType(false, t_bit_count); | |
| 54 | const U = std.meta.Int(false, t_bit_count); | |
| 55 | 55 | const Log2U = math.Log2Int(U); |
| 56 | 56 | const int_size = (U.bit_count + 7) / 8; |
| 57 | 57 | |
| ... | ... | @@ -66,7 +66,7 @@ pub fn Deserializer(comptime endian: builtin.Endian, comptime packing: Packing, |
| 66 | 66 | |
| 67 | 67 | if (int_size == 1) { |
| 68 | 68 | if (t_bit_count == 8) return @bitCast(T, buffer[0]); |
| 69 | const PossiblySignedByte = std.meta.IntType(T.is_signed, 8); | |
| 69 | const PossiblySignedByte = std.meta.Int(T.is_signed, 8); | |
| 70 | 70 | return @truncate(T, @bitCast(PossiblySignedByte, buffer[0])); |
| 71 | 71 | } |
| 72 | 72 | |
| ... | ... | @@ -236,7 +236,7 @@ pub fn Serializer(comptime endian: builtin.Endian, comptime packing: Packing, co |
| 236 | 236 | const t_bit_count = comptime meta.bitCount(T); |
| 237 | 237 | const u8_bit_count = comptime meta.bitCount(u8); |
| 238 | 238 | |
| 239 | const U = std.meta.IntType(false, t_bit_count); | |
| 239 | const U = std.meta.Int(false, t_bit_count); | |
| 240 | 240 | const Log2U = math.Log2Int(U); |
| 241 | 241 | const int_size = (U.bit_count + 7) / 8; |
| 242 | 242 | |
| ... | ... | @@ -372,8 +372,8 @@ fn testIntSerializerDeserializer(comptime endian: builtin.Endian, comptime packi |
| 372 | 372 | |
| 373 | 373 | comptime var i = 0; |
| 374 | 374 | inline while (i <= max_test_bitsize) : (i += 1) { |
| 375 | const U = std.meta.IntType(false, i); | |
| 376 | const S = std.meta.IntType(true, i); | |
| 375 | const U = std.meta.Int(false, i); | |
| 376 | const S = std.meta.Int(true, i); | |
| 377 | 377 | try _serializer.serializeInt(@as(U, i)); |
| 378 | 378 | if (i != 0) try _serializer.serializeInt(@as(S, -1)) else try _serializer.serialize(@as(S, 0)); |
| 379 | 379 | } |
| ... | ... | @@ -381,8 +381,8 @@ fn testIntSerializerDeserializer(comptime endian: builtin.Endian, comptime packi |
| 381 | 381 | |
| 382 | 382 | i = 0; |
| 383 | 383 | inline while (i <= max_test_bitsize) : (i += 1) { |
| 384 | const U = std.meta.IntType(false, i); | |
| 385 | const S = std.meta.IntType(true, i); | |
| 384 | const U = std.meta.Int(false, i); | |
| 385 | const S = std.meta.Int(true, i); | |
| 386 | 386 | const x = try _deserializer.deserializeInt(U); |
| 387 | 387 | const y = try _deserializer.deserializeInt(S); |
| 388 | 388 | testing.expect(x == @as(U, i)); |
lib/std/math.zig+11-11| ... | ... | @@ -458,7 +458,7 @@ pub fn Log2Int(comptime T: type) type { |
| 458 | 458 | count += 1; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | return std.meta.IntType(false, count); | |
| 461 | return std.meta.Int(false, count); | |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | pub fn IntFittingRange(comptime from: comptime_int, comptime to: comptime_int) type { |
| ... | ... | @@ -474,7 +474,7 @@ pub fn IntFittingRange(comptime from: comptime_int, comptime to: comptime_int) t |
| 474 | 474 | if (is_signed) { |
| 475 | 475 | magnitude_bits += 1; |
| 476 | 476 | } |
| 477 | return std.meta.IntType(is_signed, magnitude_bits); | |
| 477 | return std.meta.Int(is_signed, magnitude_bits); | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | test "math.IntFittingRange" { |
| ... | ... | @@ -686,7 +686,7 @@ fn testRem() void { |
| 686 | 686 | /// Result is an unsigned integer. |
| 687 | 687 | pub fn absCast(x: var) switch (@typeInfo(@TypeOf(x))) { |
| 688 | 688 | .ComptimeInt => comptime_int, |
| 689 | .Int => |intInfo| std.meta.IntType(false, intInfo.bits), | |
| 689 | .Int => |intInfo| std.meta.Int(false, intInfo.bits), | |
| 690 | 690 | else => @compileError("absCast only accepts integers"), |
| 691 | 691 | } { |
| 692 | 692 | switch (@typeInfo(@TypeOf(x))) { |
| ... | ... | @@ -698,7 +698,7 @@ pub fn absCast(x: var) switch (@typeInfo(@TypeOf(x))) { |
| 698 | 698 | } |
| 699 | 699 | }, |
| 700 | 700 | .Int => |intInfo| { |
| 701 | const Uint = std.meta.IntType(false, intInfo.bits); | |
| 701 | const Uint = std.meta.Int(false, intInfo.bits); | |
| 702 | 702 | if (x < 0) { |
| 703 | 703 | return ~@bitCast(Uint, x +% -1); |
| 704 | 704 | } else { |
| ... | ... | @@ -719,10 +719,10 @@ test "math.absCast" { |
| 719 | 719 | |
| 720 | 720 | /// Returns the negation of the integer parameter. |
| 721 | 721 | /// Result is a signed integer. |
| 722 | pub fn negateCast(x: var) !std.meta.IntType(true, @TypeOf(x).bit_count) { | |
| 722 | pub fn negateCast(x: var) !std.meta.Int(true, @TypeOf(x).bit_count) { | |
| 723 | 723 | if (@TypeOf(x).is_signed) return negate(x); |
| 724 | 724 | |
| 725 | const int = std.meta.IntType(true, @TypeOf(x).bit_count); | |
| 725 | const int = std.meta.Int(true, @TypeOf(x).bit_count); | |
| 726 | 726 | if (x > -minInt(int)) return error.Overflow; |
| 727 | 727 | |
| 728 | 728 | if (x == -minInt(int)) return minInt(int); |
| ... | ... | @@ -808,11 +808,11 @@ fn testFloorPowerOfTwo() void { |
| 808 | 808 | /// Returns the next power of two (if the value is not already a power of two). |
| 809 | 809 | /// Only unsigned integers can be used. Zero is not an allowed input. |
| 810 | 810 | /// Result is a type with 1 more bit than the input type. |
| 811 | pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.IntType(T.is_signed, T.bit_count + 1) { | |
| 811 | pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(T.is_signed, T.bit_count + 1) { | |
| 812 | 812 | comptime assert(@typeInfo(T) == .Int); |
| 813 | 813 | comptime assert(!T.is_signed); |
| 814 | 814 | assert(value != 0); |
| 815 | comptime const PromotedType = std.meta.IntType(T.is_signed, T.bit_count + 1); | |
| 815 | comptime const PromotedType = std.meta.Int(T.is_signed, T.bit_count + 1); | |
| 816 | 816 | comptime const shiftType = std.math.Log2Int(PromotedType); |
| 817 | 817 | return @as(PromotedType, 1) << @intCast(shiftType, T.bit_count - @clz(T, value - 1)); |
| 818 | 818 | } |
| ... | ... | @@ -823,7 +823,7 @@ pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.IntType(T.is_s |
| 823 | 823 | pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) { |
| 824 | 824 | comptime assert(@typeInfo(T) == .Int); |
| 825 | 825 | comptime assert(!T.is_signed); |
| 826 | comptime const PromotedType = std.meta.IntType(T.is_signed, T.bit_count + 1); | |
| 826 | comptime const PromotedType = std.meta.Int(T.is_signed, T.bit_count + 1); | |
| 827 | 827 | comptime const overflowBit = @as(PromotedType, 1) << T.bit_count; |
| 828 | 828 | var x = ceilPowerOfTwoPromote(T, value); |
| 829 | 829 | if (overflowBit & x != 0) { |
| ... | ... | @@ -965,8 +965,8 @@ test "max value type" { |
| 965 | 965 | testing.expect(x == 2147483647); |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | pub fn mulWide(comptime T: type, a: T, b: T) std.meta.IntType(T.is_signed, T.bit_count * 2) { | |
| 969 | const ResultInt = std.meta.IntType(T.is_signed, T.bit_count * 2); | |
| 968 | pub fn mulWide(comptime T: type, a: T, b: T) std.meta.Int(T.is_signed, T.bit_count * 2) { | |
| 969 | const ResultInt = std.meta.Int(T.is_signed, T.bit_count * 2); | |
| 970 | 970 | return @as(ResultInt, a) * @as(ResultInt, b); |
| 971 | 971 | } |
| 972 | 972 |
lib/std/math/big/int.zig+4-4| ... | ... | @@ -9,8 +9,8 @@ const maxInt = std.math.maxInt; |
| 9 | 9 | const minInt = std.math.minInt; |
| 10 | 10 | |
| 11 | 11 | pub const Limb = usize; |
| 12 | pub const DoubleLimb = std.meta.IntType(false, 2 * Limb.bit_count); | |
| 13 | pub const SignedDoubleLimb = std.meta.IntType(true, DoubleLimb.bit_count); | |
| 12 | pub const DoubleLimb = std.meta.Int(false, 2 * Limb.bit_count); | |
| 13 | pub const SignedDoubleLimb = std.meta.Int(true, DoubleLimb.bit_count); | |
| 14 | 14 | pub const Log2Limb = math.Log2Int(Limb); |
| 15 | 15 | |
| 16 | 16 | comptime { |
| ... | ... | @@ -272,7 +272,7 @@ pub const Int = struct { |
| 272 | 272 | |
| 273 | 273 | switch (@typeInfo(T)) { |
| 274 | 274 | .Int => |info| { |
| 275 | const UT = if (T.is_signed) std.meta.IntType(false, T.bit_count - 1) else T; | |
| 275 | const UT = if (T.is_signed) std.meta.Int(false, T.bit_count - 1) else T; | |
| 276 | 276 | |
| 277 | 277 | try self.ensureCapacity(@sizeOf(UT) / @sizeOf(Limb)); |
| 278 | 278 | self.metadata = 0; |
| ... | ... | @@ -335,7 +335,7 @@ pub const Int = struct { |
| 335 | 335 | pub fn to(self: Int, comptime T: type) ConvertError!T { |
| 336 | 336 | switch (@typeInfo(T)) { |
| 337 | 337 | .Int => { |
| 338 | const UT = std.meta.IntType(false, T.bit_count); | |
| 338 | const UT = std.meta.Int(false, T.bit_count); | |
| 339 | 339 | |
| 340 | 340 | if (self.bitCountTwosComp() > T.bit_count) { |
| 341 | 341 | return error.TargetTooSmall; |
lib/std/math/big/rational.zig+3-3| ... | ... | @@ -127,8 +127,8 @@ pub const Rational = struct { |
| 127 | 127 | // Translated from golang.go/src/math/big/rat.go. |
| 128 | 128 | debug.assert(@typeInfo(T) == .Float); |
| 129 | 129 | |
| 130 | const UnsignedIntType = std.meta.IntType(false, T.bit_count); | |
| 131 | const f_bits = @bitCast(UnsignedIntType, f); | |
| 130 | const UnsignedInt = std.meta.Int(false, T.bit_count); | |
| 131 | const f_bits = @bitCast(UnsignedInt, f); | |
| 132 | 132 | |
| 133 | 133 | const exponent_bits = math.floatExponentBits(T); |
| 134 | 134 | const exponent_bias = (1 << (exponent_bits - 1)) - 1; |
| ... | ... | @@ -186,7 +186,7 @@ pub const Rational = struct { |
| 186 | 186 | debug.assert(@typeInfo(T) == .Float); |
| 187 | 187 | |
| 188 | 188 | const fsize = T.bit_count; |
| 189 | const BitReprType = std.meta.IntType(false, T.bit_count); | |
| 189 | const BitReprType = std.meta.Int(false, T.bit_count); | |
| 190 | 190 | |
| 191 | 191 | const msize = math.floatMantissaBits(T); |
| 192 | 192 | const msize1 = msize + 1; |
lib/std/math/cos.zig+1-1| ... | ... | @@ -44,7 +44,7 @@ const pi4c = 2.69515142907905952645E-15; |
| 44 | 44 | const m4pi = 1.273239544735162542821171882678754627704620361328125; |
| 45 | 45 | |
| 46 | 46 | fn cos_(comptime T: type, x_: T) T { |
| 47 | const I = std.meta.IntType(true, T.bit_count); | |
| 47 | const I = std.meta.Int(true, T.bit_count); | |
| 48 | 48 | |
| 49 | 49 | var x = x_; |
| 50 | 50 | if (math.isNan(x) or math.isInf(x)) { |
lib/std/math/pow.zig+1-1| ... | ... | @@ -145,7 +145,7 @@ pub fn pow(comptime T: type, x: T, y: T) T { |
| 145 | 145 | var xe = r2.exponent; |
| 146 | 146 | var x1 = r2.significand; |
| 147 | 147 | |
| 148 | var i = @floatToInt(std.meta.IntType(true, T.bit_count), yi); | |
| 148 | var i = @floatToInt(std.meta.Int(true, T.bit_count), yi); | |
| 149 | 149 | while (i != 0) : (i >>= 1) { |
| 150 | 150 | const overflow_shift = math.floatExponentBits(T) + 1; |
| 151 | 151 | if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) { |
lib/std/math/sin.zig+1-1| ... | ... | @@ -45,7 +45,7 @@ const pi4c = 2.69515142907905952645E-15; |
| 45 | 45 | const m4pi = 1.273239544735162542821171882678754627704620361328125; |
| 46 | 46 | |
| 47 | 47 | fn sin_(comptime T: type, x_: T) T { |
| 48 | const I = std.meta.IntType(true, T.bit_count); | |
| 48 | const I = std.meta.Int(true, T.bit_count); | |
| 49 | 49 | |
| 50 | 50 | var x = x_; |
| 51 | 51 | if (x == 0 or math.isNan(x)) { |
lib/std/math/sqrt.zig+3-3| ... | ... | @@ -31,7 +31,7 @@ pub fn sqrt(x: var) Sqrt(@TypeOf(x)) { |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | fn sqrt_int(comptime T: type, value: T) std.meta.IntType(false, T.bit_count / 2) { | |
| 34 | fn sqrt_int(comptime T: type, value: T) std.meta.Int(false, T.bit_count / 2) { | |
| 35 | 35 | var op = value; |
| 36 | 36 | var res: T = 0; |
| 37 | 37 | var one: T = 1 << (T.bit_count - 2); |
| ... | ... | @@ -50,7 +50,7 @@ fn sqrt_int(comptime T: type, value: T) std.meta.IntType(false, T.bit_count / 2) |
| 50 | 50 | one >>= 2; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | const ResultType = std.meta.IntType(false, T.bit_count / 2); | |
| 53 | const ResultType = std.meta.Int(false, T.bit_count / 2); | |
| 54 | 54 | return @intCast(ResultType, res); |
| 55 | 55 | } |
| 56 | 56 | |
| ... | ... | @@ -66,7 +66,7 @@ test "math.sqrt_int" { |
| 66 | 66 | /// Returns the return type `sqrt` will return given an operand of type `T`. |
| 67 | 67 | pub fn Sqrt(comptime T: type) type { |
| 68 | 68 | return switch (@typeInfo(T)) { |
| 69 | .Int => |int| std.meta.IntType(false, int.bits / 2), | |
| 69 | .Int => |int| std.meta.Int(false, int.bits / 2), | |
| 70 | 70 | else => T, |
| 71 | 71 | }; |
| 72 | 72 | } |
lib/std/math/tan.zig+1-1| ... | ... | @@ -38,7 +38,7 @@ const pi4c = 2.69515142907905952645E-15; |
| 38 | 38 | const m4pi = 1.273239544735162542821171882678754627704620361328125; |
| 39 | 39 | |
| 40 | 40 | fn tan_(comptime T: type, x_: T) T { |
| 41 | const I = std.meta.IntType(true, T.bit_count); | |
| 41 | const I = std.meta.Int(true, T.bit_count); | |
| 42 | 42 | |
| 43 | 43 | var x = x_; |
| 44 | 44 | if (x == 0 or math.isNan(x)) { |
lib/std/mem.zig+2-2| ... | ... | @@ -1065,7 +1065,7 @@ pub fn writeIntSliceLittle(comptime T: type, buffer: []u8, value: T) void { |
| 1065 | 1065 | return set(u8, buffer, 0); |
| 1066 | 1066 | |
| 1067 | 1067 | // TODO I want to call writeIntLittle here but comptime eval facilities aren't good enough |
| 1068 | const uint = std.meta.IntType(false, T.bit_count); | |
| 1068 | const uint = std.meta.Int(false, T.bit_count); | |
| 1069 | 1069 | var bits = @truncate(uint, value); |
| 1070 | 1070 | for (buffer) |*b| { |
| 1071 | 1071 | b.* = @truncate(u8, bits); |
| ... | ... | @@ -1085,7 +1085,7 @@ pub fn writeIntSliceBig(comptime T: type, buffer: []u8, value: T) void { |
| 1085 | 1085 | return set(u8, buffer, 0); |
| 1086 | 1086 | |
| 1087 | 1087 | // TODO I want to call writeIntBig here but comptime eval facilities aren't good enough |
| 1088 | const uint = std.meta.IntType(false, T.bit_count); | |
| 1088 | const uint = std.meta.Int(false, T.bit_count); | |
| 1089 | 1089 | var bits = @truncate(uint, value); |
| 1090 | 1090 | var index: usize = buffer.len; |
| 1091 | 1091 | while (index != 0) { |
lib/std/os.zig+1-1| ... | ... | @@ -3681,7 +3681,7 @@ pub fn res_mkquery( |
| 3681 | 3681 | // Make a reasonably unpredictable id |
| 3682 | 3682 | var ts: timespec = undefined; |
| 3683 | 3683 | clock_gettime(CLOCK_REALTIME, &ts) catch {}; |
| 3684 | const UInt = std.meta.IntType(false, @TypeOf(ts.tv_nsec).bit_count); | |
| 3684 | const UInt = std.meta.Int(false, @TypeOf(ts.tv_nsec).bit_count); | |
| 3685 | 3685 | const unsec = @bitCast(UInt, ts.tv_nsec); |
| 3686 | 3686 | const id = @truncate(u32, unsec + unsec / 65536); |
| 3687 | 3687 | q[0] = @truncate(u8, id / 256); |
lib/std/os/bits/linux.zig+1-1| ... | ... | @@ -1037,7 +1037,7 @@ pub const dl_phdr_info = extern struct { |
| 1037 | 1037 | |
| 1038 | 1038 | pub const CPU_SETSIZE = 128; |
| 1039 | 1039 | pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize; |
| 1040 | pub const cpu_count_t = std.meta.IntType(false, std.math.log2(CPU_SETSIZE * 8)); | |
| 1040 | pub const cpu_count_t = std.meta.Int(false, std.math.log2(CPU_SETSIZE * 8)); | |
| 1041 | 1041 | |
| 1042 | 1042 | pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { |
| 1043 | 1043 | var sum: cpu_count_t = 0; |
lib/std/packed_int_array.zig+6-6| ... | ... | @@ -34,13 +34,13 @@ pub fn PackedIntIo(comptime Int: type, comptime endian: builtin.Endian) type { |
| 34 | 34 | |
| 35 | 35 | //we bitcast the desired Int type to an unsigned version of itself |
| 36 | 36 | // to avoid issues with shifting signed ints. |
| 37 | const UnInt = std.meta.IntType(false, int_bits); | |
| 37 | const UnInt = std.meta.Int(false, int_bits); | |
| 38 | 38 | |
| 39 | 39 | //The maximum container int type |
| 40 | const MinIo = std.meta.IntType(false, min_io_bits); | |
| 40 | const MinIo = std.meta.Int(false, min_io_bits); | |
| 41 | 41 | |
| 42 | 42 | //The minimum container int type |
| 43 | const MaxIo = std.meta.IntType(false, max_io_bits); | |
| 43 | const MaxIo = std.meta.Int(false, max_io_bits); | |
| 44 | 44 | |
| 45 | 45 | return struct { |
| 46 | 46 | pub fn get(bytes: []const u8, index: usize, bit_offset: u7) Int { |
| ... | ... | @@ -322,7 +322,7 @@ test "PackedIntArray" { |
| 322 | 322 | inline while (bits <= 256) : (bits += 1) { |
| 323 | 323 | //alternate unsigned and signed |
| 324 | 324 | const even = bits % 2 == 0; |
| 325 | const I = std.meta.IntType(even, bits); | |
| 325 | const I = std.meta.Int(even, bits); | |
| 326 | 326 | |
| 327 | 327 | const PackedArray = PackedIntArray(I, int_count); |
| 328 | 328 | const expected_bytes = ((bits * int_count) + 7) / 8; |
| ... | ... | @@ -369,7 +369,7 @@ test "PackedIntSlice" { |
| 369 | 369 | inline while (bits <= 256) : (bits += 1) { |
| 370 | 370 | //alternate unsigned and signed |
| 371 | 371 | const even = bits % 2 == 0; |
| 372 | const I = std.meta.IntType(even, bits); | |
| 372 | const I = std.meta.Int(even, bits); | |
| 373 | 373 | const P = PackedIntSlice(I); |
| 374 | 374 | |
| 375 | 375 | var data = P.init(&buffer, int_count); |
| ... | ... | @@ -399,7 +399,7 @@ test "PackedIntSlice of PackedInt(Array/Slice)" { |
| 399 | 399 | |
| 400 | 400 | comptime var bits = 0; |
| 401 | 401 | inline while (bits <= max_bits) : (bits += 1) { |
| 402 | const Int = std.meta.IntType(false, bits); | |
| 402 | const Int = std.meta.Int(false, bits); | |
| 403 | 403 | |
| 404 | 404 | const PackedArray = PackedIntArray(Int, int_count); |
| 405 | 405 | var packed_array = @as(PackedArray, undefined); |
lib/std/rand.zig+10-10| ... | ... | @@ -45,8 +45,8 @@ pub const Random = struct { |
| 45 | 45 | /// Returns a random int `i` such that `0 <= i <= maxInt(T)`. |
| 46 | 46 | /// `i` is evenly distributed. |
| 47 | 47 | pub fn int(r: *Random, comptime T: type) T { |
| 48 | const UnsignedT = std.meta.IntType(false, T.bit_count); | |
| 49 | const ByteAlignedT = std.meta.IntType(false, @divTrunc(T.bit_count + 7, 8) * 8); | |
| 48 | const UnsignedT = std.meta.Int(false, T.bit_count); | |
| 49 | const ByteAlignedT = std.meta.Int(false, @divTrunc(T.bit_count + 7, 8) * 8); | |
| 50 | 50 | |
| 51 | 51 | var rand_bytes: [@sizeOf(ByteAlignedT)]u8 = undefined; |
| 52 | 52 | r.bytes(rand_bytes[0..]); |
| ... | ... | @@ -85,9 +85,9 @@ pub const Random = struct { |
| 85 | 85 | comptime assert(T.bit_count <= 64); // TODO: workaround: LLVM ERROR: Unsupported library call operation! |
| 86 | 86 | assert(0 < less_than); |
| 87 | 87 | // Small is typically u32 |
| 88 | const Small = std.meta.IntType(false, @divTrunc(T.bit_count + 31, 32) * 32); | |
| 88 | const Small = std.meta.Int(false, @divTrunc(T.bit_count + 31, 32) * 32); | |
| 89 | 89 | // Large is typically u64 |
| 90 | const Large = std.meta.IntType(false, Small.bit_count * 2); | |
| 90 | const Large = std.meta.Int(false, Small.bit_count * 2); | |
| 91 | 91 | |
| 92 | 92 | // adapted from: |
| 93 | 93 | // http://www.pcg-random.org/posts/bounded-rands.html |
| ... | ... | @@ -99,7 +99,7 @@ pub const Random = struct { |
| 99 | 99 | // TODO: workaround for https://github.com/ziglang/zig/issues/1770 |
| 100 | 100 | // should be: |
| 101 | 101 | // var t: Small = -%less_than; |
| 102 | var t: Small = @bitCast(Small, -%@bitCast(std.meta.IntType(true, Small.bit_count), @as(Small, less_than))); | |
| 102 | var t: Small = @bitCast(Small, -%@bitCast(std.meta.Int(true, Small.bit_count), @as(Small, less_than))); | |
| 103 | 103 | |
| 104 | 104 | if (t >= less_than) { |
| 105 | 105 | t -= less_than; |
| ... | ... | @@ -145,7 +145,7 @@ pub const Random = struct { |
| 145 | 145 | assert(at_least < less_than); |
| 146 | 146 | if (T.is_signed) { |
| 147 | 147 | // Two's complement makes this math pretty easy. |
| 148 | const UnsignedT = std.meta.IntType(false, T.bit_count); | |
| 148 | const UnsignedT = std.meta.Int(false, T.bit_count); | |
| 149 | 149 | const lo = @bitCast(UnsignedT, at_least); |
| 150 | 150 | const hi = @bitCast(UnsignedT, less_than); |
| 151 | 151 | const result = lo +% r.uintLessThanBiased(UnsignedT, hi -% lo); |
| ... | ... | @@ -163,7 +163,7 @@ pub const Random = struct { |
| 163 | 163 | assert(at_least < less_than); |
| 164 | 164 | if (T.is_signed) { |
| 165 | 165 | // Two's complement makes this math pretty easy. |
| 166 | const UnsignedT = std.meta.IntType(false, T.bit_count); | |
| 166 | const UnsignedT = std.meta.Int(false, T.bit_count); | |
| 167 | 167 | const lo = @bitCast(UnsignedT, at_least); |
| 168 | 168 | const hi = @bitCast(UnsignedT, less_than); |
| 169 | 169 | const result = lo +% r.uintLessThan(UnsignedT, hi -% lo); |
| ... | ... | @@ -180,7 +180,7 @@ pub const Random = struct { |
| 180 | 180 | assert(at_least <= at_most); |
| 181 | 181 | if (T.is_signed) { |
| 182 | 182 | // Two's complement makes this math pretty easy. |
| 183 | const UnsignedT = std.meta.IntType(false, T.bit_count); | |
| 183 | const UnsignedT = std.meta.Int(false, T.bit_count); | |
| 184 | 184 | const lo = @bitCast(UnsignedT, at_least); |
| 185 | 185 | const hi = @bitCast(UnsignedT, at_most); |
| 186 | 186 | const result = lo +% r.uintAtMostBiased(UnsignedT, hi -% lo); |
| ... | ... | @@ -198,7 +198,7 @@ pub const Random = struct { |
| 198 | 198 | assert(at_least <= at_most); |
| 199 | 199 | if (T.is_signed) { |
| 200 | 200 | // Two's complement makes this math pretty easy. |
| 201 | const UnsignedT = std.meta.IntType(false, T.bit_count); | |
| 201 | const UnsignedT = std.meta.Int(false, T.bit_count); | |
| 202 | 202 | const lo = @bitCast(UnsignedT, at_least); |
| 203 | 203 | const hi = @bitCast(UnsignedT, at_most); |
| 204 | 204 | const result = lo +% r.uintAtMost(UnsignedT, hi -% lo); |
| ... | ... | @@ -275,7 +275,7 @@ pub const Random = struct { |
| 275 | 275 | /// This function introduces a minor bias. |
| 276 | 276 | pub fn limitRangeBiased(comptime T: type, random_int: T, less_than: T) T { |
| 277 | 277 | comptime assert(T.is_signed == false); |
| 278 | const T2 = std.meta.IntType(false, T.bit_count * 2); | |
| 278 | const T2 = std.meta.Int(false, T.bit_count * 2); | |
| 279 | 279 | |
| 280 | 280 | // adapted from: |
| 281 | 281 | // http://www.pcg-random.org/posts/bounded-rands.html |
lib/std/special/c.zig+1-1| ... | ... | @@ -511,7 +511,7 @@ export fn roundf(a: f32) f32 { |
| 511 | 511 | fn generic_fmod(comptime T: type, x: T, y: T) T { |
| 512 | 512 | @setRuntimeSafety(false); |
| 513 | 513 | |
| 514 | const uint = std.meta.IntType(false, T.bit_count); | |
| 514 | const uint = std.meta.Int(false, T.bit_count); | |
| 515 | 515 | const log2uint = math.Log2Int(uint); |
| 516 | 516 | const digits = if (T == f32) 23 else 52; |
| 517 | 517 | const exp_bits = if (T == f32) 9 else 12; |
lib/std/special/compiler_rt/addXf3.zig+7-7| ... | ... | @@ -54,21 +54,21 @@ pub fn __aeabi_dsub(a: f64, b: f64) callconv(.AAPCS) f64 { |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // TODO: restore inline keyword, see: https://github.com/ziglang/zig/issues/2154 |
| 57 | fn normalize(comptime T: type, significand: *std.meta.IntType(false, T.bit_count)) i32 { | |
| 58 | const Z = std.meta.IntType(false, T.bit_count); | |
| 59 | const S = std.meta.IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); | |
| 57 | fn normalize(comptime T: type, significand: *std.meta.Int(false, T.bit_count)) i32 { | |
| 58 | const Z = std.meta.Int(false, T.bit_count); | |
| 59 | const S = std.meta.Int(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); | |
| 60 | 60 | const significandBits = std.math.floatMantissaBits(T); |
| 61 | 61 | const implicitBit = @as(Z, 1) << significandBits; |
| 62 | 62 | |
| 63 | const shift = @clz(std.meta.IntType(false, T.bit_count), significand.*) - @clz(Z, implicitBit); | |
| 63 | const shift = @clz(std.meta.Int(false, T.bit_count), significand.*) - @clz(Z, implicitBit); | |
| 64 | 64 | significand.* <<= @intCast(S, shift); |
| 65 | 65 | return 1 - shift; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // TODO: restore inline keyword, see: https://github.com/ziglang/zig/issues/2154 |
| 69 | 69 | fn addXf3(comptime T: type, a: T, b: T) T { |
| 70 | const Z = std.meta.IntType(false, T.bit_count); | |
| 71 | const S = std.meta.IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); | |
| 70 | const Z = std.meta.Int(false, T.bit_count); | |
| 71 | const S = std.meta.Int(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); | |
| 72 | 72 | |
| 73 | 73 | const typeWidth = T.bit_count; |
| 74 | 74 | const significandBits = std.math.floatMantissaBits(T); |
| ... | ... | @@ -182,7 +182,7 @@ fn addXf3(comptime T: type, a: T, b: T) T { |
| 182 | 182 | // If partial cancellation occured, we need to left-shift the result |
| 183 | 183 | // and adjust the exponent: |
| 184 | 184 | if (aSignificand < implicitBit << 3) { |
| 185 | const shift = @intCast(i32, @clz(Z, aSignificand)) - @intCast(i32, @clz(std.meta.IntType(false, T.bit_count), implicitBit << 3)); | |
| 185 | const shift = @intCast(i32, @clz(Z, aSignificand)) - @intCast(i32, @clz(std.meta.Int(false, T.bit_count), implicitBit << 3)); | |
| 186 | 186 | aSignificand <<= @intCast(S, shift); |
| 187 | 187 | aExponent -= shift; |
| 188 | 188 | } |
lib/std/special/compiler_rt/compareXf2.zig+3-3| ... | ... | @@ -22,8 +22,8 @@ const GE = extern enum(i32) { |
| 22 | 22 | pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT { |
| 23 | 23 | @setRuntimeSafety(builtin.is_test); |
| 24 | 24 | |
| 25 | const srep_t = std.meta.IntType(true, T.bit_count); | |
| 26 | const rep_t = std.meta.IntType(false, T.bit_count); | |
| 25 | const srep_t = std.meta.Int(true, T.bit_count); | |
| 26 | const rep_t = std.meta.Int(false, T.bit_count); | |
| 27 | 27 | |
| 28 | 28 | const significandBits = std.math.floatMantissaBits(T); |
| 29 | 29 | const exponentBits = std.math.floatExponentBits(T); |
| ... | ... | @@ -68,7 +68,7 @@ pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT { |
| 68 | 68 | pub fn unordcmp(comptime T: type, a: T, b: T) i32 { |
| 69 | 69 | @setRuntimeSafety(builtin.is_test); |
| 70 | 70 | |
| 71 | const rep_t = std.meta.IntType(false, T.bit_count); | |
| 71 | const rep_t = std.meta.Int(false, T.bit_count); | |
| 72 | 72 | |
| 73 | 73 | const significandBits = std.math.floatMantissaBits(T); |
| 74 | 74 | const exponentBits = std.math.floatExponentBits(T); |
lib/std/special/compiler_rt/divdf3.zig+4-4| ... | ... | @@ -7,8 +7,8 @@ const builtin = @import("builtin"); |
| 7 | 7 | |
| 8 | 8 | pub fn __divdf3(a: f64, b: f64) callconv(.C) f64 { |
| 9 | 9 | @setRuntimeSafety(builtin.is_test); |
| 10 | const Z = std.meta.IntType(false, f64.bit_count); | |
| 11 | const SignedZ = std.meta.IntType(true, f64.bit_count); | |
| 10 | const Z = std.meta.Int(false, f64.bit_count); | |
| 11 | const SignedZ = std.meta.Int(true, f64.bit_count); | |
| 12 | 12 | |
| 13 | 13 | const typeWidth = f64.bit_count; |
| 14 | 14 | const significandBits = std.math.floatMantissaBits(f64); |
| ... | ... | @@ -312,9 +312,9 @@ pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void { |
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | pub fn normalize(comptime T: type, significand: *std.meta.IntType(false, T.bit_count)) i32 { | |
| 315 | pub fn normalize(comptime T: type, significand: *std.meta.Int(false, T.bit_count)) i32 { | |
| 316 | 316 | @setRuntimeSafety(builtin.is_test); |
| 317 | const Z = std.meta.IntType(false, T.bit_count); | |
| 317 | const Z = std.meta.Int(false, T.bit_count); | |
| 318 | 318 | const significandBits = std.math.floatMantissaBits(T); |
| 319 | 319 | const implicitBit = @as(Z, 1) << significandBits; |
| 320 | 320 |
lib/std/special/compiler_rt/divsf3.zig+3-3| ... | ... | @@ -7,7 +7,7 @@ const builtin = @import("builtin"); |
| 7 | 7 | |
| 8 | 8 | pub fn __divsf3(a: f32, b: f32) callconv(.C) f32 { |
| 9 | 9 | @setRuntimeSafety(builtin.is_test); |
| 10 | const Z = std.meta.IntType(false, f32.bit_count); | |
| 10 | const Z = std.meta.Int(false, f32.bit_count); | |
| 11 | 11 | |
| 12 | 12 | const typeWidth = f32.bit_count; |
| 13 | 13 | const significandBits = std.math.floatMantissaBits(f32); |
| ... | ... | @@ -185,9 +185,9 @@ pub fn __divsf3(a: f32, b: f32) callconv(.C) f32 { |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | fn normalize(comptime T: type, significand: *std.meta.IntType(false, T.bit_count)) i32 { | |
| 188 | fn normalize(comptime T: type, significand: *std.meta.Int(false, T.bit_count)) i32 { | |
| 189 | 189 | @setRuntimeSafety(builtin.is_test); |
| 190 | const Z = std.meta.IntType(false, T.bit_count); | |
| 190 | const Z = std.meta.Int(false, T.bit_count); | |
| 191 | 191 | const significandBits = std.math.floatMantissaBits(T); |
| 192 | 192 | const implicitBit = @as(Z, 1) << significandBits; |
| 193 | 193 |
lib/std/special/compiler_rt/divtf3.zig+2-2| ... | ... | @@ -6,8 +6,8 @@ const wideMultiply = @import("divdf3.zig").wideMultiply; |
| 6 | 6 | |
| 7 | 7 | pub fn __divtf3(a: f128, b: f128) callconv(.C) f128 { |
| 8 | 8 | @setRuntimeSafety(builtin.is_test); |
| 9 | const Z = std.meta.IntType(false, f128.bit_count); | |
| 10 | const SignedZ = std.meta.IntType(true, f128.bit_count); | |
| 9 | const Z = std.meta.Int(false, f128.bit_count); | |
| 10 | const SignedZ = std.meta.Int(true, f128.bit_count); | |
| 11 | 11 | |
| 12 | 12 | const typeWidth = f128.bit_count; |
| 13 | 13 | const significandBits = std.math.floatMantissaBits(f128); |
lib/std/special/compiler_rt/extendXfYf2.zig+3-3| ... | ... | @@ -30,11 +30,11 @@ pub fn __aeabi_f2d(arg: f32) callconv(.AAPCS) f64 { |
| 30 | 30 | |
| 31 | 31 | const CHAR_BIT = 8; |
| 32 | 32 | |
| 33 | fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: std.meta.IntType(false, @typeInfo(src_t).Float.bits)) dst_t { | |
| 33 | fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: std.meta.Int(false, @typeInfo(src_t).Float.bits)) dst_t { | |
| 34 | 34 | @setRuntimeSafety(builtin.is_test); |
| 35 | 35 | |
| 36 | const src_rep_t = std.meta.IntType(false, @typeInfo(src_t).Float.bits); | |
| 37 | const dst_rep_t = std.meta.IntType(false, @typeInfo(dst_t).Float.bits); | |
| 36 | const src_rep_t = std.meta.Int(false, @typeInfo(src_t).Float.bits); | |
| 37 | const dst_rep_t = std.meta.Int(false, @typeInfo(dst_t).Float.bits); | |
| 38 | 38 | const srcSigBits = std.math.floatMantissaBits(src_t); |
| 39 | 39 | const dstSigBits = std.math.floatMantissaBits(dst_t); |
| 40 | 40 | const SrcShift = std.math.Log2Int(src_rep_t); |
lib/std/special/compiler_rt/fixint.zig+1-1| ... | ... | @@ -45,7 +45,7 @@ pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t { |
| 45 | 45 | if (exponent < 0) return 0; |
| 46 | 46 | |
| 47 | 47 | // The unsigned result needs to be large enough to handle an fixint_t or rep_t |
| 48 | const fixuint_t = std.meta.IntType(false, fixint_t.bit_count); | |
| 48 | const fixuint_t = std.meta.Int(false, fixint_t.bit_count); | |
| 49 | 49 | const UintResultType = if (fixint_t.bit_count > rep_t.bit_count) fixuint_t else rep_t; |
| 50 | 50 | var uint_result: UintResultType = undefined; |
| 51 | 51 |
lib/std/special/compiler_rt/fixuint.zig+1-1| ... | ... | @@ -10,7 +10,7 @@ pub fn fixuint(comptime fp_t: type, comptime fixuint_t: type, a: fp_t) fixuint_t |
| 10 | 10 | f128 => u128, |
| 11 | 11 | else => unreachable, |
| 12 | 12 | }; |
| 13 | const srep_t = @import("std").meta.IntType(true, rep_t.bit_count); | |
| 13 | const srep_t = @import("std").meta.Int(true, rep_t.bit_count); | |
| 14 | 14 | const significandBits = switch (fp_t) { |
| 15 | 15 | f32 => 23, |
| 16 | 16 | f64 => 52, |
lib/std/special/compiler_rt/floatsiXf.zig+2-2| ... | ... | @@ -5,8 +5,8 @@ const maxInt = std.math.maxInt; |
| 5 | 5 | fn floatsiXf(comptime T: type, a: i32) T { |
| 6 | 6 | @setRuntimeSafety(builtin.is_test); |
| 7 | 7 | |
| 8 | const Z = std.meta.IntType(false, T.bit_count); | |
| 9 | const S = std.meta.IntType(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); | |
| 8 | const Z = std.meta.Int(false, T.bit_count); | |
| 9 | const S = std.meta.Int(false, T.bit_count - @clz(Z, @as(Z, T.bit_count) - 1)); | |
| 10 | 10 | |
| 11 | 11 | if (a == 0) { |
| 12 | 12 | return @as(T, 0.0); |
lib/std/special/compiler_rt/mulXf3.zig+3-3| ... | ... | @@ -28,7 +28,7 @@ pub fn __aeabi_dmul(a: f64, b: f64) callconv(.C) f64 { |
| 28 | 28 | |
| 29 | 29 | fn mulXf3(comptime T: type, a: T, b: T) T { |
| 30 | 30 | @setRuntimeSafety(builtin.is_test); |
| 31 | const Z = std.meta.IntType(false, T.bit_count); | |
| 31 | const Z = std.meta.Int(false, T.bit_count); | |
| 32 | 32 | |
| 33 | 33 | const typeWidth = T.bit_count; |
| 34 | 34 | const significandBits = std.math.floatMantissaBits(T); |
| ... | ... | @@ -264,9 +264,9 @@ fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void { |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | fn normalize(comptime T: type, significand: *std.meta.IntType(false, T.bit_count)) i32 { | |
| 267 | fn normalize(comptime T: type, significand: *std.meta.Int(false, T.bit_count)) i32 { | |
| 268 | 268 | @setRuntimeSafety(builtin.is_test); |
| 269 | const Z = std.meta.IntType(false, T.bit_count); | |
| 269 | const Z = std.meta.Int(false, T.bit_count); | |
| 270 | 270 | const significandBits = std.math.floatMantissaBits(T); |
| 271 | 271 | const implicitBit = @as(Z, 1) << significandBits; |
| 272 | 272 |
lib/std/special/compiler_rt/negXf2.zig+1-1| ... | ... | @@ -19,7 +19,7 @@ pub fn __aeabi_dneg(arg: f64) callconv(.AAPCS) f64 { |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | fn negXf2(comptime T: type, a: T) T { |
| 22 | const Z = std.meta.IntType(false, T.bit_count); | |
| 22 | const Z = std.meta.Int(false, T.bit_count); | |
| 23 | 23 | |
| 24 | 24 | const typeWidth = T.bit_count; |
| 25 | 25 | const significandBits = std.math.floatMantissaBits(T); |
lib/std/special/compiler_rt/shift.zig+2-2| ... | ... | @@ -4,8 +4,8 @@ const Log2Int = std.math.Log2Int; |
| 4 | 4 | |
| 5 | 5 | fn Dwords(comptime T: type, comptime signed_half: bool) type { |
| 6 | 6 | return extern union { |
| 7 | pub const HalfTU = std.meta.IntType(false, @divExact(T.bit_count, 2)); | |
| 8 | pub const HalfTS = std.meta.IntType(true, @divExact(T.bit_count, 2)); | |
| 7 | pub const HalfTU = std.meta.Int(false, @divExact(T.bit_count, 2)); | |
| 8 | pub const HalfTS = std.meta.Int(true, @divExact(T.bit_count, 2)); | |
| 9 | 9 | pub const HalfT = if (signed_half) HalfTS else HalfTU; |
| 10 | 10 | |
| 11 | 11 | all: T, |
lib/std/special/compiler_rt/truncXfYf2.zig+2-2| ... | ... | @@ -36,8 +36,8 @@ pub fn __aeabi_f2h(a: f32) callconv(.AAPCS) u16 { |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | fn truncXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { |
| 39 | const src_rep_t = std.meta.IntType(false, @typeInfo(src_t).Float.bits); | |
| 40 | const dst_rep_t = std.meta.IntType(false, @typeInfo(dst_t).Float.bits); | |
| 39 | const src_rep_t = std.meta.Int(false, @typeInfo(src_t).Float.bits); | |
| 40 | const dst_rep_t = std.meta.Int(false, @typeInfo(dst_t).Float.bits); | |
| 41 | 41 | const srcSigBits = std.math.floatMantissaBits(src_t); |
| 42 | 42 | const dstSigBits = std.math.floatMantissaBits(dst_t); |
| 43 | 43 | const SrcShift = std.math.Log2Int(src_rep_t); |
lib/std/special/compiler_rt/udivmod.zig+2-2| ... | ... | @@ -10,8 +10,8 @@ const high = 1 - low; |
| 10 | 10 | pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem: ?*DoubleInt) DoubleInt { |
| 11 | 11 | @setRuntimeSafety(is_test); |
| 12 | 12 | |
| 13 | const SingleInt = @import("std").meta.IntType(false, @divExact(DoubleInt.bit_count, 2)); | |
| 14 | const SignedDoubleInt = @import("std").meta.IntType(true, DoubleInt.bit_count); | |
| 13 | const SingleInt = @import("std").meta.Int(false, @divExact(DoubleInt.bit_count, 2)); | |
| 14 | const SignedDoubleInt = @import("std").meta.Int(true, DoubleInt.bit_count); | |
| 15 | 15 | const Log2SingleInt = @import("std").math.Log2Int(SingleInt); |
| 16 | 16 | |
| 17 | 17 | const n = @ptrCast(*const [2]SingleInt, &a).*; // TODO issue #421 |
lib/std/target.zig+1-1| ... | ... | @@ -459,7 +459,7 @@ pub const Target = struct { |
| 459 | 459 | pub const needed_bit_count = 155; |
| 460 | 460 | pub const byte_count = (needed_bit_count + 7) / 8; |
| 461 | 461 | pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize); |
| 462 | pub const Index = std.math.Log2Int(std.meta.IntType(false, usize_count * @bitSizeOf(usize))); | |
| 462 | pub const Index = std.math.Log2Int(std.meta.Int(false, usize_count * @bitSizeOf(usize))); | |
| 463 | 463 | pub const ShiftInt = std.math.Log2Int(usize); |
| 464 | 464 | |
| 465 | 465 | pub const empty = Set{ .ints = [1]usize{0} ** usize_count }; |
test/stage1/behavior/bit_shifting.zig+2-2| ... | ... | @@ -2,9 +2,9 @@ const std = @import("std"); |
| 2 | 2 | const expect = std.testing.expect; |
| 3 | 3 | |
| 4 | 4 | fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type { |
| 5 | expect(Key == std.meta.IntType(false, Key.bit_count)); | |
| 5 | expect(Key == std.meta.Int(false, Key.bit_count)); | |
| 6 | 6 | expect(Key.bit_count >= mask_bit_count); |
| 7 | const ShardKey = std.meta.IntType(false, mask_bit_count); | |
| 7 | const ShardKey = std.meta.Int(false, mask_bit_count); | |
| 8 | 8 | const shift_amount = Key.bit_count - ShardKey.bit_count; |
| 9 | 9 | return struct { |
| 10 | 10 | const Self = @This(); |