authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-04-28 19:10:09-06:00
committergravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-04-28 19:11:31-06:00
log350b2adacda217014dc511ccc4cd73f22ddaac22
tree519115799840c1abe4be6aa708a3ca5079fbd817
parenteb183ad9febef775efabb1a4592f84d6cf088c28
signature Commit is signed but in an unrecognized format.

std.meta.IntType -> std.meta.Int


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