Skip to content

Commit 9052e0b

Browse files
authored
Merge pull request #6713 from jprudil/close-6697
Make std.meta.Int accept a signedness parameter
2 parents fa17447 + 1328138 commit 9052e0b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+126
-120
lines changed

lib/std/child_process.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ fn forkChildErrReport(fd: i32, err: ChildProcess.SpawnError) noreturn {
826826
os.exit(1);
827827
}
828828

829-
const ErrInt = std.meta.Int(false, @sizeOf(anyerror) * 8);
829+
const ErrInt = std.meta.Int(.unsigned, @sizeOf(anyerror) * 8);
830830

831831
fn writeIntFd(fd: i32, value: ErrInt) !void {
832832
const file = File{

lib/std/debug/leb128.zig

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn writeULEB128(writer: anytype, uint_value: anytype) !void {
5555
}
5656
}
5757

58-
/// Read a single unsinged integer from the given memory as type T.
58+
/// Read a single unsigned integer from the given memory as type T.
5959
/// The provided slice reference will be updated to point to the byte after the last byte read.
6060
pub fn readULEB128Mem(comptime T: type, ptr: *[]const u8) !T {
6161
var buf = std.io.fixedBufferStream(ptr.*);
@@ -78,7 +78,7 @@ pub fn writeULEB128Mem(ptr: []u8, uint_value: anytype) !usize {
7878
/// or error.Overflow if the value cannot fit.
7979
pub fn readILEB128(comptime T: type, reader: anytype) !T {
8080
const S = if (@typeInfo(T).Int.bits < 8) i8 else T;
81-
const U = std.meta.Int(false, @typeInfo(S).Int.bits);
81+
const U = std.meta.Int(.unsigned, @typeInfo(S).Int.bits);
8282
const ShiftU = std.math.Log2Int(U);
8383

8484
const max_group = (@typeInfo(U).Int.bits + 6) / 7;
@@ -128,7 +128,7 @@ pub fn readILEB128(comptime T: type, reader: anytype) !T {
128128
pub fn writeILEB128(writer: anytype, int_value: anytype) !void {
129129
const T = @TypeOf(int_value);
130130
const S = if (@typeInfo(T).Int.bits < 8) i8 else T;
131-
const U = std.meta.Int(false, @typeInfo(S).Int.bits);
131+
const U = std.meta.Int(.unsigned, @typeInfo(S).Int.bits);
132132

133133
var value = @intCast(S, int_value);
134134

@@ -171,7 +171,7 @@ pub fn writeILEB128Mem(ptr: []u8, int_value: anytype) !usize {
171171
/// An example use case of this is in emitting DWARF info where one wants to make a ULEB128 field
172172
/// "relocatable", meaning that it becomes possible to later go back and patch the number to be a
173173
/// different value without shifting all the following code.
174-
pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(false, l * 7)) void {
174+
pub fn writeUnsignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.unsigned, l * 7)) void {
175175
const T = @TypeOf(int);
176176
const U = if (@typeInfo(T).Int.bits < 8) u8 else T;
177177
var value = @intCast(U, int);
@@ -347,6 +347,7 @@ test "deserialize unsigned LEB128" {
347347
fn test_write_leb128(value: anytype) !void {
348348
const T = @TypeOf(value);
349349
const t_signed = @typeInfo(T).Int.is_signed;
350+
const signedness = if (t_signed) .signed else .unsigned;
350351

351352
const writeStream = if (t_signed) writeILEB128 else writeULEB128;
352353
const writeMem = if (t_signed) writeILEB128Mem else writeULEB128Mem;
@@ -356,10 +357,10 @@ fn test_write_leb128(value: anytype) !void {
356357
// decode to a larger bit size too, to ensure sign extension
357358
// is working as expected
358359
const larger_type_bits = ((@typeInfo(T).Int.bits + 8) / 8) * 8;
359-
const B = std.meta.Int(t_signed, larger_type_bits);
360+
const B = std.meta.Int(signedness, larger_type_bits);
360361

361362
const bytes_needed = bn: {
362-
const S = std.meta.Int(t_signed, @sizeOf(T) * 8);
363+
const S = std.meta.Int(signedness, @sizeOf(T) * 8);
363364
if (@typeInfo(T).Int.bits <= 7) break :bn @as(u16, 1);
364365

365366
const unused_bits = if (value < 0) @clz(T, ~value) else @clz(T, value);
@@ -412,10 +413,10 @@ test "serialize unsigned LEB128" {
412413

413414
comptime var t = 0;
414415
inline while (t <= max_bits) : (t += 1) {
415-
const T = std.meta.Int(false, t);
416+
const T = std.meta.Int(.unsigned, t);
416417
const min = std.math.minInt(T);
417418
const max = std.math.maxInt(T);
418-
var i = @as(std.meta.Int(false, @typeInfo(T).Int.bits + 1), min);
419+
var i = @as(std.meta.Int(.unsigned, @typeInfo(T).Int.bits + 1), min);
419420

420421
while (i <= max) : (i += 1) try test_write_leb128(@intCast(T, i));
421422
}
@@ -430,10 +431,10 @@ test "serialize signed LEB128" {
430431

431432
comptime var t = 1;
432433
inline while (t <= max_bits) : (t += 1) {
433-
const T = std.meta.Int(true, t);
434+
const T = std.meta.Int(.signed, t);
434435
const min = std.math.minInt(T);
435436
const max = std.math.maxInt(T);
436-
var i = @as(std.meta.Int(true, @typeInfo(T).Int.bits + 1), min);
437+
var i = @as(std.meta.Int(.signed, @typeInfo(T).Int.bits + 1), min);
437438

438439
while (i <= max) : (i += 1) try test_write_leb128(@intCast(T, i));
439440
}

lib/std/event/wait_group.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Loop = std.event.Loop;
2222
pub const WaitGroup = WaitGroupGeneric(std.meta.bitCount(usize));
2323

2424
pub fn WaitGroupGeneric(comptime counter_size: u16) type {
25-
const CounterType = std.meta.Int(false, counter_size);
25+
const CounterType = std.meta.Int(.unsigned, counter_size);
2626

2727
const global_event_loop = Loop.instance orelse
2828
@compileError("std.event.WaitGroup currently only works with event-based I/O");

lib/std/fmt.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ pub fn formatInt(
950950
// The type must have the same size as `base` or be wider in order for the
951951
// division to work
952952
const min_int_bits = comptime math.max(value_info.bits, 8);
953-
const MinInt = std.meta.Int(false, min_int_bits);
953+
const MinInt = std.meta.Int(.unsigned, min_int_bits);
954954

955955
const abs_value = math.absCast(int_value);
956956
// The worst case in terms of space needed is base 2, plus 1 for the sign

lib/std/fmt/parse_float.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ test "fmt.parseFloat" {
374374
const epsilon = 1e-7;
375375

376376
inline for ([_]type{ f16, f32, f64, f128 }) |T| {
377-
const Z = std.meta.Int(false, @typeInfo(T).Float.bits);
377+
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
378378

379379
testing.expectError(error.InvalidCharacter, parseFloat(T, ""));
380380
testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));

lib/std/hash/wyhash.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const primes = [_]u64{
1515
};
1616

1717
fn read_bytes(comptime bytes: u8, data: []const u8) u64 {
18-
const T = std.meta.Int(false, 8 * bytes);
18+
const T = std.meta.Int(.unsigned, 8 * bytes);
1919
return mem.readIntLittle(T, data[0..bytes]);
2020
}
2121

lib/std/heap.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ pub fn testAllocatorLargeAlignment(base_allocator: *mem.Allocator) mem.Allocator
963963
// very near usize?
964964
if (mem.page_size << 2 > maxInt(usize)) return;
965965

966-
const USizeShift = std.meta.Int(false, std.math.log2(std.meta.bitCount(usize)));
966+
const USizeShift = std.meta.Int(.unsigned, std.math.log2(std.meta.bitCount(usize)));
967967
const large_align = @as(u29, mem.page_size << 2);
968968

969969
var align_mask: usize = undefined;

lib/std/heap/general_purpose_allocator.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const page_size = std.mem.page_size;
107107
const StackTrace = std.builtin.StackTrace;
108108

109109
/// Integer type for pointing to slots in a small allocation
110-
const SlotIndex = std.meta.Int(false, math.log2(page_size) + 1);
110+
const SlotIndex = std.meta.Int(.unsigned, math.log2(page_size) + 1);
111111

112112
const sys_can_stack_trace = switch (std.Target.current.cpu.arch) {
113113
// Observed to go into an infinite loop.

lib/std/io/bit_reader.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type {
6060
assert(u_bit_count >= bits);
6161
break :bc if (u_bit_count <= u8_bit_count) u8_bit_count else u_bit_count;
6262
};
63-
const Buf = std.meta.Int(false, buf_bit_count);
63+
const Buf = std.meta.Int(.unsigned, buf_bit_count);
6464
const BufShift = math.Log2Int(Buf);
6565

6666
out_bits.* = @as(usize, 0);

lib/std/io/bit_writer.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type {
5252
assert(u_bit_count >= bits);
5353
break :bc if (u_bit_count <= u8_bit_count) u8_bit_count else u_bit_count;
5454
};
55-
const Buf = std.meta.Int(false, buf_bit_count);
55+
const Buf = std.meta.Int(.unsigned, buf_bit_count);
5656
const BufShift = math.Log2Int(Buf);
5757

5858
const buf_value = @intCast(Buf, value);

lib/std/io/serialization.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn Deserializer(comptime endian: builtin.Endian, comptime packing: Packing,
5858
const u8_bit_count = 8;
5959
const t_bit_count = comptime meta.bitCount(T);
6060

61-
const U = std.meta.Int(false, t_bit_count);
61+
const U = std.meta.Int(.unsigned, t_bit_count);
6262
const Log2U = math.Log2Int(U);
6363
const int_size = (t_bit_count + 7) / 8;
6464

@@ -73,7 +73,7 @@ pub fn Deserializer(comptime endian: builtin.Endian, comptime packing: Packing,
7373

7474
if (int_size == 1) {
7575
if (t_bit_count == 8) return @bitCast(T, buffer[0]);
76-
const PossiblySignedByte = std.meta.Int(@typeInfo(T).Int.is_signed, 8);
76+
const PossiblySignedByte = std.meta.Int(if (@typeInfo(T).Int.is_signed) .signed else .unsigned, 8);
7777
return @truncate(T, @bitCast(PossiblySignedByte, buffer[0]));
7878
}
7979

@@ -245,7 +245,7 @@ pub fn Serializer(comptime endian: builtin.Endian, comptime packing: Packing, co
245245
const t_bit_count = comptime meta.bitCount(T);
246246
const u8_bit_count = comptime meta.bitCount(u8);
247247

248-
const U = std.meta.Int(false, t_bit_count);
248+
const U = std.meta.Int(.unsigned, t_bit_count);
249249
const Log2U = math.Log2Int(U);
250250
const int_size = (t_bit_count + 7) / 8;
251251

@@ -381,17 +381,17 @@ fn testIntSerializerDeserializer(comptime endian: builtin.Endian, comptime packi
381381

382382
comptime var i = 0;
383383
inline while (i <= max_test_bitsize) : (i += 1) {
384-
const U = std.meta.Int(false, i);
385-
const S = std.meta.Int(true, i);
384+
const U = std.meta.Int(.unsigned, i);
385+
const S = std.meta.Int(.signed, i);
386386
try _serializer.serializeInt(@as(U, i));
387387
if (i != 0) try _serializer.serializeInt(@as(S, -1)) else try _serializer.serialize(@as(S, 0));
388388
}
389389
try _serializer.flush();
390390

391391
i = 0;
392392
inline while (i <= max_test_bitsize) : (i += 1) {
393-
const U = std.meta.Int(false, i);
394-
const S = std.meta.Int(true, i);
393+
const U = std.meta.Int(.unsigned, i);
394+
const S = std.meta.Int(.signed, i);
395395
const x = try _deserializer.deserializeInt(U);
396396
const y = try _deserializer.deserializeInt(S);
397397
testing.expect(x == @as(U, i));

lib/std/math.zig

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -448,23 +448,23 @@ pub fn Log2Int(comptime T: type) type {
448448
count += 1;
449449
}
450450

451-
return std.meta.Int(false, count);
451+
return std.meta.Int(.unsigned, count);
452452
}
453453

454454
pub fn IntFittingRange(comptime from: comptime_int, comptime to: comptime_int) type {
455455
assert(from <= to);
456456
if (from == 0 and to == 0) {
457457
return u0;
458458
}
459-
const is_signed = from < 0;
459+
const sign: std.meta.Signedness = if (from < 0) .signed else .unsigned;
460460
const largest_positive_integer = max(if (from < 0) (-from) - 1 else from, to); // two's complement
461461
const base = log2(largest_positive_integer);
462462
const upper = (1 << base) - 1;
463463
var magnitude_bits = if (upper >= largest_positive_integer) base else base + 1;
464-
if (is_signed) {
464+
if (sign == .signed) {
465465
magnitude_bits += 1;
466466
}
467-
return std.meta.Int(is_signed, magnitude_bits);
467+
return std.meta.Int(sign, magnitude_bits);
468468
}
469469

470470
test "math.IntFittingRange" {
@@ -729,7 +729,7 @@ fn testRem() void {
729729
/// Result is an unsigned integer.
730730
pub fn absCast(x: anytype) switch (@typeInfo(@TypeOf(x))) {
731731
.ComptimeInt => comptime_int,
732-
.Int => |intInfo| std.meta.Int(false, intInfo.bits),
732+
.Int => |intInfo| std.meta.Int(.unsigned, intInfo.bits),
733733
else => @compileError("absCast only accepts integers"),
734734
} {
735735
switch (@typeInfo(@TypeOf(x))) {
@@ -741,7 +741,7 @@ pub fn absCast(x: anytype) switch (@typeInfo(@TypeOf(x))) {
741741
}
742742
},
743743
.Int => |intInfo| {
744-
const Uint = std.meta.Int(false, intInfo.bits);
744+
const Uint = std.meta.Int(.unsigned, intInfo.bits);
745745
if (x < 0) {
746746
return ~@bitCast(Uint, x +% -1);
747747
} else {
@@ -762,10 +762,10 @@ test "math.absCast" {
762762

763763
/// Returns the negation of the integer parameter.
764764
/// Result is a signed integer.
765-
pub fn negateCast(x: anytype) !std.meta.Int(true, std.meta.bitCount(@TypeOf(x))) {
765+
pub fn negateCast(x: anytype) !std.meta.Int(.signed, std.meta.bitCount(@TypeOf(x))) {
766766
if (@typeInfo(@TypeOf(x)).Int.is_signed) return negate(x);
767767

768-
const int = std.meta.Int(true, std.meta.bitCount(@TypeOf(x)));
768+
const int = std.meta.Int(.signed, std.meta.bitCount(@TypeOf(x)));
769769
if (x > -minInt(int)) return error.Overflow;
770770

771771
if (x == -minInt(int)) return minInt(int);
@@ -852,11 +852,11 @@ fn testFloorPowerOfTwo() void {
852852
/// Returns the next power of two (if the value is not already a power of two).
853853
/// Only unsigned integers can be used. Zero is not an allowed input.
854854
/// Result is a type with 1 more bit than the input type.
855-
pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(T).Int.is_signed, @typeInfo(T).Int.bits + 1) {
855+
pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(if (@typeInfo(T).Int.is_signed) .signed else .unsigned, @typeInfo(T).Int.bits + 1) {
856856
comptime assert(@typeInfo(T) == .Int);
857857
comptime assert(!@typeInfo(T).Int.is_signed);
858858
assert(value != 0);
859-
comptime const PromotedType = std.meta.Int(@typeInfo(T).Int.is_signed, @typeInfo(T).Int.bits + 1);
859+
comptime const PromotedType = std.meta.Int(if (@typeInfo(T).Int.is_signed) .signed else .unsigned, @typeInfo(T).Int.bits + 1);
860860
comptime const shiftType = std.math.Log2Int(PromotedType);
861861
return @as(PromotedType, 1) << @intCast(shiftType, @typeInfo(T).Int.bits - @clz(T, value - 1));
862862
}
@@ -868,7 +868,7 @@ pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) {
868868
comptime assert(@typeInfo(T) == .Int);
869869
const info = @typeInfo(T).Int;
870870
comptime assert(!info.is_signed);
871-
comptime const PromotedType = std.meta.Int(info.is_signed, info.bits + 1);
871+
comptime const PromotedType = std.meta.Int(if (info.is_signed) .signed else .unsigned, info.bits + 1);
872872
comptime const overflowBit = @as(PromotedType, 1) << info.bits;
873873
var x = ceilPowerOfTwoPromote(T, value);
874874
if (overflowBit & x != 0) {
@@ -1014,8 +1014,8 @@ test "max value type" {
10141014
testing.expect(x == 2147483647);
10151015
}
10161016

1017-
pub fn mulWide(comptime T: type, a: T, b: T) std.meta.Int(@typeInfo(T).Int.is_signed, @typeInfo(T).Int.bits * 2) {
1018-
const ResultInt = std.meta.Int(@typeInfo(T).Int.is_signed, @typeInfo(T).Int.bits * 2);
1017+
pub fn mulWide(comptime T: type, a: T, b: T) std.meta.Int(if (@typeInfo(T).Int.is_signed) .signed else .unsigned, @typeInfo(T).Int.bits * 2) {
1018+
const ResultInt = std.meta.Int(if (@typeInfo(T).Int.is_signed) .signed else .unsigned, @typeInfo(T).Int.bits * 2);
10191019
return @as(ResultInt, a) * @as(ResultInt, b);
10201020
}
10211021

lib/std/math/big.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ pub const Rational = @import("big/rational.zig").Rational;
1010
pub const int = @import("big/int.zig");
1111
pub const Limb = usize;
1212
const limb_info = @typeInfo(Limb).Int;
13-
pub const DoubleLimb = std.meta.IntType(false, 2 * limb_info.bits);
14-
pub const SignedDoubleLimb = std.meta.IntType(true, 2 * limb_info.bits);
13+
pub const DoubleLimb = std.meta.Int(.unsigned, 2 * limb_info.bits);
14+
pub const SignedDoubleLimb = std.meta.Int(.signed, 2 * limb_info.bits);
1515
pub const Log2Limb = std.math.Log2Int(Limb);
1616

1717
comptime {

lib/std/math/big/int.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn calcLimbLen(scalar: anytype) usize {
2424
const T = @TypeOf(scalar);
2525
switch (@typeInfo(T)) {
2626
.Int => |info| {
27-
const UT = if (info.is_signed) std.meta.Int(false, info.bits - 1) else T;
27+
const UT = if (info.is_signed) std.meta.Int(.unsigned, info.bits - 1) else T;
2828
return @sizeOf(UT) / @sizeOf(Limb);
2929
},
3030
.ComptimeInt => {
@@ -187,7 +187,7 @@ pub const Mutable = struct {
187187

188188
switch (@typeInfo(T)) {
189189
.Int => |info| {
190-
const UT = if (info.is_signed) std.meta.Int(false, info.bits - 1) else T;
190+
const UT = if (info.is_signed) std.meta.Int(.unsigned, info.bits - 1) else T;
191191

192192
const needed_limbs = @sizeOf(UT) / @sizeOf(Limb);
193193
assert(needed_limbs <= self.limbs.len); // value too big
@@ -1092,7 +1092,7 @@ pub const Const = struct {
10921092
pub fn to(self: Const, comptime T: type) ConvertError!T {
10931093
switch (@typeInfo(T)) {
10941094
.Int => |info| {
1095-
const UT = std.meta.Int(false, info.bits);
1095+
const UT = std.meta.Int(.unsigned, info.bits);
10961096

10971097
if (self.bitCountTwosComp() > info.bits) {
10981098
return error.TargetTooSmall;

lib/std/math/big/rational.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub const Rational = struct {
136136
// Translated from golang.go/src/math/big/rat.go.
137137
debug.assert(@typeInfo(T) == .Float);
138138

139-
const UnsignedInt = std.meta.Int(false, @typeInfo(T).Float.bits);
139+
const UnsignedInt = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
140140
const f_bits = @bitCast(UnsignedInt, f);
141141

142142
const exponent_bits = math.floatExponentBits(T);
@@ -195,7 +195,7 @@ pub const Rational = struct {
195195
debug.assert(@typeInfo(T) == .Float);
196196

197197
const fsize = @typeInfo(T).Float.bits;
198-
const BitReprType = std.meta.Int(false, fsize);
198+
const BitReprType = std.meta.Int(.unsigned, fsize);
199199

200200
const msize = math.floatMantissaBits(T);
201201
const msize1 = msize + 1;

lib/std/math/cos.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const pi4c = 2.69515142907905952645E-15;
4949
const m4pi = 1.273239544735162542821171882678754627704620361328125;
5050

5151
fn cos_(comptime T: type, x_: T) T {
52-
const I = std.meta.Int(true, @typeInfo(T).Float.bits);
52+
const I = std.meta.Int(.signed, @typeInfo(T).Float.bits);
5353

5454
var x = x_;
5555
if (math.isNan(x) or math.isInf(x)) {

lib/std/math/pow.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
150150
var xe = r2.exponent;
151151
var x1 = r2.significand;
152152

153-
var i = @floatToInt(std.meta.Int(true, @typeInfo(T).Float.bits), yi);
153+
var i = @floatToInt(std.meta.Int(.signed, @typeInfo(T).Float.bits), yi);
154154
while (i != 0) : (i >>= 1) {
155155
const overflow_shift = math.floatExponentBits(T) + 1;
156156
if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) {

lib/std/math/sin.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const pi4c = 2.69515142907905952645E-15;
5050
const m4pi = 1.273239544735162542821171882678754627704620361328125;
5151

5252
fn sin_(comptime T: type, x_: T) T {
53-
const I = std.meta.Int(true, @typeInfo(T).Float.bits);
53+
const I = std.meta.Int(.signed, @typeInfo(T).Float.bits);
5454

5555
var x = x_;
5656
if (x == 0 or math.isNan(x)) {

0 commit comments

Comments
 (0)