@zigc/lib 0.17.0-dev.269 → 0.17.0-dev.292
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/aro/aro/CodeGen.zig +2 -2
- package/compiler/resinator/errors.zig +7 -7
- package/compiler_rt/addf3.zig +1 -1
- package/compiler_rt/comparef.zig +3 -3
- package/compiler_rt/count0bits.zig +1 -1
- package/compiler_rt/divdf3.zig +2 -2
- package/compiler_rt/divsf3.zig +1 -1
- package/compiler_rt/divtf3.zig +1 -1
- package/compiler_rt/divxf3.zig +1 -1
- package/compiler_rt/extendf.zig +5 -5
- package/compiler_rt/fabs.zig +1 -1
- package/compiler_rt/float_from_int.zig +3 -4
- package/compiler_rt/fmax.zig +1 -1
- package/compiler_rt/fmin.zig +1 -1
- package/compiler_rt/fmod.zig +2 -2
- package/compiler_rt/mulf3.zig +2 -2
- package/compiler_rt/truncf.zig +3 -3
- package/compiler_rt.zig +4 -4
- package/package.json +1 -1
- package/std/Build/Watch/FsEvents.zig +1 -1
- package/std/Build/abi.zig +1 -1
- package/std/Io/Dir.zig +2 -2
- package/std/Io/Dispatch.zig +2 -2
- package/std/Io/Threaded.zig +5 -5
- package/std/Io/Uring.zig +2 -2
- package/std/Io/Writer.zig +2 -2
- package/std/Random.zig +6 -6
- package/std/Target.zig +1 -1
- package/std/bit_set.zig +3 -3
- package/std/c.zig +7 -6
- package/std/compress/zstd/Decompress.zig +5 -5
- package/std/crypto/aes_ccm.zig +2 -2
- package/std/crypto/cmac.zig +1 -1
- package/std/crypto/codecs/asn1/der/Encoder.zig +1 -1
- package/std/crypto/ff.zig +2 -3
- package/std/crypto/keccak_p.zig +1 -1
- package/std/crypto/ml_dsa.zig +6 -6
- package/std/crypto/ml_kem.zig +6 -6
- package/std/crypto/modes.zig +1 -1
- package/std/crypto/pcurves/common.zig +4 -5
- package/std/crypto/timing_safe.zig +5 -5
- package/std/debug.zig +4 -1
- package/std/enums.zig +5 -5
- package/std/fmt/parse_float.zig +1 -1
- package/std/fmt.zig +1 -6
- package/std/hash/wyhash.zig +1 -1
- package/std/hash_map.zig +20 -1
- package/std/heap/debug_allocator.zig +1 -1
- package/std/{builtin.zig → lang.zig} +1 -1
- package/std/leb128.zig +2 -2
- package/std/math/big/int.zig +2 -2
- package/std/math/big.zig +4 -4
- package/std/math/copysign.zig +1 -1
- package/std/math/frexp.zig +4 -4
- package/std/math/ilogb.zig +1 -1
- package/std/math/isfinite.zig +1 -1
- package/std/math/isinf.zig +1 -1
- package/std/math/isnan.zig +1 -2
- package/std/math/isnormal.zig +2 -2
- package/std/math/iszero.zig +2 -2
- package/std/math/ldexp.zig +2 -2
- package/std/math/nextafter.zig +2 -2
- package/std/math/pow.zig +1 -1
- package/std/math.zig +8 -8
- package/std/mem/Allocator.zig +0 -6
- package/std/mem.zig +21 -21
- package/std/meta/trailer_flags.zig +1 -1
- package/std/meta.zig +3 -35
- package/std/os/emscripten.zig +4 -4
- package/std/os/linux/bpf.zig +6 -0
- package/std/os/linux/ioctl.zig +2 -2
- package/std/os/linux.zig +14 -12
- package/std/os/plan9.zig +1 -1
- package/std/os/uefi/tables/runtime_services.zig +1 -1
- package/std/posix.zig +1 -1
- package/std/process/Environ.zig +1 -1
- package/std/process.zig +2 -2
- package/std/std.zig +4 -1
- package/std/testing.zig +1 -1
- package/std/zig/Ast.zig +2 -2
- package/std/zig/AstGen.zig +37 -37
- package/std/zig/LibCInstallation.zig +3 -3
- package/std/zig/Zir.zig +15 -15
- package/std/zig/llvm/Builder.zig +16 -6
- package/std/zig/llvm/bitcode_writer.zig +3 -3
- package/std/zig/llvm/ir.zig +8 -8
- package/std/zig/target.zig +1 -3
- package/std/zig.zig +2 -2
- /package/std/{builtin → lang}/assembly.zig +0 -0
|
@@ -894,7 +894,7 @@ fn genLval(c: *CodeGen, node_index: Node.Index) Error!Ir.Ref {
|
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
-
const duped_name = try c.builder.arena.allocator().
|
|
897
|
+
const duped_name = try c.builder.arena.allocator().dupeSentinel(u8, slice, 0);
|
|
898
898
|
const ref: Ir.Ref = @enumFromInt(c.builder.instructions.len);
|
|
899
899
|
try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr });
|
|
900
900
|
return ref;
|
|
@@ -1112,7 +1112,7 @@ fn genCall(c: *CodeGen, call: Node.Call) Error!Ir.Ref {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
|
-
const duped_name = try c.builder.arena.allocator().
|
|
1115
|
+
const duped_name = try c.builder.arena.allocator().dupeSentinel(u8, slice, 0);
|
|
1116
1116
|
const ref: Ir.Ref = @enumFromInt(c.builder.instructions.len);
|
|
1117
1117
|
try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr });
|
|
1118
1118
|
break :blk ref;
|
|
@@ -43,7 +43,7 @@ pub const Diagnostics = struct {
|
|
|
43
43
|
try self.errors.append(self.allocator, error_details);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const SmallestStringIndexType =
|
|
46
|
+
const SmallestStringIndexType = @Int(.unsigned, @min(
|
|
47
47
|
@bitSizeOf(ErrorDetails.FileOpenError.FilenameStringIndex),
|
|
48
48
|
@min(
|
|
49
49
|
@bitSizeOf(ErrorDetails.IconReadError.FilenameStringIndex),
|
|
@@ -165,7 +165,7 @@ pub const ErrorDetails = struct {
|
|
|
165
165
|
err: FileOpenErrorEnum,
|
|
166
166
|
filename_string_index: FilenameStringIndex,
|
|
167
167
|
|
|
168
|
-
pub const FilenameStringIndex =
|
|
168
|
+
pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(FileOpenErrorEnum));
|
|
169
169
|
pub const FileOpenErrorEnum = std.meta.FieldEnum(Io.File.OpenError || Io.File.StatError);
|
|
170
170
|
|
|
171
171
|
pub fn enumFromError(err: (Io.File.OpenError || Io.File.StatError)) FileOpenErrorEnum {
|
|
@@ -180,7 +180,7 @@ pub const ErrorDetails = struct {
|
|
|
180
180
|
icon_type: enum(u1) { cursor, icon },
|
|
181
181
|
filename_string_index: FilenameStringIndex,
|
|
182
182
|
|
|
183
|
-
pub const FilenameStringIndex =
|
|
183
|
+
pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(IconReadErrorEnum) - 1);
|
|
184
184
|
pub const IconReadErrorEnum = std.meta.FieldEnum(ico.ReadError);
|
|
185
185
|
|
|
186
186
|
pub fn enumFromError(err: ico.ReadError) IconReadErrorEnum {
|
|
@@ -197,14 +197,14 @@ pub const ErrorDetails = struct {
|
|
|
197
197
|
bitmap_version: ico.BitmapHeader.Version = .unknown,
|
|
198
198
|
_: Padding = 0,
|
|
199
199
|
|
|
200
|
-
pub const Padding =
|
|
200
|
+
pub const Padding = @Int(.unsigned, 15 - @bitSizeOf(ico.BitmapHeader.Version) - @bitSizeOf(ico.ImageFormat));
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
pub const BitmapReadError = packed struct(u32) {
|
|
204
204
|
err: BitmapReadErrorEnum,
|
|
205
205
|
filename_string_index: FilenameStringIndex,
|
|
206
206
|
|
|
207
|
-
pub const FilenameStringIndex =
|
|
207
|
+
pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(BitmapReadErrorEnum));
|
|
208
208
|
pub const BitmapReadErrorEnum = std.meta.FieldEnum(bmp.ReadError);
|
|
209
209
|
|
|
210
210
|
pub fn enumFromError(err: bmp.ReadError) BitmapReadErrorEnum {
|
|
@@ -218,14 +218,14 @@ pub const ErrorDetails = struct {
|
|
|
218
218
|
dib_version: ico.BitmapHeader.Version,
|
|
219
219
|
filename_string_index: FilenameStringIndex,
|
|
220
220
|
|
|
221
|
-
pub const FilenameStringIndex =
|
|
221
|
+
pub const FilenameStringIndex = @Int(.unsigned, 32 - @bitSizeOf(ico.BitmapHeader.Version));
|
|
222
222
|
};
|
|
223
223
|
|
|
224
224
|
pub const AcceleratorError = packed struct(u32) {
|
|
225
225
|
err: AcceleratorErrorEnum,
|
|
226
226
|
_: Padding = 0,
|
|
227
227
|
|
|
228
|
-
pub const Padding =
|
|
228
|
+
pub const Padding = @Int(.unsigned, 32 - @bitSizeOf(AcceleratorErrorEnum));
|
|
229
229
|
pub const AcceleratorErrorEnum = std.meta.FieldEnum(res.ParseAcceleratorKeyStringError);
|
|
230
230
|
|
|
231
231
|
pub fn enumFromError(err: res.ParseAcceleratorKeyStringError) AcceleratorErrorEnum {
|
package/compiler_rt/addf3.zig
CHANGED
|
@@ -8,7 +8,7 @@ const normalize = compiler_rt.normalize;
|
|
|
8
8
|
/// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/lib/builtins/fp_add_impl.inc
|
|
9
9
|
pub inline fn addf3(comptime T: type, a: T, b: T) T {
|
|
10
10
|
const bits = @typeInfo(T).float.bits;
|
|
11
|
-
const Z =
|
|
11
|
+
const Z = @Int(.unsigned, bits);
|
|
12
12
|
|
|
13
13
|
const typeWidth = bits;
|
|
14
14
|
const significandBits = math.floatMantissaBits(T);
|
package/compiler_rt/comparef.zig
CHANGED
|
@@ -162,8 +162,8 @@ pub const GE = enum(i32) {
|
|
|
162
162
|
|
|
163
163
|
pub inline fn cmpf2(comptime T: type, comptime RT: type, a: T, b: T) RT {
|
|
164
164
|
const bits = @typeInfo(T).float.bits;
|
|
165
|
-
const srep_t =
|
|
166
|
-
const rep_t =
|
|
165
|
+
const srep_t = @Int(.signed, bits);
|
|
166
|
+
const rep_t = @Int(.unsigned, bits);
|
|
167
167
|
|
|
168
168
|
const significandBits = std.math.floatMantissaBits(T);
|
|
169
169
|
const exponentBits = std.math.floatExponentBits(T);
|
|
@@ -253,7 +253,7 @@ test "cmp_f80" {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
pub inline fn unordcmp(comptime T: type, a: T, b: T) i32 {
|
|
256
|
-
const rep_t =
|
|
256
|
+
const rep_t = @Int(.unsigned, @typeInfo(T).float.bits);
|
|
257
257
|
|
|
258
258
|
const significandBits = std.math.floatMantissaBits(T);
|
|
259
259
|
const exponentBits = std.math.floatExponentBits(T);
|
|
@@ -198,7 +198,7 @@ pub fn __ctzti2(a: i128) callconv(.c) i32 {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
inline fn ffsXi2(comptime T: type, a: T) i32 {
|
|
201
|
-
var x:
|
|
201
|
+
var x: @Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a);
|
|
202
202
|
var n: T = 1;
|
|
203
203
|
// adapted from Number of trailing zeroes (see ctzXi2)
|
|
204
204
|
var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));
|
package/compiler_rt/divdf3.zig
CHANGED
|
@@ -26,8 +26,8 @@ fn __aeabi_ddiv(a: f64, b: f64) callconv(.{ .arm_aapcs = .{} }) f64 {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
inline fn div(a: f64, b: f64) f64 {
|
|
29
|
-
const Z =
|
|
30
|
-
const SignedZ =
|
|
29
|
+
const Z = @Int(.unsigned, 64);
|
|
30
|
+
const SignedZ = @Int(.signed, 64);
|
|
31
31
|
|
|
32
32
|
const significandBits = std.math.floatMantissaBits(f64);
|
|
33
33
|
const exponentBits = std.math.floatExponentBits(f64);
|
package/compiler_rt/divsf3.zig
CHANGED
|
@@ -25,7 +25,7 @@ fn __aeabi_fdiv(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
inline fn div(a: f32, b: f32) f32 {
|
|
28
|
-
const Z =
|
|
28
|
+
const Z = @Int(.unsigned, 32);
|
|
29
29
|
|
|
30
30
|
const significandBits = std.math.floatMantissaBits(f32);
|
|
31
31
|
const exponentBits = std.math.floatExponentBits(f32);
|
package/compiler_rt/divtf3.zig
CHANGED
|
@@ -24,7 +24,7 @@ fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.c) void {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
inline fn div(a: f128, b: f128) f128 {
|
|
27
|
-
const Z =
|
|
27
|
+
const Z = @Int(.unsigned, 128);
|
|
28
28
|
|
|
29
29
|
const significandBits = std.math.floatMantissaBits(f128);
|
|
30
30
|
const exponentBits = std.math.floatExponentBits(f128);
|
package/compiler_rt/divxf3.zig
CHANGED
|
@@ -13,7 +13,7 @@ comptime {
|
|
|
13
13
|
|
|
14
14
|
pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 {
|
|
15
15
|
const T = f80;
|
|
16
|
-
const Z =
|
|
16
|
+
const Z = @Int(.unsigned, @bitSizeOf(T));
|
|
17
17
|
|
|
18
18
|
const significandBits = std.math.floatMantissaBits(T);
|
|
19
19
|
const fractionalBits = std.math.floatFractionalBits(T);
|
package/compiler_rt/extendf.zig
CHANGED
|
@@ -3,10 +3,10 @@ const std = @import("std");
|
|
|
3
3
|
pub inline fn extendf(
|
|
4
4
|
comptime dst_t: type,
|
|
5
5
|
comptime src_t: type,
|
|
6
|
-
a:
|
|
6
|
+
a: @Int(.unsigned, @typeInfo(src_t).float.bits),
|
|
7
7
|
) dst_t {
|
|
8
|
-
const src_rep_t =
|
|
9
|
-
const dst_rep_t =
|
|
8
|
+
const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
|
|
9
|
+
const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits);
|
|
10
10
|
const srcSigBits = std.math.floatMantissaBits(src_t);
|
|
11
11
|
const dstSigBits = std.math.floatMantissaBits(dst_t);
|
|
12
12
|
|
|
@@ -70,8 +70,8 @@ pub inline fn extendf(
|
|
|
70
70
|
return @bitCast(result);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
pub inline fn extend_f80(comptime src_t: type, a:
|
|
74
|
-
const src_rep_t =
|
|
73
|
+
pub inline fn extend_f80(comptime src_t: type, a: @Int(.unsigned, @typeInfo(src_t).float.bits)) f80 {
|
|
74
|
+
const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
|
|
75
75
|
const src_sig_bits = std.math.floatMantissaBits(src_t);
|
|
76
76
|
const dst_int_bit = 0x8000000000000000;
|
|
77
77
|
const dst_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
|
package/compiler_rt/fabs.zig
CHANGED
|
@@ -47,7 +47,7 @@ pub fn fabsl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
|
47
47
|
|
|
48
48
|
inline fn generic_fabs(x: anytype) @TypeOf(x) {
|
|
49
49
|
const T = @TypeOf(x);
|
|
50
|
-
const TBits =
|
|
50
|
+
const TBits = @Int(.unsigned, @typeInfo(T).float.bits);
|
|
51
51
|
const float_bits: TBits = @bitCast(x);
|
|
52
52
|
const remove_sign = ~@as(TBits, 0) >> 1;
|
|
53
53
|
return @bitCast(float_bits & remove_sign);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
|
-
const Int = std.meta.Int;
|
|
3
2
|
const math = std.math;
|
|
4
3
|
|
|
5
4
|
pub fn floatFromInt(comptime T: type, x: anytype) T {
|
|
@@ -7,14 +6,14 @@ pub fn floatFromInt(comptime T: type, x: anytype) T {
|
|
|
7
6
|
|
|
8
7
|
// Various constants whose values follow from the type parameters.
|
|
9
8
|
// Any reasonable optimizer will fold and propagate all of these.
|
|
10
|
-
const Z = Int(.unsigned, @bitSizeOf(@TypeOf(x)));
|
|
11
|
-
const uT = Int(.unsigned, @bitSizeOf(T));
|
|
9
|
+
const Z = @Int(.unsigned, @bitSizeOf(@TypeOf(x)));
|
|
10
|
+
const uT = @Int(.unsigned, @bitSizeOf(T));
|
|
12
11
|
const inf = math.inf(T);
|
|
13
12
|
const float_bits = @bitSizeOf(T);
|
|
14
13
|
const int_bits = @bitSizeOf(@TypeOf(x));
|
|
15
14
|
const exp_bits = math.floatExponentBits(T);
|
|
16
15
|
const fractional_bits = math.floatFractionalBits(T);
|
|
17
|
-
const exp_bias = math.maxInt(Int(.unsigned, exp_bits - 1));
|
|
16
|
+
const exp_bias = math.maxInt(@Int(.unsigned, exp_bits - 1));
|
|
18
17
|
const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0;
|
|
19
18
|
const max_exp = exp_bias;
|
|
20
19
|
|
package/compiler_rt/fmax.zig
CHANGED
|
@@ -59,7 +59,7 @@ inline fn generic_fmax(comptime T: type, x: T, y: T) T {
|
|
|
59
59
|
test "generic_fmax" {
|
|
60
60
|
inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| {
|
|
61
61
|
const nan_val = math.nan(T);
|
|
62
|
-
const Int =
|
|
62
|
+
const Int = @Int(.unsigned, @bitSizeOf(T));
|
|
63
63
|
|
|
64
64
|
try std.testing.expect(math.isNan(generic_fmax(T, nan_val, nan_val)));
|
|
65
65
|
try std.testing.expectEqual(@as(T, 1.0), generic_fmax(T, nan_val, 1.0));
|
package/compiler_rt/fmin.zig
CHANGED
|
@@ -59,7 +59,7 @@ inline fn generic_fmin(comptime T: type, x: T, y: T) T {
|
|
|
59
59
|
test "generic_fmin" {
|
|
60
60
|
inline for ([_]type{ f32, f64, c_longdouble, f80, f128 }) |T| {
|
|
61
61
|
const nan_val = math.nan(T);
|
|
62
|
-
const Int =
|
|
62
|
+
const Int = @Int(.unsigned, @bitSizeOf(T));
|
|
63
63
|
|
|
64
64
|
try std.testing.expect(math.isNan(generic_fmin(T, nan_val, nan_val)));
|
|
65
65
|
try std.testing.expectEqual(@as(T, 1.0), generic_fmin(T, nan_val, 1.0));
|
package/compiler_rt/fmod.zig
CHANGED
|
@@ -36,7 +36,7 @@ pub fn fmod(x: f64, y: f64) callconv(.c) f64 {
|
|
|
36
36
|
/// Logic and flow heavily inspired by MUSL fmodl for 113 mantissa digits
|
|
37
37
|
pub fn __fmodx(a: f80, b: f80) callconv(.c) f80 {
|
|
38
38
|
const T = f80;
|
|
39
|
-
const Z =
|
|
39
|
+
const Z = @Int(.unsigned, @bitSizeOf(T));
|
|
40
40
|
|
|
41
41
|
const significandBits = math.floatMantissaBits(T);
|
|
42
42
|
const fractionalBits = math.floatFractionalBits(T);
|
|
@@ -260,7 +260,7 @@ pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.c) c_longdouble {
|
|
|
260
260
|
|
|
261
261
|
inline fn generic_fmod(comptime T: type, x: T, y: T) T {
|
|
262
262
|
const bits = @typeInfo(T).float.bits;
|
|
263
|
-
const uint =
|
|
263
|
+
const uint = @Int(.unsigned, bits);
|
|
264
264
|
comptime assert(T == f32 or T == f64);
|
|
265
265
|
const digits = if (T == f32) 23 else 52;
|
|
266
266
|
const exp_bits = if (T == f32) 9 else 12;
|
package/compiler_rt/mulf3.zig
CHANGED
|
@@ -12,7 +12,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
|
|
|
12
12
|
const fractionalBits = math.floatFractionalBits(T);
|
|
13
13
|
const exponentBits = math.floatExponentBits(T);
|
|
14
14
|
|
|
15
|
-
const Z =
|
|
15
|
+
const Z = @Int(.unsigned, typeWidth);
|
|
16
16
|
|
|
17
17
|
// ZSignificand is large enough to contain the significand, including an explicit integer bit
|
|
18
18
|
const ZSignificand = PowerOfTwoSignificandZ(T);
|
|
@@ -195,7 +195,7 @@ fn normalize(comptime T: type, significand: *PowerOfTwoSignificandZ(T)) i32 {
|
|
|
195
195
|
/// the significand of T, including an explicit integer bit
|
|
196
196
|
fn PowerOfTwoSignificandZ(comptime T: type) type {
|
|
197
197
|
const bits = math.ceilPowerOfTwoAssert(u16, math.floatFractionalBits(T) + 1);
|
|
198
|
-
return
|
|
198
|
+
return @Int(.unsigned, bits);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
test {
|
package/compiler_rt/truncf.zig
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
2
|
|
|
3
3
|
pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {
|
|
4
|
-
const src_rep_t =
|
|
5
|
-
const dst_rep_t =
|
|
4
|
+
const src_rep_t = @Int(.unsigned, @typeInfo(src_t).float.bits);
|
|
5
|
+
const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits);
|
|
6
6
|
const srcSigBits = std.math.floatMantissaBits(src_t);
|
|
7
7
|
const dstSigBits = std.math.floatMantissaBits(dst_t);
|
|
8
8
|
|
|
@@ -100,7 +100,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t {
|
|
103
|
-
const dst_rep_t =
|
|
103
|
+
const dst_rep_t = @Int(.unsigned, @typeInfo(dst_t).float.bits);
|
|
104
104
|
const src_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
|
|
105
105
|
const dst_sig_bits = std.math.floatMantissaBits(dst_t);
|
|
106
106
|
|
package/compiler_rt.zig
CHANGED
|
@@ -574,8 +574,8 @@ pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
|
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
|
|
577
|
-
pub fn normalize(comptime T: type, significand:
|
|
578
|
-
const Z =
|
|
577
|
+
pub fn normalize(comptime T: type, significand: *@Int(.unsigned, @typeInfo(T).float.bits)) i32 {
|
|
578
|
+
const Z = @Int(.unsigned, @typeInfo(T).float.bits);
|
|
579
579
|
const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
|
|
580
580
|
|
|
581
581
|
const shift = @clz(significand.*) - @clz(integerBit);
|
|
@@ -625,8 +625,8 @@ fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
|
|
|
625
625
|
pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
|
|
626
626
|
return extern union {
|
|
627
627
|
pub const bits = @divExact(@typeInfo(T).int.bits, 2);
|
|
628
|
-
pub const HalfTU =
|
|
629
|
-
pub const HalfTS =
|
|
628
|
+
pub const HalfTU = @Int(.unsigned, bits);
|
|
629
|
+
pub const HalfTS = @Int(.signed, bits);
|
|
630
630
|
pub const HalfT = if (signed_half) HalfTS else HalfTU;
|
|
631
631
|
|
|
632
632
|
all: T,
|
package/package.json
CHANGED
|
@@ -195,7 +195,7 @@ pub fn setPaths(fse: *FsEvents, gpa: Allocator, steps: []const *std.Build.Step)
|
|
|
195
195
|
} else {
|
|
196
196
|
fse.watch_roots = try gpa.realloc(fse.watch_roots, need_dirs.count());
|
|
197
197
|
for (fse.watch_roots, need_dirs.keys()) |*out, in| {
|
|
198
|
-
out.* = try paths_arena.
|
|
198
|
+
out.* = try paths_arena.dupeSentinel(u8, in, 0);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
if (enable_debug_logs) {
|
package/std/Build/abi.zig
CHANGED
|
@@ -266,7 +266,7 @@ pub const fuzz = struct {
|
|
|
266
266
|
.comptime_int => x,
|
|
267
267
|
.bool => @intFromBool(x),
|
|
268
268
|
.@"enum" => @intFromEnum(x),
|
|
269
|
-
else => @as(
|
|
269
|
+
else => @as(@Int(.unsigned, @bitSizeOf(T)), @bitCast(x)),
|
|
270
270
|
|
|
271
271
|
.int => |i| x: {
|
|
272
272
|
comptime {
|
package/std/Io/Dir.zig
CHANGED
|
@@ -944,7 +944,7 @@ pub const RealPathFileAllocError = RealPathFileError || Allocator.Error;
|
|
|
944
944
|
pub fn realPathFileAlloc(dir: Dir, io: Io, sub_path: []const u8, allocator: Allocator) RealPathFileAllocError![:0]u8 {
|
|
945
945
|
var buffer: [max_path_bytes]u8 = undefined;
|
|
946
946
|
const n = try realPathFile(dir, io, sub_path, &buffer);
|
|
947
|
-
return allocator.
|
|
947
|
+
return allocator.dupeSentinel(u8, buffer[0..n], 0);
|
|
948
948
|
}
|
|
949
949
|
|
|
950
950
|
/// Same as `realPathFile` except `absolute_path` is asserted to be an absolute
|
|
@@ -974,7 +974,7 @@ pub fn realPathFileAbsolute(io: Io, absolute_path: []const u8, out_buffer: []u8)
|
|
|
974
974
|
pub fn realPathFileAbsoluteAlloc(io: Io, absolute_path: []const u8, allocator: Allocator) RealPathFileAllocError![:0]u8 {
|
|
975
975
|
var buffer: [max_path_bytes]u8 = undefined;
|
|
976
976
|
const n = try realPathFileAbsolute(io, absolute_path, &buffer);
|
|
977
|
-
return allocator.
|
|
977
|
+
return allocator.dupeSentinel(u8, buffer[0..n], 0);
|
|
978
978
|
}
|
|
979
979
|
|
|
980
980
|
pub const DeleteFileError = error{
|
package/std/Io/Dispatch.zig
CHANGED
|
@@ -4086,7 +4086,7 @@ fn processReplace(userdata: ?*anyopaque, options: process.ReplaceOptions) proces
|
|
|
4086
4086
|
const arena = arena_allocator.allocator();
|
|
4087
4087
|
|
|
4088
4088
|
const argv_buf = try arena.allocSentinel(?[*:0]const u8, options.argv.len, null);
|
|
4089
|
-
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.
|
|
4089
|
+
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeSentinel(u8, arg, 0)).ptr;
|
|
4090
4090
|
|
|
4091
4091
|
const env_block = env_block: {
|
|
4092
4092
|
const prog_fd: i32 = -1;
|
|
@@ -4222,7 +4222,7 @@ fn spawn(ev: *Evented, options: process.SpawnOptions) process.SpawnError!Spawned
|
|
|
4222
4222
|
// Therefore, we do all the allocation for the execve() before the fork().
|
|
4223
4223
|
// This means we must do the null-termination of argv and env vars here.
|
|
4224
4224
|
const argv_buf = try arena.allocSentinel(?[*:0]const u8, options.argv.len, null);
|
|
4225
|
-
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.
|
|
4225
|
+
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeSentinel(u8, arg, 0)).ptr;
|
|
4226
4226
|
|
|
4227
4227
|
const env_block = env_block: {
|
|
4228
4228
|
const prog_fd: i32 = if (prog_pipe[1] == -1) -1 else prog_fileno;
|
package/std/Io/Threaded.zig
CHANGED
|
@@ -956,7 +956,7 @@ const Thread = struct {
|
|
|
956
956
|
comptime assert(builtin.cpu.has(.wasm, .atomics));
|
|
957
957
|
// TODO implement cancelation for WASM futex waits by signaling the futex
|
|
958
958
|
if (!uncancelable) try Thread.checkCancel();
|
|
959
|
-
const to: i64 = if (timeout_ns) |ns| ns else -1;
|
|
959
|
+
const to: i64 = if (timeout_ns) |ns| std.math.cast(i64, ns) orelse std.math.maxInt(i64) else -1;
|
|
960
960
|
const signed_expect: i32 = @bitCast(expect);
|
|
961
961
|
const result = asm volatile (
|
|
962
962
|
\\local.get %[ptr]
|
|
@@ -13851,7 +13851,7 @@ fn netLookupFallible(
|
|
|
13851
13851
|
const name_c = name_buffer[0..name.len :0];
|
|
13852
13852
|
|
|
13853
13853
|
var port_buffer: [8]u8 = undefined;
|
|
13854
|
-
const port_c = std.fmt.
|
|
13854
|
+
const port_c = std.fmt.bufPrintSentinel(&port_buffer, "{d}", .{options.port}, 0) catch unreachable;
|
|
13855
13855
|
|
|
13856
13856
|
const hints: posix.addrinfo = .{
|
|
13857
13857
|
.flags = .{ .CANONNAME = options.canonical_name_buffer != null, .NUMERICSERV = true },
|
|
@@ -14954,7 +14954,7 @@ fn processReplace(userdata: ?*anyopaque, options: process.ReplaceOptions) proces
|
|
|
14954
14954
|
const arena = arena_allocator.allocator();
|
|
14955
14955
|
|
|
14956
14956
|
const argv_buf = try arena.allocSentinel(?[*:0]const u8, options.argv.len, null);
|
|
14957
|
-
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.
|
|
14957
|
+
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeSentinel(u8, arg, 0)).ptr;
|
|
14958
14958
|
|
|
14959
14959
|
const env_block = env_block: {
|
|
14960
14960
|
const prog_fd: i32 = -1;
|
|
@@ -15061,7 +15061,7 @@ fn spawnPosix(t: *Threaded, options: process.SpawnOptions) process.SpawnError!Sp
|
|
|
15061
15061
|
// Therefore, we do all the allocation for the execve() before the fork().
|
|
15062
15062
|
// This means we must do the null-termination of argv and env vars here.
|
|
15063
15063
|
const argv_buf = try arena.allocSentinel(?[*:0]const u8, options.argv.len, null);
|
|
15064
|
-
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.
|
|
15064
|
+
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeSentinel(u8, arg, 0)).ptr;
|
|
15065
15065
|
|
|
15066
15066
|
const prog_fileno = 3;
|
|
15067
15067
|
comptime assert(@max(posix.STDIN_FILENO, posix.STDOUT_FILENO, posix.STDERR_FILENO) + 1 == prog_fileno);
|
|
@@ -15574,7 +15574,7 @@ fn readIntFd(fd: posix.fd_t) !ErrInt {
|
|
|
15574
15574
|
return @intCast(std.mem.readInt(u64, &buffer, .little));
|
|
15575
15575
|
}
|
|
15576
15576
|
|
|
15577
|
-
const ErrInt =
|
|
15577
|
+
const ErrInt = @Int(.unsigned, @sizeOf(anyerror) * 8);
|
|
15578
15578
|
|
|
15579
15579
|
fn destroyPipe(pipe: [2]posix.fd_t) void {
|
|
15580
15580
|
if (pipe[0] != -1) closeFd(pipe[0]);
|
package/std/Io/Uring.zig
CHANGED
|
@@ -4226,7 +4226,7 @@ fn processReplace(userdata: ?*anyopaque, options: process.ReplaceOptions) proces
|
|
|
4226
4226
|
const arena = arena_allocator.allocator();
|
|
4227
4227
|
|
|
4228
4228
|
const argv_buf = try arena.allocSentinel(?[*:0]const u8, options.argv.len, null);
|
|
4229
|
-
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.
|
|
4229
|
+
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeSentinel(u8, arg, 0)).ptr;
|
|
4230
4230
|
|
|
4231
4231
|
const env_block = env_block: {
|
|
4232
4232
|
const prog_fd: i32 = -1;
|
|
@@ -4369,7 +4369,7 @@ fn spawn(ev: *Evented, options: process.SpawnOptions) process.SpawnError!Spawned
|
|
|
4369
4369
|
// Therefore, we do all the allocation for the execve() before the fork().
|
|
4370
4370
|
// This means we must do the null-termination of argv and env vars here.
|
|
4371
4371
|
const argv_buf = try arena.allocSentinel(?[*:0]const u8, options.argv.len, null);
|
|
4372
|
-
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.
|
|
4372
|
+
for (options.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeSentinel(u8, arg, 0)).ptr;
|
|
4373
4373
|
|
|
4374
4374
|
const env_block = env_block: {
|
|
4375
4375
|
const prog_fd: i32 = if (prog_pipe[1] == -1) -1 else prog_fileno;
|
package/std/Io/Writer.zig
CHANGED
|
@@ -1517,7 +1517,7 @@ pub fn printIntAny(
|
|
|
1517
1517
|
// The type must have the same size as `base` or be wider in order for the
|
|
1518
1518
|
// division to work
|
|
1519
1519
|
const min_int_bits = comptime @max(value_info.bits, 8);
|
|
1520
|
-
const MinInt =
|
|
1520
|
+
const MinInt = @Int(.unsigned, min_int_bits);
|
|
1521
1521
|
|
|
1522
1522
|
const abs_value = @abs(value);
|
|
1523
1523
|
// The worst case in terms of space needed is base 2, plus 1 for the sign
|
|
@@ -1637,7 +1637,7 @@ pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precisi
|
|
|
1637
1637
|
});
|
|
1638
1638
|
|
|
1639
1639
|
const T = @TypeOf(v);
|
|
1640
|
-
const TU =
|
|
1640
|
+
const TU = @Int(.unsigned, @bitSizeOf(T));
|
|
1641
1641
|
|
|
1642
1642
|
const mantissa_bits = std.math.floatMantissaBits(T);
|
|
1643
1643
|
const fractional_bits = std.math.floatFractionalBits(T);
|
package/std/Random.zig
CHANGED
|
@@ -125,9 +125,9 @@ pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: ty
|
|
|
125
125
|
/// `i` is evenly distributed.
|
|
126
126
|
pub fn int(r: Random, comptime T: type) T {
|
|
127
127
|
const bits = @typeInfo(T).int.bits;
|
|
128
|
-
const UnsignedT =
|
|
128
|
+
const UnsignedT = @Int(.unsigned, bits);
|
|
129
129
|
const ceil_bytes = comptime std.math.divCeil(u16, bits, 8) catch unreachable;
|
|
130
|
-
const ByteAlignedT =
|
|
130
|
+
const ByteAlignedT = @Int(.unsigned, ceil_bytes * 8);
|
|
131
131
|
|
|
132
132
|
var rand_bytes: [ceil_bytes]u8 = undefined;
|
|
133
133
|
r.bytes(&rand_bytes);
|
|
@@ -215,7 +215,7 @@ pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_tha
|
|
|
215
215
|
const info = @typeInfo(T).int;
|
|
216
216
|
if (info.signedness == .signed) {
|
|
217
217
|
// Two's complement makes this math pretty easy.
|
|
218
|
-
const UnsignedT =
|
|
218
|
+
const UnsignedT = @Int(.unsigned, info.bits);
|
|
219
219
|
const lo: UnsignedT = @bitCast(at_least);
|
|
220
220
|
const hi: UnsignedT = @bitCast(less_than);
|
|
221
221
|
const result = lo +% r.uintLessThanBiased(UnsignedT, hi -% lo);
|
|
@@ -234,7 +234,7 @@ pub fn intRangeLessThan(r: Random, comptime T: type, at_least: T, less_than: T)
|
|
|
234
234
|
const info = @typeInfo(T).int;
|
|
235
235
|
if (info.signedness == .signed) {
|
|
236
236
|
// Two's complement makes this math pretty easy.
|
|
237
|
-
const UnsignedT =
|
|
237
|
+
const UnsignedT = @Int(.unsigned, info.bits);
|
|
238
238
|
const lo: UnsignedT = @bitCast(at_least);
|
|
239
239
|
const hi: UnsignedT = @bitCast(less_than);
|
|
240
240
|
const result = lo +% r.uintLessThan(UnsignedT, hi -% lo);
|
|
@@ -252,7 +252,7 @@ pub fn intRangeAtMostBiased(r: Random, comptime T: type, at_least: T, at_most: T
|
|
|
252
252
|
const info = @typeInfo(T).int;
|
|
253
253
|
if (info.signedness == .signed) {
|
|
254
254
|
// Two's complement makes this math pretty easy.
|
|
255
|
-
const UnsignedT =
|
|
255
|
+
const UnsignedT = @Int(.unsigned, info.bits);
|
|
256
256
|
const lo: UnsignedT = @bitCast(at_least);
|
|
257
257
|
const hi: UnsignedT = @bitCast(at_most);
|
|
258
258
|
const result = lo +% r.uintAtMostBiased(UnsignedT, hi -% lo);
|
|
@@ -271,7 +271,7 @@ pub fn intRangeAtMost(r: Random, comptime T: type, at_least: T, at_most: T) T {
|
|
|
271
271
|
const info = @typeInfo(T).int;
|
|
272
272
|
if (info.signedness == .signed) {
|
|
273
273
|
// Two's complement makes this math pretty easy.
|
|
274
|
-
const UnsignedT =
|
|
274
|
+
const UnsignedT = @Int(.unsigned, info.bits);
|
|
275
275
|
const lo: UnsignedT = @bitCast(at_least);
|
|
276
276
|
const hi: UnsignedT = @bitCast(at_most);
|
|
277
277
|
const result = lo +% r.uintAtMost(UnsignedT, hi -% lo);
|
package/std/Target.zig
CHANGED
|
@@ -1228,7 +1228,7 @@ pub const Cpu = struct {
|
|
|
1228
1228
|
pub const needed_bit_count = 347;
|
|
1229
1229
|
pub const byte_count = (needed_bit_count + 7) / 8;
|
|
1230
1230
|
pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize);
|
|
1231
|
-
pub const Index = std.math.Log2Int(
|
|
1231
|
+
pub const Index = std.math.Log2Int(@Int(.unsigned, usize_count * @bitSizeOf(usize)));
|
|
1232
1232
|
pub const ShiftInt = std.math.Log2Int(usize);
|
|
1233
1233
|
|
|
1234
1234
|
pub const empty: Set = .{ .ints = @splat(0) };
|
package/std/bit_set.zig
CHANGED
|
@@ -65,7 +65,7 @@ pub fn Integer(comptime size: u16) type {
|
|
|
65
65
|
pub const bit_length: usize = size;
|
|
66
66
|
|
|
67
67
|
/// The integer type used to represent a mask in this bit set
|
|
68
|
-
pub const MaskInt =
|
|
68
|
+
pub const MaskInt = @Int(.unsigned, size);
|
|
69
69
|
|
|
70
70
|
/// The integer type used to shift a mask in this bit set
|
|
71
71
|
pub const ShiftInt = std.math.Log2Int(MaskInt);
|
|
@@ -359,7 +359,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
|
|
|
359
359
|
if (!std.math.isPowerOfTwo(@bitSizeOf(MaskIntType))) {
|
|
360
360
|
var desired_bits = std.math.ceilPowerOfTwoAssert(usize, @bitSizeOf(MaskIntType));
|
|
361
361
|
if (desired_bits < byte_size) desired_bits = byte_size;
|
|
362
|
-
const FixedMaskType =
|
|
362
|
+
const FixedMaskType = @Int(.unsigned, desired_bits);
|
|
363
363
|
@compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++
|
|
364
364
|
", which is not a power of two. Please round this up to a power of two integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
|
|
365
365
|
}
|
|
@@ -370,7 +370,7 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
|
|
|
370
370
|
if (@bitSizeOf(MaskIntType) != @sizeOf(MaskIntType) * byte_size) {
|
|
371
371
|
var desired_bits = @sizeOf(MaskIntType) * byte_size;
|
|
372
372
|
desired_bits = std.math.ceilPowerOfTwoAssert(usize, desired_bits);
|
|
373
|
-
const FixedMaskType =
|
|
373
|
+
const FixedMaskType = @Int(.unsigned, desired_bits);
|
|
374
374
|
@compileError("Array was passed integer type " ++ @typeName(MaskIntType) ++
|
|
375
375
|
", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
|
|
376
376
|
}
|
package/std/c.zig
CHANGED
|
@@ -2610,7 +2610,8 @@ pub const SHUT = switch (native_os) {
|
|
|
2610
2610
|
|
|
2611
2611
|
/// Signal types
|
|
2612
2612
|
pub const SIG = switch (native_os) {
|
|
2613
|
-
.linux
|
|
2613
|
+
.linux => linux.SIG,
|
|
2614
|
+
.emscripten => emscripten.SIG,
|
|
2614
2615
|
.windows => enum(u32) {
|
|
2615
2616
|
/// interrupt
|
|
2616
2617
|
INT = 2,
|
|
@@ -7185,7 +7186,7 @@ pub const RTLD = switch (native_os) {
|
|
|
7185
7186
|
NOW: bool = false,
|
|
7186
7187
|
GLOBAL: bool = false,
|
|
7187
7188
|
LOCAL: bool = false,
|
|
7188
|
-
_:
|
|
7189
|
+
_: @Int(.unsigned, @bitSizeOf(c_int) - 6) = 0,
|
|
7189
7190
|
},
|
|
7190
7191
|
else => void,
|
|
7191
7192
|
};
|
|
@@ -7365,7 +7366,7 @@ pub const AI = if (builtin.abi.isAndroid()) packed struct(u32) {
|
|
|
7365
7366
|
V4MAPPED: bool = false,
|
|
7366
7367
|
ALL: bool = false,
|
|
7367
7368
|
ADDRCONFIG: bool = false,
|
|
7368
|
-
_:
|
|
7369
|
+
_: @Int(.unsigned, @bitSizeOf(c_int) - 7) = 0,
|
|
7369
7370
|
},
|
|
7370
7371
|
else => void,
|
|
7371
7372
|
};
|
|
@@ -7398,7 +7399,7 @@ pub const NI = switch (native_os) {
|
|
|
7398
7399
|
NAMEREQD: bool = false,
|
|
7399
7400
|
NOFQDN: bool = false,
|
|
7400
7401
|
DGRAM: bool = false,
|
|
7401
|
-
_:
|
|
7402
|
+
_: @Int(.unsigned, @bitSizeOf(c_int) - 5) = 0,
|
|
7402
7403
|
},
|
|
7403
7404
|
.freebsd, .haiku => packed struct(u32) {
|
|
7404
7405
|
NOFQDN: bool = false,
|
|
@@ -8634,7 +8635,7 @@ pub const O = switch (native_os) {
|
|
|
8634
8635
|
CLOEXEC: bool = false,
|
|
8635
8636
|
DIRECT: bool = false,
|
|
8636
8637
|
SYNC: bool = false,
|
|
8637
|
-
_:
|
|
8638
|
+
_: @Int(.unsigned, @bitSizeOf(c_int) - 14) = 0,
|
|
8638
8639
|
},
|
|
8639
8640
|
else => void,
|
|
8640
8641
|
};
|
|
@@ -8788,7 +8789,7 @@ pub const MAP = switch (native_os) {
|
|
|
8788
8789
|
RANDOMIZED: bool = false,
|
|
8789
8790
|
PURGEABLE: bool = false,
|
|
8790
8791
|
FIXED_NOREPLACE: bool = false,
|
|
8791
|
-
_:
|
|
8792
|
+
_: @Int(.unsigned, @bitSizeOf(c_int) - 11) = 0,
|
|
8792
8793
|
},
|
|
8793
8794
|
else => void,
|
|
8794
8795
|
};
|