@zigc/lib 0.16.0-dev.3070 → 0.16.0-dev.3121
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/c/math.zig +125 -22
- package/c/stropts.zig +17 -0
- package/c.zig +1 -0
- package/compiler_rt/cos.zig +141 -52
- package/compiler_rt/limb64.zig +266 -0
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/sin.zig +140 -55
- package/compiler_rt/sincos.zig +279 -72
- package/compiler_rt/tan.zig +118 -47
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt.zig +2 -0
- package/package.json +1 -1
- package/std/Build/Module.zig +1 -1
- package/std/Build/abi.zig +8 -4
- package/std/Io/Dispatch.zig +2 -0
- package/std/Io/File.zig +1 -0
- package/std/Io/Threaded.zig +2 -0
- package/std/Io/Uring.zig +1 -0
- package/std/array_list.zig +22 -31
- package/std/debug/Info.zig +4 -0
- package/std/debug/SelfInfo/Windows.zig +1 -0
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/mem/Allocator.zig +4 -5
- package/std/mem.zig +48 -0
- package/std/testing/Smith.zig +37 -2
- package/std/zig/Ast/Render.zig +186 -458
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/Parse.zig +83 -74
- package/std/zig/system.zig +2 -0
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +2 -0
- package/libc/mingw/math/arm/sincos.S +0 -30
- package/libc/mingw/math/arm-common/sincosl.c +0 -13
- package/libc/mingw/math/arm64/rint.c +0 -12
- package/libc/mingw/math/arm64/rintf.c +0 -12
- package/libc/mingw/math/arm64/sincos.S +0 -32
- package/libc/mingw/math/frexpf.c +0 -13
- package/libc/mingw/math/frexpl.c +0 -71
- package/libc/mingw/math/x86/cos.def.h +0 -65
- package/libc/mingw/math/x86/cosl.c +0 -46
- package/libc/mingw/math/x86/cosl_internal.S +0 -55
- package/libc/mingw/math/x86/sin.def.h +0 -65
- package/libc/mingw/math/x86/sinl.c +0 -46
- package/libc/mingw/math/x86/sinl_internal.S +0 -58
- package/libc/mingw/math/x86/tanl.S +0 -62
- package/libc/musl/src/legacy/isastream.c +0 -7
- package/libc/musl/src/math/__cosl.c +0 -96
- package/libc/musl/src/math/__sinl.c +0 -78
- package/libc/musl/src/math/__tanl.c +0 -143
- package/libc/musl/src/math/aarch64/lrint.c +0 -10
- package/libc/musl/src/math/aarch64/lrintf.c +0 -10
- package/libc/musl/src/math/aarch64/rintf.c +0 -7
- package/libc/musl/src/math/cosl.c +0 -39
- package/libc/musl/src/math/fdim.c +0 -10
- package/libc/musl/src/math/finite.c +0 -7
- package/libc/musl/src/math/finitef.c +0 -7
- package/libc/musl/src/math/frexp.c +0 -23
- package/libc/musl/src/math/frexpf.c +0 -23
- package/libc/musl/src/math/frexpl.c +0 -29
- package/libc/musl/src/math/i386/lrint.c +0 -8
- package/libc/musl/src/math/i386/lrintf.c +0 -8
- package/libc/musl/src/math/i386/rintf.c +0 -7
- package/libc/musl/src/math/lrint.c +0 -72
- package/libc/musl/src/math/lrintf.c +0 -8
- package/libc/musl/src/math/powerpc64/lrint.c +0 -16
- package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
- package/libc/musl/src/math/rintf.c +0 -30
- package/libc/musl/src/math/s390x/rintf.c +0 -15
- package/libc/musl/src/math/sincosl.c +0 -60
- package/libc/musl/src/math/sinl.c +0 -41
- package/libc/musl/src/math/tanl.c +0 -29
- package/libc/musl/src/math/x32/lrint.s +0 -5
- package/libc/musl/src/math/x32/lrintf.s +0 -5
- package/libc/musl/src/math/x86_64/lrint.c +0 -8
- package/libc/musl/src/math/x86_64/lrintf.c +0 -8
package/std/mem.zig
CHANGED
|
@@ -4709,6 +4709,54 @@ test "sliceAsBytes preserves pointer attributes" {
|
|
|
4709
4709
|
try testing.expectEqual(in.alignment, out.alignment);
|
|
4710
4710
|
}
|
|
4711
4711
|
|
|
4712
|
+
fn AbsorbSentinelReturnType(comptime Slice: type) type {
|
|
4713
|
+
const info = @typeInfo(Slice).pointer;
|
|
4714
|
+
assert(info.size == .slice);
|
|
4715
|
+
return @Pointer(.slice, .{
|
|
4716
|
+
.@"const" = info.is_const,
|
|
4717
|
+
.@"volatile" = info.is_volatile,
|
|
4718
|
+
.@"allowzero" = info.is_allowzero,
|
|
4719
|
+
.@"addrspace" = info.address_space,
|
|
4720
|
+
.@"align" = info.alignment,
|
|
4721
|
+
}, info.child, null);
|
|
4722
|
+
}
|
|
4723
|
+
|
|
4724
|
+
/// If the provided slice is not sentinel terminated, do nothing and return that slice.
|
|
4725
|
+
/// If it is sentinel-terminated, return a non-sentinel-terminated slice with the
|
|
4726
|
+
/// length increased by one to include the absorbed sentinel element.
|
|
4727
|
+
pub fn absorbSentinel(slice: anytype) AbsorbSentinelReturnType(@TypeOf(slice)) {
|
|
4728
|
+
const info = @typeInfo(@TypeOf(slice)).pointer;
|
|
4729
|
+
comptime assert(info.size == .slice);
|
|
4730
|
+
if (info.sentinel_ptr == null) {
|
|
4731
|
+
return slice;
|
|
4732
|
+
} else {
|
|
4733
|
+
return slice.ptr[0 .. slice.len + 1];
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4737
|
+
test absorbSentinel {
|
|
4738
|
+
{
|
|
4739
|
+
var buffer: [3:0]u8 = .{ 1, 2, 3 };
|
|
4740
|
+
const foo: [:0]const u8 = &buffer;
|
|
4741
|
+
const bar: []const u8 = &buffer;
|
|
4742
|
+
try testing.expectEqual([]const u8, @TypeOf(absorbSentinel(foo)));
|
|
4743
|
+
try testing.expectEqual([]const u8, @TypeOf(absorbSentinel(bar)));
|
|
4744
|
+
try testing.expectEqualSlices(u8, &.{ 1, 2, 3, 0 }, absorbSentinel(foo));
|
|
4745
|
+
try testing.expectEqualSlices(u8, &.{ 1, 2, 3 }, absorbSentinel(bar));
|
|
4746
|
+
}
|
|
4747
|
+
{
|
|
4748
|
+
var buffer: [3:0]u8 = .{ 1, 2, 3 };
|
|
4749
|
+
const foo: [:0]u8 = &buffer;
|
|
4750
|
+
const bar: []u8 = &buffer;
|
|
4751
|
+
try testing.expectEqual([]u8, @TypeOf(absorbSentinel(foo)));
|
|
4752
|
+
try testing.expectEqual([]u8, @TypeOf(absorbSentinel(bar)));
|
|
4753
|
+
var expected_foo = [_]u8{ 1, 2, 3, 0 };
|
|
4754
|
+
try testing.expectEqualSlices(u8, &expected_foo, absorbSentinel(foo));
|
|
4755
|
+
var expected_bar = [_]u8{ 1, 2, 3 };
|
|
4756
|
+
try testing.expectEqualSlices(u8, &expected_bar, absorbSentinel(bar));
|
|
4757
|
+
}
|
|
4758
|
+
}
|
|
4759
|
+
|
|
4712
4760
|
/// Round an address down to the next (or current) aligned address.
|
|
4713
4761
|
/// Unlike `alignForward`, `alignment` can be any positive number, not just a power of 2.
|
|
4714
4762
|
pub fn alignForwardAnyAlign(comptime T: type, addr: T, alignment: T) T {
|
package/std/testing/Smith.zig
CHANGED
|
@@ -205,6 +205,24 @@ pub noinline fn valueRangeLessThan(s: *Smith, T: type, at_least: T, less_than: T
|
|
|
205
205
|
return s.valueRangeLessThanWithHash(T, at_least, less_than, firstHash());
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/// It is asserted `len` is nonzero.
|
|
209
|
+
/// It is asserted `len` fits within 64 bits.
|
|
210
|
+
//
|
|
211
|
+
// `noinline` to capture a unique return address
|
|
212
|
+
pub noinline fn index(s: *Smith, len: usize) usize {
|
|
213
|
+
@disableInstrumentation();
|
|
214
|
+
return s.indexWithHash(len, firstHash());
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/// It is asserted that the weight of `false` is non-zero.
|
|
218
|
+
/// It is asserted that the weight of `true` is non-zero.
|
|
219
|
+
//
|
|
220
|
+
// `noinline` to capture a unique return address
|
|
221
|
+
pub noinline fn boolWeighted(s: *Smith, false_weight: u64, true_weight: u64) bool {
|
|
222
|
+
@disableInstrumentation();
|
|
223
|
+
return s.boolWeightedWithHash(false_weight, true_weight, firstHash());
|
|
224
|
+
}
|
|
225
|
+
|
|
208
226
|
/// This is similar to `value(bool)` however it is gauraunteed to eventually
|
|
209
227
|
/// return `true` and provides the fuzzer with an extra hint about the data.
|
|
210
228
|
//
|
|
@@ -228,6 +246,7 @@ pub noinline fn eosWeighted(s: *Smith, weights: []const Weight) bool {
|
|
|
228
246
|
/// This is similar to `value(bool)` however it is gauraunteed to eventually
|
|
229
247
|
/// return `true` and provides the fuzzer with an extra hint about the data.
|
|
230
248
|
///
|
|
249
|
+
/// It is asserted that the weight of `false` is non-zero.
|
|
231
250
|
/// It is asserted that the weight of `true` is non-zero.
|
|
232
251
|
//
|
|
233
252
|
// `noinline` to capture a unique return address
|
|
@@ -463,6 +482,24 @@ pub fn valueRangeLessThanWithHash(s: *Smith, T: type, at_least: T, less_than: T,
|
|
|
463
482
|
return s.valueWeightedWithHash(T, &.{.rangeLessThan(T, at_least, less_than, 1)}, hash);
|
|
464
483
|
}
|
|
465
484
|
|
|
485
|
+
/// It is asserted `len` is nonzero.
|
|
486
|
+
/// It is asserted `len` fits within 64 bits.
|
|
487
|
+
pub fn indexWithHash(s: *Smith, len: usize, hash: u32) usize {
|
|
488
|
+
@disableInstrumentation();
|
|
489
|
+
assert(len != 0);
|
|
490
|
+
return @intCast(s.valueWeightedWithHash(u64, &.{.rangeLessThan(u64, 0, @intCast(len), 1)}, hash));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/// It is asserted that the weight of `false` is non-zero.
|
|
494
|
+
/// It is asserted that the weight of `true` is non-zero.
|
|
495
|
+
pub fn boolWeightedWithHash(s: *Smith, false_weight: u64, true_weight: u64, hash: u32) bool {
|
|
496
|
+
@disableInstrumentation();
|
|
497
|
+
return s.valueWeightedWithHash(bool, &.{
|
|
498
|
+
.value(bool, false, false_weight),
|
|
499
|
+
.value(bool, true, true_weight),
|
|
500
|
+
}, hash);
|
|
501
|
+
}
|
|
502
|
+
|
|
466
503
|
/// This is similar to `value(bool)` however it is gauraunteed to eventually
|
|
467
504
|
/// return `true` and provides the fuzzer with an extra hint about the data.
|
|
468
505
|
pub fn eosWithHash(s: *Smith, hash: u32) bool {
|
|
@@ -504,8 +541,6 @@ pub fn eosWeightedWithHash(s: *Smith, weights: []const Weight, hash: u32) bool {
|
|
|
504
541
|
///
|
|
505
542
|
/// It is asserted that the weight of `false` is non-zero.
|
|
506
543
|
/// It is asserted that the weight of `true` is non-zero.
|
|
507
|
-
//
|
|
508
|
-
// `noinline` to capture a unique return address
|
|
509
544
|
pub fn eosWeightedSimpleWithHash(s: *Smith, false_weight: u64, true_weight: u64, hash: u32) bool {
|
|
510
545
|
@disableInstrumentation();
|
|
511
546
|
return s.eosWeightedWithHash(&.{
|