@zigc/lib 0.16.0-test.1 → 0.17.0-dev.131
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/LICENSE +19 -0
- package/c/fcntl.zig +6 -1
- package/c/inttypes.zig +0 -10
- package/c/math.zig +138 -114
- package/c/pthread.zig +57 -0
- package/c/search.zig +1 -27
- package/c/stdlib/drand48.zig +0 -57
- package/c/stdlib.zig +0 -100
- package/c/string.zig +20 -7
- package/c/strings.zig +0 -38
- package/c/stropts.zig +17 -0
- package/c/unistd.zig +27 -26
- package/c/wchar.zig +10 -0
- package/c.zig +3 -2
- package/compiler/aro/aro/Attribute/names.zig +604 -589
- package/compiler/aro/aro/Attribute.zig +202 -116
- package/compiler/aro/aro/Builtins/common.zig +874 -863
- package/compiler/aro/aro/Builtins/eval.zig +15 -7
- package/compiler/aro/aro/Builtins.zig +0 -1
- package/compiler/aro/aro/CodeGen.zig +8 -7
- package/compiler/aro/aro/Compilation.zig +137 -111
- package/compiler/aro/aro/Diagnostics.zig +21 -17
- package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
- package/compiler/aro/aro/Driver.zig +138 -63
- package/compiler/aro/aro/LangOpts.zig +12 -2
- package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
- package/compiler/aro/aro/Parser.zig +352 -153
- package/compiler/aro/aro/Pragma.zig +3 -2
- package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
- package/compiler/aro/aro/Preprocessor.zig +136 -62
- package/compiler/aro/aro/Target.zig +17 -12
- package/compiler/aro/aro/Tokenizer.zig +31 -14
- package/compiler/aro/aro/Toolchain.zig +4 -7
- package/compiler/aro/aro/Tree.zig +178 -148
- package/compiler/aro/aro/TypeStore.zig +82 -24
- package/compiler/aro/aro/Value.zig +13 -17
- package/compiler/aro/aro/features.zig +1 -0
- package/compiler/aro/aro/pragmas/message.zig +3 -2
- package/compiler/aro/aro/pragmas/once.zig +0 -1
- package/compiler/aro/aro/record_layout.zig +3 -3
- package/compiler/aro/aro/text_literal.zig +3 -2
- package/compiler/aro/assembly_backend/x86_64.zig +7 -8
- package/compiler/aro/backend/Assembly.zig +1 -2
- package/compiler/aro/backend/Interner.zig +2 -2
- package/compiler/aro/backend/Ir.zig +100 -92
- package/compiler/aro/include/ptrcheck.h +49 -0
- package/compiler/aro/main.zig +26 -10
- package/compiler/build_runner.zig +1 -2
- package/compiler/objdump.zig +93 -0
- package/compiler/reduce/Walk.zig +7 -7
- package/compiler/reduce.zig +5 -1
- package/compiler/resinator/compile.zig +2 -2
- package/compiler/resinator/main.zig +7 -1
- package/compiler/resinator/preprocess.zig +1 -3
- package/compiler/std-docs.zig +8 -1
- package/compiler/test_runner.zig +194 -62
- package/compiler/translate-c/MacroTranslator.zig +80 -11
- package/compiler/translate-c/PatternList.zig +1 -9
- package/compiler/translate-c/Scope.zig +43 -6
- package/compiler/translate-c/Translator.zig +369 -127
- package/compiler/translate-c/ast.zig +19 -11
- package/compiler/translate-c/main.zig +76 -17
- package/compiler_rt/cos.zig +140 -53
- package/compiler_rt/divmodei4.zig +40 -17
- package/compiler_rt/exp.zig +1 -6
- package/compiler_rt/exp2.zig +1 -6
- package/compiler_rt/exp_f128.zig +377 -0
- package/compiler_rt/fabs.zig +0 -2
- package/compiler_rt/fma.zig +0 -2
- package/compiler_rt/fmax.zig +0 -2
- package/compiler_rt/fmin.zig +0 -2
- package/compiler_rt/fmod.zig +0 -2
- package/compiler_rt/limb64.zig +1127 -0
- package/compiler_rt/log.zig +0 -2
- package/compiler_rt/log10.zig +0 -2
- package/compiler_rt/log2.zig +0 -2
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/mulXi3.zig +1 -1
- package/compiler_rt/mulo.zig +6 -1
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/round.zig +0 -2
- package/compiler_rt/sin.zig +139 -56
- package/compiler_rt/sincos.zig +277 -72
- package/compiler_rt/sqrt.zig +0 -2
- package/compiler_rt/ssp.zig +1 -1
- package/compiler_rt/tan.zig +117 -48
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt/trunc.zig +0 -2
- package/compiler_rt/udivmodei4.zig +28 -0
- package/compiler_rt.zig +2 -0
- package/fuzzer.zig +857 -307
- package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
- package/libc/musl/src/math/pow.c +343 -0
- package/package.json +1 -1
- package/std/Build/Cache.zig +6 -6
- package/std/Build/Fuzz.zig +6 -19
- package/std/Build/Module.zig +1 -1
- package/std/Build/Step/CheckObject.zig +3 -3
- package/std/Build/Step/Compile.zig +18 -1
- package/std/Build/Step/ConfigHeader.zig +49 -33
- package/std/Build/Step/InstallArtifact.zig +18 -0
- package/std/Build/Step/Run.zig +538 -89
- package/std/Build/Step/TranslateC.zig +0 -6
- package/std/Build/Step.zig +10 -19
- package/std/Build/WebServer.zig +31 -19
- package/std/Build/abi.zig +47 -11
- package/std/Build.zig +17 -17
- package/std/Io/Dir.zig +7 -2
- package/std/Io/Dispatch.zig +5 -13
- package/std/Io/File/Reader.zig +3 -1
- package/std/Io/File/Writer.zig +8 -6
- package/std/Io/File.zig +1 -0
- package/std/Io/Kqueue.zig +2 -2
- package/std/Io/Reader.zig +8 -9
- package/std/Io/Semaphore.zig +112 -17
- package/std/Io/Terminal.zig +1 -1
- package/std/Io/Threaded.zig +352 -180
- package/std/Io/Uring.zig +15 -16
- package/std/Io/Writer.zig +46 -42
- package/std/Io/net.zig +11 -11
- package/std/Io.zig +1052 -20
- package/std/SemanticVersion.zig +1 -1
- package/std/Target/Query.zig +2 -2
- package/std/Target.zig +53 -7
- package/std/Thread.zig +8 -3
- package/std/array_hash_map.zig +105 -573
- package/std/array_list.zig +22 -31
- package/std/bit_set.zig +22 -6
- package/std/builtin/assembly.zig +68 -0
- package/std/builtin.zig +4 -0
- package/std/c/haiku.zig +3 -0
- package/std/c/serenity.zig +1 -6
- package/std/c.zig +106 -24
- package/std/compress/flate/Compress.zig +3 -3
- package/std/compress/flate/Decompress.zig +2 -3
- package/std/compress/zstd/Decompress.zig +2 -4
- package/std/crypto/Certificate/Bundle.zig +15 -1
- package/std/crypto/Certificate.zig +13 -1
- package/std/crypto/ascon.zig +75 -33
- package/std/crypto/codecs/asn1/Oid.zig +12 -1
- package/std/crypto/codecs/asn1.zig +33 -18
- package/std/crypto/codecs/base64_hex_ct.zig +16 -8
- package/std/crypto/ml_kem.zig +2 -9
- package/std/crypto/tls/Client.zig +79 -4
- package/std/crypto/tls.zig +1 -1
- package/std/crypto.zig +1 -0
- package/std/debug/Dwarf.zig +29 -9
- package/std/debug/Info.zig +4 -0
- package/std/debug/MachOFile.zig +46 -8
- package/std/debug/Pdb.zig +540 -37
- package/std/debug/SelfInfo/Elf.zig +19 -18
- package/std/debug/SelfInfo/MachO.zig +18 -7
- package/std/debug/SelfInfo/Windows.zig +138 -36
- package/std/debug.zig +181 -66
- package/std/enums.zig +25 -19
- package/std/fmt.zig +8 -3
- package/std/fs/path.zig +6 -4
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/heap/BufferFirstAllocator.zig +165 -0
- package/std/heap/debug_allocator.zig +7 -7
- package/std/heap.zig +2 -126
- package/std/http/Client.zig +31 -30
- package/std/http.zig +14 -13
- package/std/json/Scanner.zig +2 -2
- package/std/json/Stringify.zig +3 -3
- package/std/json/dynamic.zig +4 -4
- package/std/math/big/int.zig +16 -17
- package/std/mem/Allocator.zig +4 -5
- package/std/mem.zig +48 -0
- package/std/os/emscripten.zig +2 -18
- package/std/os/linux/IoUring.zig +2 -0
- package/std/os/linux/aarch64.zig +41 -12
- package/std/os/linux/arc.zig +173 -0
- package/std/os/linux/arm.zig +41 -12
- package/std/os/linux/hexagon.zig +33 -11
- package/std/os/linux/loongarch32.zig +41 -13
- package/std/os/linux/loongarch64.zig +41 -12
- package/std/os/linux/m68k.zig +41 -13
- package/std/os/linux/mips.zig +67 -36
- package/std/os/linux/mips64.zig +60 -29
- package/std/os/linux/mipsn32.zig +60 -29
- package/std/os/linux/or1k.zig +41 -12
- package/std/os/linux/powerpc.zig +41 -12
- package/std/os/linux/powerpc64.zig +41 -12
- package/std/os/linux/riscv32.zig +41 -12
- package/std/os/linux/riscv64.zig +41 -12
- package/std/os/linux/s390x.zig +44 -7
- package/std/os/linux/sparc64.zig +83 -52
- package/std/os/linux/thumb.zig +52 -36
- package/std/os/linux/x32.zig +41 -12
- package/std/os/linux/x86.zig +42 -13
- package/std/os/linux/x86_64.zig +41 -12
- package/std/os/linux.zig +419 -438
- package/std/os/uefi/tables/boot_services.zig +9 -8
- package/std/os/windows.zig +2 -2
- package/std/os.zig +41 -0
- package/std/pdb.zig +143 -4
- package/std/posix.zig +6 -12
- package/std/priority_dequeue.zig +13 -12
- package/std/priority_queue.zig +5 -4
- package/std/process/Child.zig +1 -1
- package/std/process/Environ.zig +1 -1
- package/std/process.zig +1 -1
- package/std/sort.zig +3 -3
- package/std/start.zig +17 -4
- package/std/std.zig +19 -6
- package/std/testing/FailingAllocator.zig +4 -4
- package/std/testing/Smith.zig +37 -2
- package/std/zig/Ast/Render.zig +187 -459
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstGen.zig +86 -103
- package/std/zig/AstRlAnnotate.zig +0 -11
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/BuiltinFn.zig +0 -32
- package/std/zig/Client.zig +8 -3
- package/std/zig/LibCInstallation.zig +4 -3
- package/std/zig/Parse.zig +90 -81
- package/std/zig/Server.zig +26 -0
- package/std/zig/WindowsSdk.zig +13 -13
- package/std/zig/Zir.zig +66 -62
- package/std/zig/ZonGen.zig +6 -5
- package/std/zig/c_translation/helpers.zig +14 -9
- package/std/zig/llvm/Builder.zig +119 -60
- package/std/zig/system.zig +20 -4
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +7 -10
- package/std/zip.zig +5 -5
- package/zig.h +340 -1
- package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
- package/libc/mingw/complex/cabs.c +0 -48
- package/libc/mingw/complex/cabsf.c +0 -48
- package/libc/mingw/complex/cacos.c +0 -50
- package/libc/mingw/complex/cacosf.c +0 -50
- package/libc/mingw/complex/carg.c +0 -48
- package/libc/mingw/complex/cargf.c +0 -48
- package/libc/mingw/complex/casin.c +0 -50
- package/libc/mingw/complex/casinf.c +0 -50
- package/libc/mingw/complex/catan.c +0 -50
- package/libc/mingw/complex/catanf.c +0 -50
- package/libc/mingw/complex/ccos.c +0 -50
- package/libc/mingw/complex/ccosf.c +0 -50
- package/libc/mingw/complex/cexp.c +0 -48
- package/libc/mingw/complex/cexpf.c +0 -48
- package/libc/mingw/complex/cimag.c +0 -48
- package/libc/mingw/complex/cimagf.c +0 -48
- package/libc/mingw/complex/clog.c +0 -48
- package/libc/mingw/complex/clog10.c +0 -49
- package/libc/mingw/complex/clog10f.c +0 -49
- package/libc/mingw/complex/clogf.c +0 -48
- package/libc/mingw/complex/conj.c +0 -48
- package/libc/mingw/complex/conjf.c +0 -48
- package/libc/mingw/complex/cpow.c +0 -48
- package/libc/mingw/complex/cpowf.c +0 -48
- package/libc/mingw/complex/cproj.c +0 -48
- package/libc/mingw/complex/cprojf.c +0 -48
- package/libc/mingw/complex/creal.c +0 -48
- package/libc/mingw/complex/crealf.c +0 -48
- package/libc/mingw/complex/csin.c +0 -50
- package/libc/mingw/complex/csinf.c +0 -50
- package/libc/mingw/complex/csqrt.c +0 -48
- package/libc/mingw/complex/csqrtf.c +0 -48
- package/libc/mingw/complex/ctan.c +0 -50
- package/libc/mingw/complex/ctanf.c +0 -50
- package/libc/mingw/math/arm/s_rint.c +0 -86
- package/libc/mingw/math/arm/s_rintf.c +0 -51
- 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/bsd_private_base.h +0 -148
- package/libc/mingw/math/fdiml.c +0 -24
- package/libc/mingw/math/frexpf.c +0 -13
- package/libc/mingw/math/frexpl.c +0 -71
- package/libc/mingw/math/x86/acosf.c +0 -29
- package/libc/mingw/math/x86/atanf.c +0 -23
- package/libc/mingw/math/x86/atanl.c +0 -18
- 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/ldexp.c +0 -23
- package/libc/mingw/math/x86/scalbn.S +0 -41
- package/libc/mingw/math/x86/scalbnf.S +0 -40
- 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/mingw/misc/btowc.c +0 -28
- package/libc/mingw/misc/wcstof.c +0 -66
- package/libc/mingw/misc/wcstoimax.c +0 -132
- package/libc/mingw/misc/wcstoumax.c +0 -126
- package/libc/mingw/misc/wctob.c +0 -29
- package/libc/mingw/misc/winbs_uint64.c +0 -6
- package/libc/mingw/misc/winbs_ulong.c +0 -6
- package/libc/mingw/misc/winbs_ushort.c +0 -6
- package/libc/mingw/stdio/_Exit.c +0 -10
- package/libc/mingw/stdio/_findfirst64i32.c +0 -21
- package/libc/mingw/stdio/_findnext64i32.c +0 -21
- package/libc/mingw/stdio/_fstat64i32.c +0 -37
- package/libc/mingw/stdio/_stat64i32.c +0 -37
- package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
- package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
- package/libc/mingw/stdio/_wstat64i32.c +0 -37
- package/libc/mingw/winpthreads/spinlock.c +0 -82
- package/libc/musl/src/legacy/isastream.c +0 -7
- package/libc/musl/src/legacy/valloc.c +0 -8
- package/libc/musl/src/linux/tee.c +0 -8
- 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/fdimf.c +0 -10
- package/libc/musl/src/math/fdiml.c +0 -18
- 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/libc/musl/src/string/strdup.c +0 -10
- package/libc/musl/src/string/strndup.c +0 -12
- package/libc/musl/src/string/wcsdup.c +0 -10
- package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
- package/libc/musl/src/thread/pthread_spin_init.c +0 -6
- package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
- package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
- package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
- package/libc/musl/src/unistd/dup2.c +0 -20
- package/libc/musl/src/unistd/dup3.c +0 -26
- package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
- package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
package/std/array_list.zig
CHANGED
|
@@ -857,16 +857,8 @@ pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type {
|
|
|
857
857
|
len: usize,
|
|
858
858
|
new_items: []const T,
|
|
859
859
|
) Allocator.Error!void {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
if (range.len < new_items.len) {
|
|
863
|
-
const first = new_items[0..range.len];
|
|
864
|
-
const rest = new_items[range.len..];
|
|
865
|
-
@memcpy(range[0..first.len], first);
|
|
866
|
-
try self.insertSlice(gpa, after_range, rest);
|
|
867
|
-
} else {
|
|
868
|
-
self.replaceRangeAssumeCapacity(start, len, new_items);
|
|
869
|
-
}
|
|
860
|
+
try self.ensureTotalCapacity(gpa, try addOrOom(self.items.len - len, new_items.len));
|
|
861
|
+
self.replaceRangeAssumeCapacity(start, len, new_items);
|
|
870
862
|
}
|
|
871
863
|
|
|
872
864
|
/// Grows or shrinks the list as necessary.
|
|
@@ -874,26 +866,20 @@ pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type {
|
|
|
874
866
|
/// Never invalidates element pointers.
|
|
875
867
|
///
|
|
876
868
|
/// Asserts the capacity is enough for additional items.
|
|
877
|
-
pub fn replaceRangeAssumeCapacity(
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
@memcpy(range[0..new_items.len], new_items);
|
|
892
|
-
const src = self.items[after_range..];
|
|
893
|
-
@memmove(self.items[after_range - extra ..][0..src.len], src);
|
|
894
|
-
@memset(self.items[self.items.len - extra ..], undefined);
|
|
895
|
-
self.items.len -= extra;
|
|
896
|
-
}
|
|
869
|
+
pub fn replaceRangeAssumeCapacity(
|
|
870
|
+
self: *Self,
|
|
871
|
+
start: usize,
|
|
872
|
+
len: usize,
|
|
873
|
+
new_items: []const T,
|
|
874
|
+
) void {
|
|
875
|
+
std.debug.assert(self.capacity - self.items.len >= new_items.len -| len);
|
|
876
|
+
|
|
877
|
+
const tail = self.items[start + len ..];
|
|
878
|
+
const vacated = self.items[self.items.len - (len -| new_items.len) ..];
|
|
879
|
+
self.items.len = self.items.len - len + new_items.len;
|
|
880
|
+
@memmove(self.items[start + new_items.len ..], tail);
|
|
881
|
+
@memcpy(self.items[start..][0..new_items.len], new_items);
|
|
882
|
+
@memset(vacated, undefined);
|
|
897
883
|
}
|
|
898
884
|
|
|
899
885
|
/// Grows or shrinks the list as necessary.
|
|
@@ -902,7 +888,12 @@ pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type {
|
|
|
902
888
|
///
|
|
903
889
|
/// If the unused capacity is insufficient for additional items,
|
|
904
890
|
/// returns `error.OutOfMemory`.
|
|
905
|
-
pub fn replaceRangeBounded(
|
|
891
|
+
pub fn replaceRangeBounded(
|
|
892
|
+
self: *Self,
|
|
893
|
+
start: usize,
|
|
894
|
+
len: usize,
|
|
895
|
+
new_items: []const T,
|
|
896
|
+
) error{OutOfMemory}!void {
|
|
906
897
|
if (self.capacity - self.items.len < new_items.len -| len) return error.OutOfMemory;
|
|
907
898
|
return replaceRangeAssumeCapacity(self, start, len, new_items);
|
|
908
899
|
}
|
package/std/bit_set.zig
CHANGED
|
@@ -68,16 +68,24 @@ pub fn IntegerBitSet(comptime size: u16) type {
|
|
|
68
68
|
/// The bit mask, as a single integer
|
|
69
69
|
mask: MaskInt,
|
|
70
70
|
|
|
71
|
+
/// Deprecated: use `.empty`.
|
|
71
72
|
/// Creates a bit set with no elements present.
|
|
72
73
|
pub fn initEmpty() Self {
|
|
73
74
|
return .{ .mask = 0 };
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
/// Deprecated: use `.full`.
|
|
76
78
|
/// Creates a bit set with all elements present.
|
|
77
79
|
pub fn initFull() Self {
|
|
78
80
|
return .{ .mask = ~@as(MaskInt, 0) };
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
/// A bit set with no elements present.
|
|
84
|
+
pub const empty: Self = .{ .mask = 0 };
|
|
85
|
+
|
|
86
|
+
/// A bit set with all elements present.
|
|
87
|
+
pub const full: Self = .{ .mask = ~@as(MaskInt, 0) };
|
|
88
|
+
|
|
81
89
|
/// Returns the number of bits in this bit set
|
|
82
90
|
pub inline fn capacity(self: Self) usize {
|
|
83
91
|
_ = self;
|
|
@@ -387,11 +395,13 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
|
|
|
387
395
|
/// Padding bits at the end are undefined.
|
|
388
396
|
masks: [num_masks]MaskInt,
|
|
389
397
|
|
|
398
|
+
/// Deprecated: use `.empty`.
|
|
390
399
|
/// Creates a bit set with no elements present.
|
|
391
400
|
pub fn initEmpty() Self {
|
|
392
401
|
return .{ .masks = [_]MaskInt{0} ** num_masks };
|
|
393
402
|
}
|
|
394
403
|
|
|
404
|
+
/// Deprecated: use `.full`.
|
|
395
405
|
/// Creates a bit set with all elements present.
|
|
396
406
|
pub fn initFull() Self {
|
|
397
407
|
if (num_masks == 0) {
|
|
@@ -401,6 +411,12 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
|
|
|
401
411
|
}
|
|
402
412
|
}
|
|
403
413
|
|
|
414
|
+
/// A bit set with no elements present.
|
|
415
|
+
pub const empty: Self = .{ .masks = @splat(0) };
|
|
416
|
+
|
|
417
|
+
/// A bit set with all elements present.
|
|
418
|
+
pub const full: Self = .{ .masks = if (num_masks == 0) .{} else ([_]MaskInt{~@as(MaskInt, 0)} ** (num_masks - 1) ++ [_]MaskInt{last_item_mask}) };
|
|
419
|
+
|
|
404
420
|
/// Returns the number of bits in this bit set
|
|
405
421
|
pub inline fn capacity(self: Self) usize {
|
|
406
422
|
_ = self;
|
|
@@ -1633,17 +1649,17 @@ fn fillOdd(set: anytype, len: usize) void {
|
|
|
1633
1649
|
}
|
|
1634
1650
|
|
|
1635
1651
|
fn testPureBitSet(comptime Set: type) !void {
|
|
1636
|
-
const empty = Set.
|
|
1637
|
-
const full = Set.
|
|
1652
|
+
const empty = Set.empty;
|
|
1653
|
+
const full = Set.full;
|
|
1638
1654
|
|
|
1639
1655
|
const even = even: {
|
|
1640
|
-
var bit_set = Set.
|
|
1656
|
+
var bit_set = Set.empty;
|
|
1641
1657
|
fillEven(&bit_set, Set.bit_length);
|
|
1642
1658
|
break :even bit_set;
|
|
1643
1659
|
};
|
|
1644
1660
|
|
|
1645
1661
|
const odd = odd: {
|
|
1646
|
-
var bit_set = Set.
|
|
1662
|
+
var bit_set = Set.empty;
|
|
1647
1663
|
fillOdd(&bit_set, Set.bit_length);
|
|
1648
1664
|
break :odd bit_set;
|
|
1649
1665
|
};
|
|
@@ -1686,8 +1702,8 @@ fn testPureBitSet(comptime Set: type) !void {
|
|
|
1686
1702
|
}
|
|
1687
1703
|
|
|
1688
1704
|
fn testStaticBitSet(comptime Set: type) !void {
|
|
1689
|
-
var a = Set.
|
|
1690
|
-
var b = Set.
|
|
1705
|
+
var a = Set.empty;
|
|
1706
|
+
var b = Set.full;
|
|
1691
1707
|
try testing.expectEqual(@as(usize, 0), a.count());
|
|
1692
1708
|
try testing.expectEqual(@as(usize, Set.bit_length), b.count());
|
|
1693
1709
|
|
package/std/builtin/assembly.zig
CHANGED
|
@@ -682,6 +682,40 @@ pub const Clobbers = switch (@import("builtin").cpu.arch) {
|
|
|
682
682
|
x30: bool = false,
|
|
683
683
|
x31: bool = false,
|
|
684
684
|
|
|
685
|
+
// ABI aliases for integer registers
|
|
686
|
+
ra: bool = false,
|
|
687
|
+
sp: bool = false,
|
|
688
|
+
gp: bool = false,
|
|
689
|
+
tp: bool = false,
|
|
690
|
+
t0: bool = false,
|
|
691
|
+
t1: bool = false,
|
|
692
|
+
t2: bool = false,
|
|
693
|
+
s0: bool = false,
|
|
694
|
+
fp: bool = false,
|
|
695
|
+
s1: bool = false,
|
|
696
|
+
a0: bool = false,
|
|
697
|
+
a1: bool = false,
|
|
698
|
+
a2: bool = false,
|
|
699
|
+
a3: bool = false,
|
|
700
|
+
a4: bool = false,
|
|
701
|
+
a5: bool = false,
|
|
702
|
+
a6: bool = false,
|
|
703
|
+
a7: bool = false,
|
|
704
|
+
s2: bool = false,
|
|
705
|
+
s3: bool = false,
|
|
706
|
+
s4: bool = false,
|
|
707
|
+
s5: bool = false,
|
|
708
|
+
s6: bool = false,
|
|
709
|
+
s7: bool = false,
|
|
710
|
+
s8: bool = false,
|
|
711
|
+
s9: bool = false,
|
|
712
|
+
s10: bool = false,
|
|
713
|
+
s11: bool = false,
|
|
714
|
+
t3: bool = false,
|
|
715
|
+
t4: bool = false,
|
|
716
|
+
t5: bool = false,
|
|
717
|
+
t6: bool = false,
|
|
718
|
+
|
|
685
719
|
fflags: bool = false,
|
|
686
720
|
frm: bool = false,
|
|
687
721
|
|
|
@@ -718,6 +752,40 @@ pub const Clobbers = switch (@import("builtin").cpu.arch) {
|
|
|
718
752
|
f30: bool = false,
|
|
719
753
|
f31: bool = false,
|
|
720
754
|
|
|
755
|
+
// ABI aliases for float registers
|
|
756
|
+
ft0: bool = false,
|
|
757
|
+
ft1: bool = false,
|
|
758
|
+
ft2: bool = false,
|
|
759
|
+
ft3: bool = false,
|
|
760
|
+
ft4: bool = false,
|
|
761
|
+
ft5: bool = false,
|
|
762
|
+
ft6: bool = false,
|
|
763
|
+
ft7: bool = false,
|
|
764
|
+
fs0: bool = false,
|
|
765
|
+
fs1: bool = false,
|
|
766
|
+
fa0: bool = false,
|
|
767
|
+
fa1: bool = false,
|
|
768
|
+
fa2: bool = false,
|
|
769
|
+
fa3: bool = false,
|
|
770
|
+
fa4: bool = false,
|
|
771
|
+
fa5: bool = false,
|
|
772
|
+
fa6: bool = false,
|
|
773
|
+
fa7: bool = false,
|
|
774
|
+
fs2: bool = false,
|
|
775
|
+
fs3: bool = false,
|
|
776
|
+
fs4: bool = false,
|
|
777
|
+
fs5: bool = false,
|
|
778
|
+
fs6: bool = false,
|
|
779
|
+
fs7: bool = false,
|
|
780
|
+
fs8: bool = false,
|
|
781
|
+
fs9: bool = false,
|
|
782
|
+
fs10: bool = false,
|
|
783
|
+
fs11: bool = false,
|
|
784
|
+
ft8: bool = false,
|
|
785
|
+
ft9: bool = false,
|
|
786
|
+
ft10: bool = false,
|
|
787
|
+
ft11: bool = false,
|
|
788
|
+
|
|
721
789
|
vtype: bool = false,
|
|
722
790
|
vl: bool = false,
|
|
723
791
|
vxsat: bool = false,
|
package/std/builtin.zig
CHANGED
|
@@ -341,6 +341,10 @@ pub const CallingConvention = union(enum(u8)) {
|
|
|
341
341
|
spirv_fragment,
|
|
342
342
|
spirv_vertex,
|
|
343
343
|
|
|
344
|
+
// Calling conventions for the `ez80` architecture.
|
|
345
|
+
ez80_cet,
|
|
346
|
+
ez80_tiflags,
|
|
347
|
+
|
|
344
348
|
/// Options shared across most calling conventions.
|
|
345
349
|
pub const CommonOptions = struct {
|
|
346
350
|
/// The boundary the stack is aligned to when the function is called.
|
package/std/c/haiku.zig
CHANGED
|
@@ -6,6 +6,7 @@ const iovec = std.posix.iovec;
|
|
|
6
6
|
const iovec_const = std.posix.iovec_const;
|
|
7
7
|
const socklen_t = std.c.socklen_t;
|
|
8
8
|
const fd_t = std.c.fd_t;
|
|
9
|
+
const off_t = std.c.off_t;
|
|
9
10
|
const PATH_MAX = std.c.PATH_MAX;
|
|
10
11
|
const uid_t = std.c.uid_t;
|
|
11
12
|
const gid_t = std.c.gid_t;
|
|
@@ -28,6 +29,8 @@ pub extern "root" fn _kern_open_dir(fd: fd_t, path: [*:0]const u8) fd_t;
|
|
|
28
29
|
pub extern "root" fn _kern_read_dir(fd: fd_t, buffer: [*]u8, bufferSize: usize, maxCount: u32) isize;
|
|
29
30
|
pub extern "root" fn _kern_rewind_dir(fd: fd_t) status_t;
|
|
30
31
|
pub extern "root" fn _kern_read_stat(fd: fd_t, path: [*:0]const u8, traverseLink: bool, stat: *std.c.Stat, statSize: usize) status_t;
|
|
32
|
+
pub extern "root" fn readv_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec, count: i32) isize;
|
|
33
|
+
pub extern "root" fn writev_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec_const, count: i32) isize;
|
|
31
34
|
|
|
32
35
|
pub const area_info = extern struct {
|
|
33
36
|
area: u32,
|
package/std/c/serenity.zig
CHANGED
|
@@ -53,9 +53,7 @@ pub extern "c" fn profiling_enable(pid: pid_t, event_mask: PERF_EVENT) c_int;
|
|
|
53
53
|
pub extern "c" fn profiling_disable(pid: pid_t) c_int;
|
|
54
54
|
pub extern "c" fn profiling_free_buffer(pid: pid_t) c_int;
|
|
55
55
|
|
|
56
|
-
pub extern "c" fn futex(userspace_address: *u32, futex_op: c_int, value: u32, timeout:
|
|
57
|
-
pub extern "c" fn futex_wait(userspace_address: *u32, value: u32, abstime: *const timespec, clockid: clockid_t, process_shared: c_int) c_int;
|
|
58
|
-
pub extern "c" fn futex_wake(userspace_address: *u32, count: u32, process_shared: c_int) c_int;
|
|
56
|
+
pub extern "c" fn futex(userspace_address: *u32, futex_op: c_int, value: u32, timeout: ?*const timespec, userspace_address2: ?*u32, value3: u32) c_int;
|
|
59
57
|
|
|
60
58
|
pub extern "c" fn purge(mode: c_int) c_int;
|
|
61
59
|
|
|
@@ -66,9 +64,6 @@ pub extern "c" fn get_stack_bounds(user_stack_base: *usize, user_stack_size: *us
|
|
|
66
64
|
|
|
67
65
|
pub extern "c" fn anon_create(size: usize, options: O) c_int;
|
|
68
66
|
|
|
69
|
-
pub extern "c" fn serenity_readlink(path: [*]const u8, path_length: usize, buffer: [*]u8, buffer_size: usize) c_int;
|
|
70
|
-
pub extern "c" fn serenity_open(path: [*]const u8, path_length: usize, options: c_int, ...) c_int;
|
|
71
|
-
|
|
72
67
|
pub extern "c" fn getkeymap(name_buffer: [*]u8, name_buffer_size: usize, map: [*]u32, shift_map: [*]u32, alt_map: [*]u32, altgr_map: [*]u32, shift_altgr_map: [*]u32) c_int;
|
|
73
68
|
pub extern "c" fn setkeymap(name: [*]const u8, map: [*]const u32, shift_map: [*]const u32, alt_map: [*]const u32, altgr_map: [*]const u32, shift_altgr_map: [*]const u32) c_int;
|
|
74
69
|
|
package/std/c.zig
CHANGED
|
@@ -3260,8 +3260,8 @@ pub const Sigaction = switch (native_os) {
|
|
|
3260
3260
|
|
|
3261
3261
|
/// signal handler
|
|
3262
3262
|
handler: extern union {
|
|
3263
|
-
handler: handler_fn,
|
|
3264
|
-
sigaction: sigaction_fn,
|
|
3263
|
+
handler: ?handler_fn,
|
|
3264
|
+
sigaction: ?sigaction_fn,
|
|
3265
3265
|
},
|
|
3266
3266
|
|
|
3267
3267
|
/// signal mask to apply
|
|
@@ -3721,14 +3721,14 @@ pub const W = switch (native_os) {
|
|
|
3721
3721
|
pub fn TERMSIG(x: u32) SIG {
|
|
3722
3722
|
return @enumFromInt(status(x));
|
|
3723
3723
|
}
|
|
3724
|
-
pub fn STOPSIG(x: u32)
|
|
3725
|
-
return x >> 8;
|
|
3724
|
+
pub fn STOPSIG(x: u32) SIG {
|
|
3725
|
+
return @enumFromInt(x >> 8);
|
|
3726
3726
|
}
|
|
3727
3727
|
pub fn IFEXITED(x: u32) bool {
|
|
3728
3728
|
return status(x) == 0;
|
|
3729
3729
|
}
|
|
3730
3730
|
pub fn IFSTOPPED(x: u32) bool {
|
|
3731
|
-
return status(x) == stopped and STOPSIG(x) != 0x13;
|
|
3731
|
+
return status(x) == stopped and @as(u32, @intFromEnum(STOPSIG(x))) != 0x13;
|
|
3732
3732
|
}
|
|
3733
3733
|
pub fn IFSIGNALED(x: u32) bool {
|
|
3734
3734
|
return status(x) != stopped and status(x) != 0;
|
|
@@ -3754,8 +3754,8 @@ pub const W = switch (native_os) {
|
|
|
3754
3754
|
pub fn TERMSIG(s: u32) SIG {
|
|
3755
3755
|
return @enumFromInt(s & 0x7f);
|
|
3756
3756
|
}
|
|
3757
|
-
pub fn STOPSIG(s: u32)
|
|
3758
|
-
return EXITSTATUS(s);
|
|
3757
|
+
pub fn STOPSIG(s: u32) SIG {
|
|
3758
|
+
return @enumFromInt(EXITSTATUS(s));
|
|
3759
3759
|
}
|
|
3760
3760
|
pub fn IFEXITED(s: u32) bool {
|
|
3761
3761
|
return (s & 0x7f) == 0;
|
|
@@ -3782,8 +3782,8 @@ pub const W = switch (native_os) {
|
|
|
3782
3782
|
pub fn TERMSIG(s: u32) SIG {
|
|
3783
3783
|
return @enumFromInt(s & 0x7f);
|
|
3784
3784
|
}
|
|
3785
|
-
pub fn STOPSIG(s: u32)
|
|
3786
|
-
return EXITSTATUS(s);
|
|
3785
|
+
pub fn STOPSIG(s: u32) SIG {
|
|
3786
|
+
return @enumFromInt(EXITSTATUS(s));
|
|
3787
3787
|
}
|
|
3788
3788
|
pub fn IFEXITED(s: u32) bool {
|
|
3789
3789
|
return (s & 0x7f) == 0;
|
|
@@ -3816,8 +3816,8 @@ pub const W = switch (native_os) {
|
|
|
3816
3816
|
pub fn TERMSIG(s: u32) SIG {
|
|
3817
3817
|
return @enumFromInt(s & 0x7f);
|
|
3818
3818
|
}
|
|
3819
|
-
pub fn STOPSIG(s: u32)
|
|
3820
|
-
return EXITSTATUS(s);
|
|
3819
|
+
pub fn STOPSIG(s: u32) SIG {
|
|
3820
|
+
return @enumFromInt(EXITSTATUS(s));
|
|
3821
3821
|
}
|
|
3822
3822
|
pub fn IFEXITED(s: u32) bool {
|
|
3823
3823
|
return (s & 0x7f) == 0;
|
|
@@ -3850,8 +3850,8 @@ pub const W = switch (native_os) {
|
|
|
3850
3850
|
pub fn TERMSIG(s: u32) SIG {
|
|
3851
3851
|
return @enumFromInt(s & 0x7f);
|
|
3852
3852
|
}
|
|
3853
|
-
pub fn STOPSIG(s: u32)
|
|
3854
|
-
return EXITSTATUS(s);
|
|
3853
|
+
pub fn STOPSIG(s: u32) SIG {
|
|
3854
|
+
return @enumFromInt(EXITSTATUS(s));
|
|
3855
3855
|
}
|
|
3856
3856
|
pub fn IFEXITED(s: u32) bool {
|
|
3857
3857
|
return (s & 0x7f) == 0;
|
|
@@ -3879,8 +3879,8 @@ pub const W = switch (native_os) {
|
|
|
3879
3879
|
return @enumFromInt((s >> 8) & 0xff);
|
|
3880
3880
|
}
|
|
3881
3881
|
|
|
3882
|
-
pub fn STOPSIG(s: u32)
|
|
3883
|
-
return (s >> 16) & 0xff;
|
|
3882
|
+
pub fn STOPSIG(s: u32) SIG {
|
|
3883
|
+
return @enumFromInt((s >> 16) & 0xff);
|
|
3884
3884
|
}
|
|
3885
3885
|
|
|
3886
3886
|
pub fn IFEXITED(s: u32) bool {
|
|
@@ -3906,8 +3906,8 @@ pub const W = switch (native_os) {
|
|
|
3906
3906
|
pub fn TERMSIG(s: u32) SIG {
|
|
3907
3907
|
return @enumFromInt(s & 0x7f);
|
|
3908
3908
|
}
|
|
3909
|
-
pub fn STOPSIG(s: u32)
|
|
3910
|
-
return EXITSTATUS(s);
|
|
3909
|
+
pub fn STOPSIG(s: u32) SIG {
|
|
3910
|
+
return @enumFromInt(EXITSTATUS(s));
|
|
3911
3911
|
}
|
|
3912
3912
|
pub fn IFEXITED(s: u32) bool {
|
|
3913
3913
|
return (s & 0x7f) == 0;
|
|
@@ -3938,8 +3938,8 @@ pub const W = switch (native_os) {
|
|
|
3938
3938
|
return @intCast((s & 0xff00) >> 8);
|
|
3939
3939
|
}
|
|
3940
3940
|
|
|
3941
|
-
pub fn STOPSIG(s: u32)
|
|
3942
|
-
return EXITSTATUS(s);
|
|
3941
|
+
pub fn STOPSIG(s: u32) SIG {
|
|
3942
|
+
return @enumFromInt(EXITSTATUS(s));
|
|
3943
3943
|
}
|
|
3944
3944
|
|
|
3945
3945
|
pub fn TERMSIG(s: u32) SIG {
|
|
@@ -7898,6 +7898,20 @@ pub const Stat = switch (native_os) {
|
|
|
7898
7898
|
else => void,
|
|
7899
7899
|
};
|
|
7900
7900
|
|
|
7901
|
+
pub const pthread_spinlock_t = switch (native_os) {
|
|
7902
|
+
.openbsd => openbsd.pthread_spinlock_t,
|
|
7903
|
+
.freebsd => extern struct {
|
|
7904
|
+
inner: ?*anyopaque = null,
|
|
7905
|
+
},
|
|
7906
|
+
.netbsd => extern struct {
|
|
7907
|
+
pts_magic: c_uint,
|
|
7908
|
+
spin: pthread_spin_t,
|
|
7909
|
+
pts_flags: c_int,
|
|
7910
|
+
},
|
|
7911
|
+
.windows => isize,
|
|
7912
|
+
else => c_int,
|
|
7913
|
+
};
|
|
7914
|
+
|
|
7901
7915
|
pub const pthread_mutex_t = switch (native_os) {
|
|
7902
7916
|
.linux => extern struct {
|
|
7903
7917
|
data: [data_len]u8 align(@alignOf(usize)) = [_]u8{0} ** data_len,
|
|
@@ -10956,6 +10970,19 @@ pub extern "c" fn dn_expand(
|
|
|
10956
10970
|
length: c_int,
|
|
10957
10971
|
) c_int;
|
|
10958
10972
|
|
|
10973
|
+
pub const PTHREAD_PROCESS_PRIVATE: c_int = if (native_os.isDarwin())
|
|
10974
|
+
2
|
|
10975
|
+
else
|
|
10976
|
+
0;
|
|
10977
|
+
|
|
10978
|
+
pub const PTHREAD_PROCESS_SHARED: c_int = 1;
|
|
10979
|
+
|
|
10980
|
+
pub extern "c" fn pthread_spin_init(spin: *pthread_spinlock_t, pshared: c_int) c_int;
|
|
10981
|
+
pub extern "c" fn pthread_spin_lock(spin: *pthread_spinlock_t) c_int;
|
|
10982
|
+
pub extern "c" fn pthread_spin_unlock(spin: *pthread_spinlock_t) c_int;
|
|
10983
|
+
pub extern "c" fn pthread_spin_trylock(spin: *pthread_spinlock_t) c_int;
|
|
10984
|
+
pub extern "c" fn pthread_spin_destroy(spin: *pthread_spinlock_t) c_int;
|
|
10985
|
+
|
|
10959
10986
|
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = .{};
|
|
10960
10987
|
pub extern "c" fn pthread_mutex_lock(mutex: *pthread_mutex_t) E;
|
|
10961
10988
|
pub extern "c" fn pthread_mutex_unlock(mutex: *pthread_mutex_t) E;
|
|
@@ -11102,6 +11129,64 @@ pub const ioctl = switch (native_os) {
|
|
|
11102
11129
|
else => private.ioctl,
|
|
11103
11130
|
};
|
|
11104
11131
|
|
|
11132
|
+
pub extern "c" fn bzero(s: *anyopaque, n: usize) void;
|
|
11133
|
+
|
|
11134
|
+
pub extern "c" fn swab(noalias from: *const anyopaque, noalias to: *anyopaque, n: isize) void;
|
|
11135
|
+
|
|
11136
|
+
pub extern "c" fn strncmp(a: [*:0]const c_char, b: [*:0]const c_char, max: usize) c_int;
|
|
11137
|
+
pub extern "c" fn strcasecmp(a: [*:0]const c_char, b: [*:0]const c_char) c_int;
|
|
11138
|
+
pub extern "c" fn strncasecmp(a: [*:0]const c_char, b: [*:0]const c_char, max: usize) c_int;
|
|
11139
|
+
pub extern "c" fn strdup(s: [*:0]const c_char) ?[*:0]c_char;
|
|
11140
|
+
pub extern "c" fn strndup(s: [*:0]const c_char, n: usize) ?[*:0]c_char;
|
|
11141
|
+
pub extern "c" fn wcsdup(s: [*:0]const wchar_t) ?[*:0]wchar_t;
|
|
11142
|
+
|
|
11143
|
+
pub extern "c" fn ffs(i: c_int) c_int;
|
|
11144
|
+
pub extern "c" fn ffsl(i: c_long) c_long;
|
|
11145
|
+
pub extern "c" fn ffsll(i: c_longlong) c_longlong;
|
|
11146
|
+
|
|
11147
|
+
pub extern "c" fn erand48(xsubi: *[3]c_ushort) f64;
|
|
11148
|
+
pub extern "c" fn jrand48(xsubi: *[3]c_ushort) c_long;
|
|
11149
|
+
pub extern "c" fn nrand48(xsubi: *[3]c_ushort) c_long;
|
|
11150
|
+
|
|
11151
|
+
pub extern "c" fn insque(element: *anyopaque, pred: ?*anyopaque) void;
|
|
11152
|
+
pub extern "c" fn remque(element: *anyopaque) void;
|
|
11153
|
+
|
|
11154
|
+
pub extern "c" fn imaxabs(a: intmax_t) intmax_t;
|
|
11155
|
+
pub extern "c" fn imaxdiv(a: intmax_t, b: intmax_t) imaxdiv_t;
|
|
11156
|
+
|
|
11157
|
+
pub extern "c" fn abs(a: c_int) c_int;
|
|
11158
|
+
pub extern "c" fn labs(a: c_long) c_long;
|
|
11159
|
+
pub extern "c" fn llabs(a: c_longlong) c_longlong;
|
|
11160
|
+
|
|
11161
|
+
pub extern "c" fn div(a: c_int, b: c_int) div_t;
|
|
11162
|
+
pub extern "c" fn ldiv(a: c_long, b: c_long) ldiv_t;
|
|
11163
|
+
pub extern "c" fn lldiv(a: c_longlong, b: c_longlong) lldiv_t;
|
|
11164
|
+
|
|
11165
|
+
pub extern "c" fn atoi(str: [*:0]const c_char) c_int;
|
|
11166
|
+
pub extern "c" fn atol(str: [*:0]const c_char) c_long;
|
|
11167
|
+
pub extern "c" fn atoll(str: [*:0]const c_char) c_longlong;
|
|
11168
|
+
|
|
11169
|
+
pub extern "c" fn bsearch(
|
|
11170
|
+
key: *const anyopaque,
|
|
11171
|
+
base: *const anyopaque,
|
|
11172
|
+
n: usize,
|
|
11173
|
+
size: usize,
|
|
11174
|
+
compare: *const fn (a: *const anyopaque, b: *const anyopaque) callconv(.c) c_int,
|
|
11175
|
+
) ?*anyopaque;
|
|
11176
|
+
|
|
11177
|
+
// Math
|
|
11178
|
+
pub extern "c" fn atan(x: f64) f64;
|
|
11179
|
+
pub extern "c" fn copysign(x: f64, y: f64) f64;
|
|
11180
|
+
pub extern "c" fn fdim(x: f64, y: f64) f64;
|
|
11181
|
+
pub extern "c" fn frexp(x: f64, e: *c_int) f64;
|
|
11182
|
+
pub extern "c" fn hypot(x: f64, y: f64) f64;
|
|
11183
|
+
pub extern "c" fn modff(x: f32, iptr: *f32) f32;
|
|
11184
|
+
pub extern "c" fn modf(x: f64, iptr: *f64) f64;
|
|
11185
|
+
pub extern "c" fn modfl(x: c_longdouble, iptr: *c_longdouble) c_longdouble;
|
|
11186
|
+
pub extern "c" fn rintf(x: f32) f32;
|
|
11187
|
+
pub extern "c" fn rint(x: f64) f64;
|
|
11188
|
+
pub extern "c" fn rintl(x: c_longdouble) c_longdouble;
|
|
11189
|
+
|
|
11105
11190
|
// OS-specific bits. These are protected from being used on the wrong OS by
|
|
11106
11191
|
// comptime assertions inside each OS-specific file.
|
|
11107
11192
|
|
|
@@ -11142,6 +11227,8 @@ pub const _kern_open_dir = haiku._kern_open_dir;
|
|
|
11142
11227
|
pub const _kern_read_dir = haiku._kern_read_dir;
|
|
11143
11228
|
pub const _kern_read_stat = haiku._kern_read_stat;
|
|
11144
11229
|
pub const _kern_rewind_dir = haiku._kern_rewind_dir;
|
|
11230
|
+
pub const readv_pos = haiku.readv_pos;
|
|
11231
|
+
pub const writev_pos = haiku.writev_pos;
|
|
11145
11232
|
pub const area_id = haiku.area_id;
|
|
11146
11233
|
pub const area_info = haiku.area_info;
|
|
11147
11234
|
pub const directory_which = haiku.directory_which;
|
|
@@ -11211,7 +11298,6 @@ pub const login_getcaptime = openbsd.login_getcaptime;
|
|
|
11211
11298
|
pub const login_getclass = openbsd.login_getclass;
|
|
11212
11299
|
pub const login_getstyle = openbsd.login_getstyle;
|
|
11213
11300
|
pub const pledge = openbsd.pledge;
|
|
11214
|
-
pub const pthread_spinlock_t = openbsd.pthread_spinlock_t;
|
|
11215
11301
|
pub const pw_dup = openbsd.pw_dup;
|
|
11216
11302
|
pub const setclasscontext = openbsd.setclasscontext;
|
|
11217
11303
|
pub const setpassent = openbsd.setpassent;
|
|
@@ -11449,15 +11535,11 @@ pub const disown = serenity.disown;
|
|
|
11449
11535
|
pub const profiling_enable = serenity.profiling_enable;
|
|
11450
11536
|
pub const profiling_disable = serenity.profiling_disable;
|
|
11451
11537
|
pub const profiling_free_buffer = serenity.profiling_free_buffer;
|
|
11452
|
-
pub const futex_wait = serenity.futex_wait;
|
|
11453
|
-
pub const futex_wake = serenity.futex_wake;
|
|
11454
11538
|
pub const purge = serenity.purge;
|
|
11455
11539
|
pub const perf_event = serenity.perf_event;
|
|
11456
11540
|
pub const perf_register_string = serenity.perf_register_string;
|
|
11457
11541
|
pub const get_stack_bounds = serenity.get_stack_bounds;
|
|
11458
11542
|
pub const anon_create = serenity.anon_create;
|
|
11459
|
-
pub const serenity_readlink = serenity.serenity_readlink;
|
|
11460
|
-
pub const serenity_open = serenity.serenity_open;
|
|
11461
11543
|
pub const getkeymap = serenity.getkeymap;
|
|
11462
11544
|
pub const setkeymap = serenity.setkeymap;
|
|
11463
11545
|
|
|
@@ -1488,7 +1488,7 @@ const PackedContainer = packed struct(u2) {
|
|
|
1488
1488
|
|
|
1489
1489
|
test Compress {
|
|
1490
1490
|
const fbufs = try testingFreqBufs();
|
|
1491
|
-
defer
|
|
1491
|
+
defer std.testing.allocator.destroy(fbufs);
|
|
1492
1492
|
try std.testing.fuzz(fbufs, testFuzzedCompressInput, .{});
|
|
1493
1493
|
}
|
|
1494
1494
|
|
|
@@ -1818,7 +1818,7 @@ pub const Raw = struct {
|
|
|
1818
1818
|
|
|
1819
1819
|
test Raw {
|
|
1820
1820
|
const data_buf = try std.testing.allocator.create([4 * 65536]u8);
|
|
1821
|
-
defer
|
|
1821
|
+
defer std.testing.allocator.destroy(data_buf);
|
|
1822
1822
|
var prng: std.Random.DefaultPrng = .init(std.testing.random_seed);
|
|
1823
1823
|
prng.random().bytes(data_buf);
|
|
1824
1824
|
try std.testing.fuzz(data_buf, testFuzzedRawInput, .{});
|
|
@@ -2491,7 +2491,7 @@ pub const Huffman = struct {
|
|
|
2491
2491
|
|
|
2492
2492
|
test Huffman {
|
|
2493
2493
|
const fbufs = try testingFreqBufs();
|
|
2494
|
-
defer
|
|
2494
|
+
defer std.testing.allocator.destroy(fbufs);
|
|
2495
2495
|
try std.testing.fuzz(fbufs, testFuzzedHuffmanInput, .{});
|
|
2496
2496
|
}
|
|
2497
2497
|
|
|
@@ -129,8 +129,7 @@ fn discardDirect(r: *Reader, limit: std.Io.Limit) Reader.Error!usize {
|
|
|
129
129
|
}
|
|
130
130
|
const n = r.stream(&writer, limit) catch |err| switch (err) {
|
|
131
131
|
error.WriteFailed => unreachable,
|
|
132
|
-
error.ReadFailed => return
|
|
133
|
-
error.EndOfStream => return error.EndOfStream,
|
|
132
|
+
error.ReadFailed, error.EndOfStream => |e| return e,
|
|
134
133
|
};
|
|
135
134
|
assert(n <= @intFromEnum(limit));
|
|
136
135
|
return n;
|
|
@@ -258,7 +257,7 @@ fn streamFallible(d: *Decompress, w: *Writer, limit: std.Io.Limit) Reader.Stream
|
|
|
258
257
|
return error.ReadFailed;
|
|
259
258
|
}
|
|
260
259
|
},
|
|
261
|
-
error.WriteFailed => return
|
|
260
|
+
error.WriteFailed => |e| return e,
|
|
262
261
|
else => |e| {
|
|
263
262
|
// In the event of an error, state is unmodified so that it can be
|
|
264
263
|
// better used to diagnose the failure.
|
|
@@ -173,8 +173,7 @@ fn discardDirect(r: *Reader, limit: std.Io.Limit) Reader.Error!usize {
|
|
|
173
173
|
}
|
|
174
174
|
const n = r.stream(&writer, limit) catch |err| switch (err) {
|
|
175
175
|
error.WriteFailed => unreachable,
|
|
176
|
-
error.ReadFailed => return
|
|
177
|
-
error.EndOfStream => return error.EndOfStream,
|
|
176
|
+
error.ReadFailed, error.EndOfStream => |e| return e,
|
|
178
177
|
};
|
|
179
178
|
assert(n <= @intFromEnum(limit));
|
|
180
179
|
return n;
|
|
@@ -252,8 +251,7 @@ fn stream(d: *Decompress, w: *Writer, limit: Limit) Reader.StreamError!usize {
|
|
|
252
251
|
},
|
|
253
252
|
.in_frame => |*in_frame| {
|
|
254
253
|
return readInFrame(d, w, limit, in_frame) catch |err| switch (err) {
|
|
255
|
-
error.ReadFailed => return
|
|
256
|
-
error.WriteFailed => return error.WriteFailed,
|
|
254
|
+
error.ReadFailed, error.WriteFailed => |e| return e,
|
|
257
255
|
else => |e| {
|
|
258
256
|
d.err = e;
|
|
259
257
|
return error.ReadFailed;
|
|
@@ -184,7 +184,8 @@ pub fn addCertsFromDirPath(
|
|
|
184
184
|
) AddCertsFromDirPathError!void {
|
|
185
185
|
var iterable_dir = try dir.openDir(io, sub_dir_path, .{ .iterate = true });
|
|
186
186
|
defer iterable_dir.close(io);
|
|
187
|
-
|
|
187
|
+
const now = Io.Clock.real.now(io);
|
|
188
|
+
return addCertsFromDir(cb, gpa, io, now, iterable_dir);
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
pub fn addCertsFromDirPathAbsolute(
|
|
@@ -331,6 +332,19 @@ const MapContext = struct {
|
|
|
331
332
|
}
|
|
332
333
|
};
|
|
333
334
|
|
|
335
|
+
test "addCertsFromDirPath compiles and accepts an empty directory" {
|
|
336
|
+
const io = std.testing.io;
|
|
337
|
+
const gpa = std.testing.allocator;
|
|
338
|
+
|
|
339
|
+
var tmp = std.testing.tmpDir(.{ .iterate = true });
|
|
340
|
+
defer tmp.cleanup();
|
|
341
|
+
|
|
342
|
+
var bundle: Bundle = .empty;
|
|
343
|
+
defer bundle.deinit(gpa);
|
|
344
|
+
|
|
345
|
+
try bundle.addCertsFromDirPath(gpa, io, tmp.dir, ".");
|
|
346
|
+
}
|
|
347
|
+
|
|
334
348
|
test "scan for OS-provided certificates" {
|
|
335
349
|
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
|
336
350
|
|
|
@@ -580,7 +580,10 @@ pub fn parseTime(cert: Certificate, elem: der.Element) ParseTimeError!u64 {
|
|
|
580
580
|
return error.CertificateTimeInvalid;
|
|
581
581
|
|
|
582
582
|
return Date.toSeconds(.{
|
|
583
|
-
.year =
|
|
583
|
+
.year = blk: {
|
|
584
|
+
const year = try parseTimeDigits(bytes[0..2], 0, 99);
|
|
585
|
+
break :blk if (year < 50) @as(u16, 2000) + year else @as(u16, 1900) + year;
|
|
586
|
+
},
|
|
584
587
|
.month = try parseTimeDigits(bytes[2..4], 1, 12),
|
|
585
588
|
.day = try parseTimeDigits(bytes[4..6], 1, 31),
|
|
586
589
|
.hour = try parseTimeDigits(bytes[6..8], 0, 23),
|
|
@@ -670,6 +673,15 @@ pub fn parseTimeDigits(text: *const [2]u8, min: u8, max: u8) !u8 {
|
|
|
670
673
|
return @intCast(result);
|
|
671
674
|
}
|
|
672
675
|
|
|
676
|
+
test "parseTime UTCTime year mapping per RFC 5280" {
|
|
677
|
+
const utc_time_id: der.Identifier = .{ .tag = .utc_time, .pc = .primitive, .class = .universal };
|
|
678
|
+
const elem = der.Element{ .identifier = utc_time_id, .slice = .{ .start = 0, .end = 13 } };
|
|
679
|
+
const cert49 = Certificate{ .buffer = "490101000000Z", .index = 0 };
|
|
680
|
+
try std.testing.expectEqual(@as(u64, 2493072000), try cert49.parseTime(elem));
|
|
681
|
+
const cert99 = Certificate{ .buffer = "990101000000Z", .index = 0 };
|
|
682
|
+
try std.testing.expectEqual(@as(u64, 915148800), try cert99.parseTime(elem));
|
|
683
|
+
}
|
|
684
|
+
|
|
673
685
|
test parseTimeDigits {
|
|
674
686
|
const expectEqual = std.testing.expectEqual;
|
|
675
687
|
try expectEqual(@as(u8, 0), try parseTimeDigits("00", 0, 99));
|