text
stringlengths
32
314k
url
stringlengths
93
243
const std = @import("std"); pub fn build(b: *std.build.Builder) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for rest...
https://raw.githubusercontent.com/thechampagne/raylib-zig/540b817e8b92e6a34c58664616ac0dcf445c42af/08_core_2d_camera/build.zig
const std = @import("std"); const testing = std.testing; const command = @import("./util/command.zig"); const Graph = @import("./island.zig").Graph; pub fn main() anyerror!u8 { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); ...
https://raw.githubusercontent.com/gonzus/AdventOfCode/7e972b92a23db29461b2869713a3251998af5822/2023/p25/p25.zig
pub const Class = enum { integer, sse, sseup, x87, x87up, complex_x87, memory, none, win_i128, float, float_combine, integer_per_element, fn isX87(class: Class) bool { return switch (class) { .x87, .x87up, .complex_x87 => true, else =>...
https://raw.githubusercontent.com/ziglang/zig-bootstrap/ec2dca85a340f134d2fcfdc9007e91f9abed6996/zig/src/arch/x86_64/abi.zig
pub const Class = enum { integer, sse, sseup, x87, x87up, complex_x87, memory, none, win_i128, float, float_combine, integer_per_element, fn isX87(class: Class) bool { return switch (class) { .x87, .x87up, .complex_x87 => true, else =>...
https://raw.githubusercontent.com/kassane/zig-mos-bootstrap/19aac4779b9e93b0e833402c26c93cfc13bb94e2/zig/src/arch/x86_64/abi.zig
// This file is part of river, a dynamic tiling wayland compositor. // // Copyright 2020 The River Developers // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, version 3. // // This program ...
https://raw.githubusercontent.com/koonix/river/4a96c2d18dc5e33917f134bc632b74da149e4812/river/command/spawn.zig
const Vec4 = @import("math3d.zig").Vec4; pub const Piece = struct { name: u8, color: Vec4, layout: [4][4][4]bool, }; const F = false; const T = true; pub const pieces = [_]Piece{ Piece{ .name = 'I', .color = Vec4{ .data = [_]f32{ 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, ...
https://raw.githubusercontent.com/ziglang/gotta-go-fast/c915c45c5afed9a2e2de4f4484acba2df5090c3a/src/tetris/tetris/src/pieces.zig
const Vec4 = @import("math3d.zig").Vec4; pub const Piece = struct { name: u8, color: Vec4, layout: [4][4][4]bool, }; const F = false; const T = true; pub const pieces = [_]Piece{ Piece{ .name = 'I', .color = Vec4{ .data = [_]f32{ 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, ...
https://raw.githubusercontent.com/Rafaelmdcarneiro/tetris-zig/078142b33feb7363bebbdc4666718635c4c6969b/src/pieces.zig
const std = @import("std"); const print = @import("std").debug.print; const r2pipe = @import("src/r2pipe.zig"); pub fn main() !void { try inr2(); // try inspawn(); } fn inr2() !void { const r2 = try r2pipe.open(""); const res = try r2.cmd("?E Hello World"); print("Hello, {s}\n{s}\n", .{ "world", r...
https://raw.githubusercontent.com/2lambda123/radare2-r2pipe/bab6a251f07adcb90ffec715f8f4aeaf9addbf3f/zig/main.zig
// // One of the more common uses of 'comptime' function parameters is // passing a type to a function: // // fn foo(comptime MyType: type) void { ... } // // In fact, types are ONLY available at compile time, so the // 'comptime' keyword is required here. // // Please take a moment to put on the wizard hat which h...
https://raw.githubusercontent.com/scbizu/zerglings/b8f519f0c52cc9b44e262ae242bb923467146d49/exercises/069_comptime4.zig
// // One of the more common uses of 'comptime' function parameters is // passing a type to a function: // // fn foo(comptime MyType: type) void { ... } // // In fact, types are ONLY available at compile time, so the // 'comptime' keyword is required here. // // Please take a moment to put on the wizard hat which h...
https://raw.githubusercontent.com/ErickDevv/ziglings/fd5adcf1282f056ef916321e63c3d1efd60c1d0d/exercises/069_comptime4.zig
// // One of the more common uses of 'comptime' function parameters is // passing a type to a function: // // fn foo(comptime MyType: type) void { ... } // // In fact, types are ONLY available at compile time, so the // 'comptime' keyword is required here. // // Please take a moment to put on the wizard hat which h...
https://raw.githubusercontent.com/AndrewJarrett/ziglings/ccbde8411969bd22059fa63d0371bc34b26343a1/exercises/069_comptime4.zig
// // One of the more common uses of 'comptime' function parameters is // passing a type to a function: // // fn foo(comptime MyType: type) void { ... } // // In fact, types are ONLY available at compile time, so the // 'comptime' keyword is required here. // // Please take a moment to put on the wizard hat which h...
https://raw.githubusercontent.com/thekorn/ziglings/11530b95d49af1a7adee0235dfe9b8efc4f009bc/exercises/069_comptime4.zig
// Ported from musl, which is licensed under the MIT license: // https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT // // https://git.musl-libc.org/cgit/musl/tree/src/math/atan2f.c // https://git.musl-libc.org/cgit/musl/tree/src/math/atan2.c const std = @import("../std.zig"); const math = std.math; const expect = std....
https://raw.githubusercontent.com/mundusnine/FoundryTools_linux_x64/98e738bf92a416b255c9d11b78e8033071b52672/lib/std/math/atan2.zig
// Ported from musl, which is licensed under the MIT license: // https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT // // https://git.musl-libc.org/cgit/musl/tree/src/math/atan2f.c // https://git.musl-libc.org/cgit/musl/tree/src/math/atan2.c const std = @import("../std.zig"); const math = std.math; const expect = std....
https://raw.githubusercontent.com/matpx/daydream/018ad0c7caaf796d8a04b882fcbed39ccb7c9cd8/toolchain/zig/lib/std/math/atan2.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const compile = @import("compile.zig"); const Program = compile.Program; const VmBacktrack = @import("vm_backtrack.zig").VmBacktrack; const VmPike = @import("vm_pike.zig").VmPike; const Input = @import("input.zig").Input;...
https://raw.githubusercontent.com/TemariVirus/AOC-2020/a32dcfb85655e733247c5c53b70d2f8837a6f468/lib/zig-regex/src/exec.zig
const std = @import("std"); const builtin = @import("builtin"); pub const tb_packet_t = @import("tb_client/packet.zig").Packet; pub const tb_packet_status_t = tb_packet_t.Status; pub const tb_packet_acquire_status_t = @import("tb_client/context.zig").PacketAcquireStatus; pub const tb_client_t = *anyopaque; pub const ...
https://raw.githubusercontent.com/matklad/tigerbeetle-filter-repo/d699bf1bbc60a034efb0c99d7f993498e3277960/src/clients/c/tb_client.zig
const std = @import("std"); const mmio = @import("../../../mmio.zig"); address: u64, const FLAG_OFFSET = 0x18; const INTEGER_BAUD_DIVISOR_OFFSET: u64 = 0x24; const FRACTIONAL_BAUD_DIVISOR_OFFSET: u64 = 0x28; const LINE_CONTROL_OFFSET: u64 = 0x2c; const CONTROL_OFFSET: u64 = 0x30; const INTERRUPT_OFFSET: u64 = 0x44; ...
https://raw.githubusercontent.com/kora-org/ydin/3a9ea572489c98719de1a87fd18ebfec6d100e8f/src/arch/aarch64/serial/pl011.zig
// // Zig has builtins for mathematical operations such as... // // @sqrt @sin @cos // @exp @log @floor // // ...and lots of type casting operations such as... // // @as @errorFromInt @floatFromInt // @ptrFromInt @intFromPtr @intFromEnum // // Spendin...
https://raw.githubusercontent.com/41Leahcim/my_ziglings/583649387228f46b7f7569424cc66d16e0baaa30/exercises/065_builtins2.zig
// SPDX-License-Identifier: MIT // Copyright (c) 2015-2021 Zig Contributors // This file is part of [zig](https://ziglang.org/), which is MIT licensed. // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. const fixuint = @import("fixuint.zig").fixui...
https://raw.githubusercontent.com/collinalexbell/all-the-compilers/7f834984f71054806bfec8604e02e86b99c0f831/zig/lib/std/special/compiler_rt/fixunsdfti.zig
// SPDX-License-Identifier: MIT // Copyright (c) 2015-2021 Zig Contributors // This file is part of [zig](https://ziglang.org/), which is MIT licensed. // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. const fixuint = @import("fixuint.zig").fixui...
https://raw.githubusercontent.com/creationix/zig-toolset/9ad208cd93d1f05eb772deff4af24f58eb42386f/zig-linux-x86_64-0.8.0-dev.1860+1fada3746/lib/std/special/compiler_rt/fixunsdfti.zig
objects: std.ArrayListUnmanaged(Object) = .{}, strtab: std.ArrayListUnmanaged(u8) = .{}, pub fn isArchive(path: []const u8) !bool { const file = try std.fs.cwd().openFile(path, .{}); defer file.close(); const reader = file.reader(); const magic = reader.readBytesNoEof(elf.ARMAG.len) catch return false;...
https://raw.githubusercontent.com/ziglang/zig-bootstrap/ec2dca85a340f134d2fcfdc9007e91f9abed6996/zig/src/link/Elf/Archive.zig
objects: std.ArrayListUnmanaged(Object) = .{}, strtab: std.ArrayListUnmanaged(u8) = .{}, pub fn isArchive(path: []const u8) !bool { const file = try std.fs.cwd().openFile(path, .{}); defer file.close(); const reader = file.reader(); const magic = reader.readBytesNoEof(elf.ARMAG.len) catch return false;...
https://raw.githubusercontent.com/kassane/zig-mos-bootstrap/19aac4779b9e93b0e833402c26c93cfc13bb94e2/zig/src/link/Elf/Archive.zig
const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); pub fn __fixunstfti(a: f128) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); return fixuint(f128, u128, a); } test { _ = @import("fixunstfti_test.zig"); }
https://raw.githubusercontent.com/natanalt/zig-x86_16/1b38fc3ef5e539047c76604ffe71b81e246f1a1e/lib/std/special/compiler_rt/fixunstfti.zig
const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); pub fn __fixunstfti(a: f128) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); return fixuint(f128, u128, a); } test { _ = @import("fixunstfti_test.zig"); }
https://raw.githubusercontent.com/kraxli/dev_tools_mswindows/1d1a8f61299e4b7ba356fae3a37af0ddc8daf356/zig-windows-x86_64-0.9.1/lib/std/special/compiler_rt/fixunstfti.zig
const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); pub fn __fixunstfti(a: f128) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); return fixuint(f128, u128, a); } test { _ = @import("fixunstfti_test.zig"); }
https://raw.githubusercontent.com/jamesmintram/jimzos/8eb52e7efffb1a97eca4899ff72549f96ed3460b/tools/ext2fs/data/test3/special/compiler_rt/fixunstfti.zig
//! generated by flatc-zig from Schema.fbs const flatbuffers = @import("flatbuffers"); /// A Map is a logical nested type that is represented as /// /// List<entries: Struct<key: K, value: V>> /// /// In this layout, the keys and values are each respectively contiguous. We do /// not constrain the key and value types...
https://raw.githubusercontent.com/clickingbuttons/flatbuffers-zig/47a7c4b913e01c9701e1a69ce49c450cfb9a880f/codegen/examples/arrow/gen/Map.zig
// // We've absorbed a lot of information about the variations of types // we can use in Zig. Roughly, in order we have: // // u8 single item // *u8 single-item pointer // []u8 slice (size known at runtime) // [5]u8 array ...
https://raw.githubusercontent.com/ruslandoga/ziglings/1cae040494f5bb64cd92b0847d839ab26b7bec46/exercises/058_quiz7.zig
//! A set of array and slice types that bit-pack integer elements. A normal [12]u3 //! takes up 12 bytes of memory since u3's alignment is 1. PackedArray(u3, 12) only //! takes up 4 bytes of memory. const std = @import("std"); const builtin = @import("builtin"); const debug = std.debug; const testing = std.testing; co...
https://raw.githubusercontent.com/ziglang/zig-bootstrap/ec2dca85a340f134d2fcfdc9007e91f9abed6996/zig/lib/std/packed_int_array.zig
//! A set of array and slice types that bit-pack integer elements. A normal [12]u3 //! takes up 12 bytes of memory since u3's alignment is 1. PackedArray(u3, 12) only //! takes up 4 bytes of memory. const std = @import("std"); const builtin = @import("builtin"); const debug = std.debug; const testing = std.testing; co...
https://raw.githubusercontent.com/cyberegoorg/cetech1-zig/7438a7b157a4047261d161c06248b54fe9d822eb/lib/std/packed_int_array.zig
//! A set of array and slice types that bit-pack integer elements. A normal [12]u3 //! takes up 12 bytes of memory since u3's alignment is 1. PackedArray(u3, 12) only //! takes up 4 bytes of memory. const std = @import("std"); const builtin = @import("builtin"); const debug = std.debug; const testing = std.testing; co...
https://raw.githubusercontent.com/kassane/zig-mos-bootstrap/19aac4779b9e93b0e833402c26c93cfc13bb94e2/zig/lib/std/packed_int_array.zig
const std = @import("std"); pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits); const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits); const srcSigBits = std.math.floatMantissaBits(src_t)...
https://raw.githubusercontent.com/ziglang/zig-bootstrap/ec2dca85a340f134d2fcfdc9007e91f9abed6996/zig/lib/compiler_rt/truncf.zig
const std = @import("std"); pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits); const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits); const srcSigBits = std.math.floatMantissaBits(src_t)...
https://raw.githubusercontent.com/kassane/zig-mos-bootstrap/19aac4779b9e93b0e833402c26c93cfc13bb94e2/zig/lib/compiler_rt/truncf.zig
const std = @import("std"); pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits); const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits); const srcSigBits = std.math.floatMantissaBits(src_t)...
https://raw.githubusercontent.com/beingofexistence13/multiversal-lang/dd769e3fc6182c23ef43ed4479614f43f29738c9/zig/lib/compiler_rt/truncf.zig
const std = @import("std"); pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits); const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits); const srcSigBits = std.math.floatMantissaBits(src_t)...
https://raw.githubusercontent.com/2lambda123/ziglang-zig-bootstrap/f56dc0fd298f41c8cc2a4f76a9648111e6c75503/zig/lib/compiler_rt/truncf.zig
//! __emutls_get_address specific builtin //! //! derived work from LLVM Compiler Infrastructure - release 8.0 (MIT) //! https://github.com/llvm-mirror/compiler-rt/blob/release_80/lib/builtins/emutls.c const std = @import("std"); const builtin = @import("builtin"); const common = @import("common.zig"); const abort = ...
https://raw.githubusercontent.com/mundusnine/FoundryTools_linux_x64/98e738bf92a416b255c9d11b78e8033071b52672/lib/compiler_rt/emutls.zig
//! __emutls_get_address specific builtin //! //! derived work from LLVM Compiler Infrastructure - release 8.0 (MIT) //! https://github.com/llvm-mirror/compiler-rt/blob/release_80/lib/builtins/emutls.c const std = @import("std"); const builtin = @import("builtin"); const common = @import("common.zig"); const abort = ...
https://raw.githubusercontent.com/matpx/daydream/018ad0c7caaf796d8a04b882fcbed39ccb7c9cd8/toolchain/zig/lib/compiler_rt/emutls.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const BigIntConst = std.math.big.int.Const; const BigIntMutable = std.math.big.int.Mutable; const Hash = std.hash.Wyhash; const Limb = std.math.big.Limb; const Interner = @This(); map: std.AutoArrayHashMapUnmanaged(void,...
https://raw.githubusercontent.com/ziglang/zig-bootstrap/ec2dca85a340f134d2fcfdc9007e91f9abed6996/zig/lib/compiler/aro/backend/Interner.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const BigIntConst = std.math.big.int.Const; const BigIntMutable = std.math.big.int.Mutable; const Hash = std.hash.Wyhash; const Limb = std.math.big.Limb; const Interner = @This(); map: std.AutoArrayHashMapUnmanaged(void,...
https://raw.githubusercontent.com/cyberegoorg/cetech1-zig/7438a7b157a4047261d161c06248b54fe9d822eb/lib/compiler/aro/backend/Interner.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const BigIntConst = std.math.big.int.Const; const BigIntMutable = std.math.big.int.Mutable; const Hash = std.hash.Wyhash; const Limb = std.math.big.Limb; const Interner = @This(); map: std.AutoArrayHashMapUnmanaged(void,...
https://raw.githubusercontent.com/kassane/zig-mos-bootstrap/19aac4779b9e93b0e833402c26c93cfc13bb94e2/zig/lib/compiler/aro/backend/Interner.zig
//! NOTE: this file is autogenerated, DO NOT MODIFY //-------------------------------------------------------------------------------- // Section: Constants (92) //-------------------------------------------------------------------------------- pub const ASN_UNIVERSAL = @as(u32, 0); pub const ASN_APPLICATION = @as(u32,...
https://raw.githubusercontent.com/OAguinagalde/tinyrenderer/20e140ad9a9483d6976f91c074a2e8a96e2038fb/dep/zigwin32/win32/network_management/snmp.zig
const std = @import("../../../std.zig"); const kern = @import("kern.zig"); const PtRegs = @compileError("TODO missing os bits: PtRegs"); const TcpHdr = @compileError("TODO missing os bits: TcpHdr"); const SkFullSock = @compileError("TODO missing os bits: SkFullSock"); // in BPF, all the helper calls // TODO: when htt...
https://raw.githubusercontent.com/mundusnine/FoundryTools_windows_x64/b64cdb7e56db28eb710a05a089aed0daff8bc8be/lib/std/os/linux/bpf/helpers.zig
const std = @import("../../../std.zig"); const kern = @import("kern.zig"); const PtRegs = @compileError("TODO missing os bits: PtRegs"); const TcpHdr = @compileError("TODO missing os bits: TcpHdr"); const SkFullSock = @compileError("TODO missing os bits: SkFullSock"); // in BPF, all the helper calls // TODO: when htt...
https://raw.githubusercontent.com/mundusnine/FoundryTools_linux_x64/98e738bf92a416b255c9d11b78e8033071b52672/lib/std/os/linux/bpf/helpers.zig
const std = @import("../../../std.zig"); const kern = @import("kern.zig"); const PtRegs = @compileError("TODO missing os bits: PtRegs"); const TcpHdr = @compileError("TODO missing os bits: TcpHdr"); const SkFullSock = @compileError("TODO missing os bits: SkFullSock"); // in BPF, all the helper calls // TODO: when htt...
https://raw.githubusercontent.com/matpx/daydream/018ad0c7caaf796d8a04b882fcbed39ccb7c9cd8/toolchain/zig/lib/std/os/linux/bpf/helpers.zig
pub const backends = @import("display/backends.zig");
https://raw.githubusercontent.com/PhantomUIx/display-ramfb/3b58c87f5484cb082f2008fd21ef2433d4de723f/src/phantom/display.zig
pub const backends = @import("display/backends.zig");
https://raw.githubusercontent.com/PhantomUIx/display-xcb/303dad53b21186a71912f49b9690f0cbf7741bb0/src/phantom/display.zig
pub const backends = @import("display/backends.zig");
https://raw.githubusercontent.com/PhantomUIx/display-drm/f0c62d360938219e57a31934fde7a0c9b21bd93a/src/phantom/display.zig
pub const backends = @import("display/backends.zig");
https://raw.githubusercontent.com/PhantomUIx/display-fbdev/ce43e92e6530a10c7ea964fe5b281f8a9b402b89/src/phantom/display.zig
const print = @import("std").debug.print; extern fn foo_strict(x: f64) f64; extern fn foo_optimized(x: f64) f64; pub fn main() void { const x = 0.001; print("optimized = {}\n", .{foo_optimized(x)}); print("strict = {}\n", .{foo_strict(x)}); } // syntax
https://raw.githubusercontent.com/ziglang/zig-bootstrap/ec2dca85a340f134d2fcfdc9007e91f9abed6996/zig/doc/langref/float_mode_exe.zig
const print = @import("std").debug.print; extern fn foo_strict(x: f64) f64; extern fn foo_optimized(x: f64) f64; pub fn main() void { const x = 0.001; print("optimized = {}\n", .{foo_optimized(x)}); print("strict = {}\n", .{foo_strict(x)}); } // syntax
https://raw.githubusercontent.com/kassane/zig-mos-bootstrap/19aac4779b9e93b0e833402c26c93cfc13bb94e2/zig/doc/langref/float_mode_exe.zig
// wasi_snapshot_preview1 spec available (in witx format) here: // * typenames -- https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/witx/typenames.witx // * module -- https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/witx/wasi_snapshot_preview1.witx const std = @import("std"); const assert =...
https://raw.githubusercontent.com/kraxli/dev_tools_mswindows/1d1a8f61299e4b7ba356fae3a37af0ddc8daf356/zig-windows-x86_64-0.9.1/lib/std/os/wasi.zig
const Fs = @import("fs.zig"); const std = @import("std"); const bun = @import("root").bun; const string = bun.string; const Output = bun.Output; const Global = bun.Global; const Environment = bun.Environment; const strings = bun.strings; const MutableString = bun.MutableString; const CodePoint = bun.CodePoint; const St...
https://raw.githubusercontent.com/oven-sh/bun/fab96a74ea13da04459ea7f62663c4d2fd421778/src/css_scanner.zig
const common = @import("./common.zig"); const mulf3 = @import("./mulf3.zig").mulf3; pub const panic = common.panic; comptime { @export(__mulxf3, .{ .name = "__mulxf3", .linkage = common.linkage, .visibility = common.visibility }); } pub fn __mulxf3(a: f80, b: f80) callconv(.C) f80 { return mulf3(f80, a, b); ...
https://raw.githubusercontent.com/ziglang/zig/d9bd34fd0533295044ffb4160da41f7873aff905/lib/compiler_rt/mulxf3.zig
const ChainedStruct = @import("main.zig").ChainedStruct; const Impl = @import("interface.zig").Impl; pub const CommandBuffer = opaque { pub const Descriptor = extern struct { next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, }; pub inline fn setLabel(command_buffer...
https://raw.githubusercontent.com/hexops/mach/b72f0e11b6d292c2b60789359a61f7ee6d7dc371/src/gpu/command_buffer.zig
const std = @import("std"); const builtin = @import("builtin"); const str = @import("glue").str; const RocStr = str.RocStr; const testing = std.testing; const expectEqual = testing.expectEqual; const expect = testing.expect; const maxInt = std.math.maxInt; const mem = std.mem; const Allocator = mem.Allocator; extern ...
https://raw.githubusercontent.com/roc-lang/roc/a6f1408b5c97e2f5eb3b62b0b481b6a29c958e83/examples/cli/effects-platform/host.zig
// posix-node binaries should work across a very wide range of nodejs versions // for their given architecture. // // "For an addon to remain ABI-compatible across Node.js major versions, it must use // Node-API exclusively by restricting itself to using #include <node_api.h>." // // -- https://nodejs.org/api/n...
https://raw.githubusercontent.com/sagemathinc/cowasm/e8bba5584f03937611619934f0d5858e4d03853d/core/posix-node/src/c.zig
// Autogenerated from https://www.unicode.org/Public/14.0.0/ucd/. Edits will be lost on update. pub fn isNumeric(cp: u21) bool { if (cp < 0xbc or cp > 0x2f890) return false; return switch (cp) { 0xbc...0xbe => true, 0x9f4...0x9f9 => true, 0xb72...0xb77 => true, 0xbf0...0xbf2 =>...
https://raw.githubusercontent.com/mbrock/wisp/b12b8afa6b680cc173fd5e5a09d6a40a528ff2c1/core/lib/ziglyph/src/autogen/derived_numeric_type.zig
use @import("SDL_stdinc.zig"); pub const SDL_BLENDMODE_NONE = 0; pub const SDL_BLENDMODE_BLEND = 1; pub const SDL_BLENDMODE_ADD = 2; pub const SDL_BLENDMODE_MOD = 4; pub const SDL_BLENDMODE_INVALID = 2147483647; pub const SDL_BlendMode = extern enum { SDL_BLENDMODE_NONE = 0, SDL_BLENDMODE_BLEND = 1, SDL_BL...
https://raw.githubusercontent.com/tiehuis/zig-sdl2/43e0f5fa4a2b7f8a156c13cbd8540ef18373561e/src/SDL_video.zig
pub const combn = @import("combn/combn.zig"); pub const dsl = @import("dsl/dsl.zig"); test "include" { _ = dsl.Program; }
https://raw.githubusercontent.com/hexops/zorex/44732bc9c05dcde40f26f8b5e058c438c011a17e/src/zorex.zig
// glinka // Copyright (C) 2021-2022 Ollie Etherington // <www.etherington.io> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option...
https://raw.githubusercontent.com/oetherington/glinka/57cac7047f22926d162f82378b6ea965596d9708/src/compiler/errors/op_error.zig
pub const OUTPUT_PATH: []const u8 = "outputs.txt"; pub const MEASUREMENTS_PATH: []const u8 = "measurements.txt";
https://raw.githubusercontent.com/myyrakle/billion_row_challenge/8cd13292804208eaa5247f624232ddfda2fc2b0b/zig/common.zig
const c = @import("cimport.zig"); const common = @import("common.zig"); const bool_to_c_int = common.bool_to_c_int; const Container = @import("container.zig").Container; const Dialog = @import("dialog.zig").Dialog; const WindowType = @import("enums.zig").WindowType; const Widget = @import("widget.zig").Widget; pub con...
https://raw.githubusercontent.com/nfisher1226/zig-gtk3/da5042dd2b0b4e19d25c6143c369be4a0a3eda23/src/window.zig
// https://github.com/nektro/zig-asn1 const std = @import("std"); const string = []const u8; const assert = std.debug.assert; pub const Tag = enum(u8) { // zig fmt: off end_of_content = @as(u8, 0) | @intFromEnum(PC.primitive), boolean = @as(u8, 1) | @intFromEnum(PC.primitive), integer...
https://raw.githubusercontent.com/The-Z-Labs/bof-launcher/3b951c355952ef5c2f6b37d703f0072849151208/include/asn1.zig
const std = @import("std"); const assert = std.debug.assert; fn abc(v: u64) bool { var ret_val: bool = v >= 0x8000000000000000; std.debug.warn("v={x} ret_val={}\n", v, ret_val); return ret_val; } pub fn main() void { var prng = std.rand.DefaultPrng.init(12345678); assert(!abc(prng.random.scalar(u6...
https://raw.githubusercontent.com/winksaville/zig-explore/34a19e1540a3b1a3e72c4d0ed339cd0384c0760e/assert/main.zig
const Allocator = @import("std").mem.Allocator; const heap = @import("heap.zig"); const log = @import("log.zig"); const stream = @import("stream.zig"); const sync = @import("sync.zig"); const lwip = @import("lwip.zig"); const net = @import("drivers/virtio/net.zig"); const util = @import("util.zig"); const virito_net =...
https://raw.githubusercontent.com/mewz-project/mewz/0c6724f3f37552c3a36728fef9d7682ff3589586/src/tcpip.zig
const std = @import("std"); const raylib = @import("src/build.zig"); pub fn build(b: *std.build.Builder) void { raylib.build(b); }
https://raw.githubusercontent.com/ishaan-bose/Cpp-Raytracing-Project/941f3f4260eddcb3d7458cb4ddbf4e0505be780e/raylib-master/build.zig
//! Communication of Client and Server, also communication of operating system and this application. const std = @import("std"); const os = std.os; const net = std.net; const testing = std.testing; const assert = std.debug.assert; const known_folders = @import("known-folders"); pub const known_folders_config = .{ ...
https://raw.githubusercontent.com/greenfork/kisa/68f344bd2fc28ccdd850dec14859a1995f8cb97f/not_good_enough/src/transport.zig
// // It has probably not escaped your attention that we are no // longer capturing a return value from foo() because the 'async' // keyword returns the frame instead. // // One way to solve this is to use a global variable. // // See if you can make this program print "1 2 3 4 5". // const print = @import("std").debug...
https://raw.githubusercontent.com/peteraba/ziglings/296745f8e3650ad54900ba62bbae032f169441cb/exercises/087_async4.zig
const std = @import("std"); const sdl = @cImport({ @cInclude("SDL2/SDL.h"); }); pub const Keyboard = struct { const Self = @This(); keypad: [16]bool, lastState: [16]bool, pub fn init() Self { return Keyboard { .keypad = [_]bool{false} ** 16, .lastState = [_]bool{fal...
https://raw.githubusercontent.com/johanlindfors/chip8/73fca5ca805741b0670dfc59ec6c7468004fe901/zig/src/keyboard.zig
pub fn textGridOf(rows: u32, columns: u32) type { var SomeTextGrid = struct { const Self = @This(); font: *Spritesheet, fb_x: u32, fb_y: u32, pending_buf: [rows * columns]u8, pending_index: u32, rendered_buf: [rows * columns]u8, rendered_index: u32, ...
https://raw.githubusercontent.com/markfirmware/zig-bare-metal-raspberry-pi/0f0275138ee70a901f58f607d6dee175fae9632f/src/text_grid.zig
const InvocationRequest = @This(); const std = @import("std"); // // The user's payload represented as a UTF-8 string. // payload: ?[:0]const u8 = null, // // An identifier unique to the current invocation. // request_id: ?[:0]const u8 = null, // // X-Ray tracing ID of the current invocation. // xray_trace_id: ?[:0]co...
https://raw.githubusercontent.com/gitusel/aws-lambda-zig/9526867e32fb08519f26a46f73777cdce3313e8e/src/lambda_runtime/InvocationRequest.zig
const zignite = @import("../zignite.zig"); const expect = @import("std").testing.expect; const ConsumerType = @import("consumer_type.zig").ConsumerType; test "all: odd" { const odd = struct { pub fn odd(x: i32) bool { return @mod(x, 2) == 1; } }.odd; try expect(zignite.fromSlic...
https://raw.githubusercontent.com/shunkeen/zignite/840dcda178be270a2e7eb273aed98e3740c82f22/src/consumer/all.zig
pub const LndConf = @import("lightning/LndConf.zig"); pub const lndhttp = @import("lightning/lndhttp.zig"); test { const std = @import("std"); std.testing.refAllDecls(@This()); }
https://raw.githubusercontent.com/nakamochi/ndg/538ecd957c3f989485b0f8f6982c9cd1817dc56b/src/lightning.zig
//! Support: X ∈ (-∞,∞) //! //! Parameters: //! - μ: `location` ∈ (-∞,∞) //! - σ: `scale` ∈ ( 0,∞) const std = @import("std"); const assert = std.debug.assert; const isFinite = std.math.isFinite; const isNan = std.math.isNan; const inf = std.math.inf(f64); pub const discrete = false; /// f(x) = 1 / (πσ (1 + ((x -...
https://raw.githubusercontent.com/PauloCampana/random_variable/fcac8c4fcc43072380b79829359555956258b37f/src/distribution/cauchy.zig
/// mesh data imported from zmesh.Shape and model file const std = @import("std"); const math = std.math; const assert = std.debug.assert; const jok = @import("../jok.zig"); const sdl = jok.sdl; const internal = @import("internal.zig"); const Vector = @import("Vector.zig"); const TriangleRenderer = @import("TriangleRen...
https://raw.githubusercontent.com/Jack-Ji/jok/8cd4d0e0ad8f073ace74c6b2e3a60ff9f27889a9/src/j3d/Mesh.zig
const std = @import("std.zig"); const debug = std.debug; const assert = debug.assert; const testing = std.testing; const mem = std.mem; const math = std.math; const Allocator = mem.Allocator; /// A contiguous, growable list of items in memory. /// This is a wrapper around an array of T values. Initialize with `init`. ...
https://raw.githubusercontent.com/mazino3/ziglang/3db8cffa3b383011471f425983a7e98ad8a46aa5/lib/std/array_list.zig
pub usingnamespace @cImport({ @cDefine("CGLM_FORCE_DEPTH_ZERO_TO_ONE", ""); @cInclude("cglm/cglm.h"); @cInclude("cglm/call.h"); });
https://raw.githubusercontent.com/treemcgee42/r4-engine/3f503075e591ea2831a603dbf02a4f83a25f8eed/src/c/cglm.zig
const std = @import("std"); const testing = std.testing; const Allocator = std.mem.Allocator; const mem = @import("std").mem; pub const Writer = struct { memory: []u8, capacity: usize, allocator: Allocator, isFixed: bool, pub fn Alloc(self: *Writer, len: usize) Allocator.Error!u32 { var of...
https://raw.githubusercontent.com/inkeliz/karmem/8949d1b5e1fd945f69aa2ab860df27277f64e32c/zig/karmem.zig
const serial = @import("./drivers/serial.zig"); var GDT: [5]GDTEntry = [_]GDTEntry{ GDTEntry{}, GDTEntry{ .access_byte = .{ .present = true, .executable = true, .read_write = true, .typebit = TypeBit.CODE_DATA }, .flags = .{ .granularity = true, .long = true } }, GDTEntry{ .access_byte = .{ .present = true...
https://raw.githubusercontent.com/Rheydskey/zros/2dd07b403ed9a09359e679c19bb4504b5fbd2338/src/gdt.zig
const print = std.debug.print; const std = @import("std"); pub fn main() !void { var u: u8 = undefined; //XXX: if this becomes 'var' then no error below: var w: u8 = u + 1; // undef-tst.zig:7:17: error: use of undefined value here causes undefined behavior //var x: u8 = undefined / 1; //var xx:Undefine...
https://raw.githubusercontent.com/correabuscar/sandbox/21c51381071ed27b36b15d9e9d701f15cde8f101/zig/zigbyexample/undef/undef-tst.zig
const std = @import("std"); const t = @import("../../types.zig"); const vk = @import("vulkan"); const zwin = @import("zwin"); const Allocator = @import("../../allocator.zig"); const Ctx = @import("Context.zig"); pub const Swapchain = struct { pub const PresentState = enum { optimal, suboptimal, ...
https://raw.githubusercontent.com/IridescenceTech/Aether-Platform/f94978e25bc2e532bdf616e06ac621705c96812b/src/graphics/Vulkan/Swapchain.zig
const std = @import("std"); const Game = @import("../../../../game.zig").Game; const ReadPacketBuffer = @import("../../../../network/packet/ReadPacketBuffer.zig"); network_id: i32, head_yaw: u8, comptime handle_on_network_thread: bool = false, pub fn decode(buffer: *ReadPacketBuffer, allocator: std.mem.Allocator) !@...
https://raw.githubusercontent.com/InspectorBoat/zig-client/7b64ee2143cd171b6e38b8679b886849d42fa953/main/network/packet/s2c/play/EntityHeadAnglesS2CPacket.zig
//! A file-level comment const builtin = @import("builtin"); pub const bindings = struct { pub const console = struct { /// console.log invokes the JS console.log API log: fn (string: String) void, log2: fn (string: []const u8, []const u8) void, }; pub const TextDecoder = struct {...
https://raw.githubusercontent.com/hexops-graveyard/mach-sysjs/c826e0f6c70e3b6db1769c84c1356985bb845ea7/example/sysjs.zig
const std = @import("std"); const bolt = @import("./bolt.zig"); kind: Kind, start: usize, end: usize, pub const Kind = enum(u8) { eof, line_break, hard_line_break, space, nonbreaking_space, text, digits, lower_alpha, upper_alpha, lower_roman, upper_roman, escape, ...
https://raw.githubusercontent.com/leroycep/djot.zig/6757f2893c3d755fc341c8a18ee6dfb6751df6d5/src/Token.zig
const std = @import("std"); const api = @import("api.zig"); const tile = @import("tiles.zig"); const anime = @import("animation.zig"); const map = @import("map.zig"); const texture = @import("textures.zig"); const key = @import("keybindings.zig"); const options = @import("options.zig"); const ecs = @import("ecs.zig"); ...
https://raw.githubusercontent.com/VisenDev/ziggity/7dce0f51e093f2f9f352697b3d659be51672098d/src/inventory.zig
pub const vulkan = @import("vulkan"); pub const l0vk = @import("./vulkan.zig"); pub const VkImage = vulkan.VkImage; pub const VkFormat = enum(c_uint) { undefined = 0, r4g4_unorm_pack8 = 1, r4g4b4a4_unorm_pack16 = 2, b4g4r4a4_unorm_pack16 = 3, r5g6b5_unorm_pack16 = 4, b5g6r5_unorm_pack16 = 5...
https://raw.githubusercontent.com/treemcgee42/r4-engine/3f503075e591ea2831a603dbf02a4f83a25f8eed/src/core/renderer/layer0/vulkan/image.zig
const std = @import("std"); const Alloc = std.mem.Allocator; const ArrayList = std.ArrayList; const HashMap = std.HashMap; const ArrayHashMap = std.ArrayHashMap; const StringHashMap = std.StringHashMap; const string = @import("string.zig"); const String = string.String; const Str = string.Str; /// A type such as `Int`...
https://raw.githubusercontent.com/MarcelGarus/martinaise/6394308d7853402e7a568d87fe1829c8a3fb948f/compiler/0/src/ty.zig
const std = @import("std"); const builtin = @import("builtin"); const IsWasm = builtin.target.isWasm(); const stdx = @import("stdx"); const Mat4 = stdx.math.Mat4; const Mat3 = stdx.math.Mat3; const Vec3 = stdx.math.Vec3; const gl = @import("gl"); const GLtextureId = gl.GLuint; const graphics = @import("../../graphics....
https://raw.githubusercontent.com/fubark/cosmic/15f85e4bf5c6618c237d6f11f540717f7df16eb6/graphics/src/backend/gl/renderer.zig
//! Another World compresses hundreds of game resources (audio, bitmaps, bytecode polygon data) //! into a set of BANK01-BANK0D data files. To keep track of where each resource lives, //! the game defines _resource descriptors_ in a file named MEMLIST.BIN. //! //! This file defines the structure of these resource descr...
https://raw.githubusercontent.com/alunbestor/AZiggierWorld/05b059051ef8ec16918d25477b1cf85aa04f5685/src/lib/resources/resource_descriptor.zig
const print = @import("std").debug.print; const expect = @import("std").testing.expect; const std = @import("std"); const token = @import("token.zig"); // Types const Token = token.Token; const TokenMap = token.TokenMap; const TokenRange = struct { start: u8, end: u8 }; pub const Lexer = struct { // allocator ...
https://raw.githubusercontent.com/heldrida/interpreter-in-zig/1e5fb2be9135ce2854865ef2896723c90105dd8c/src/lexer.zig
// SPDX-License-Identifier: MIT // Copyright (c) 2015-2021 Zig Contributors // This file is part of [zig](https://ziglang.org/), which is MIT licensed. // The MIT license requires this copyright notice to be included in all copies // and substantial portions of the software. const std = @import("std.zig"); const builti...
https://raw.githubusercontent.com/collinalexbell/all-the-compilers/7f834984f71054806bfec8604e02e86b99c0f831/zig/lib/std/meta.zig
const std = @import("std"); const builtin = @import("builtin"); const ac = @import("lib.zig"); const ascii = std.ascii; const Allocator = std.mem.Allocator; const StringHashMap = std.StringHashMap; // Takes an input and provides an iterator over normalized word. Every // result includes the word and the word_index. ...
https://raw.githubusercontent.com/goblgobl/autocomplete/3d55d5b4d63df2901b28eb32ac656288be3ed516/src/input.zig
// // Now that we have optional types, we can apply them to structs. // The last time we checked in with our elephants, we had to link // all three of them together in a "circle" so that the last tail // linked to the first elephant. This is because we had NO CONCEPT // of a tail that didn't point to another elephant! ...
https://raw.githubusercontent.com/egonik-unlp/Ziglings---egonik-unlp/1d7e89127f1f905d49e5c2c5e176f17a0fdce7e2/exercises/046_optionals2.zig
const Builder = @import("std").build.Builder; pub fn build(b: *Builder) void { const test_debug = b.addTest("test/des_test.zig"); test_debug.addPackagePath("zig-crypto", "zig_crypto.zig"); b.step("test_debug", "Run all tests in debug mode").dependOn(&test_debug.step); const test_release_fast = b.addTe...
https://raw.githubusercontent.com/schmee/zig-crypto/951fa4ef3c3e655fcd41760ada97d83c9b3cb2a5/build.zig
const builtin = @import("builtin"); const std = @import("std"); const Env = @import("Env.zig"); const Eval = @import("Eval.zig"); const PROMPT = "lisp-zig> "; const DELIMITER = if (builtin.os.tag == .windows) '\r' else '\n'; pub fn start(allocator: std.mem.Allocator, stdin: anytype, stdout: anytype) !void { var ...
https://raw.githubusercontent.com/doccaico/lisp-zig/2601d2ee953584c31d3508c2bfb57c8579905b5f/src/Repl.zig
const std = @import("std"); const vmath = @import("vectormath.zig"); const platform = @import("platform.zig"); pub const Gl = @import("opengl_bindings"); pub usingnamespace Gl; pub const c = @cImport({ if (platform.IS_WEB) { @cDefine("PLATFORM_WEB", "1"); } else { @cDefine("PLATFORM_DES...
https://raw.githubusercontent.com/perky/ZigGraphics/f89b92f1a893c4df62d9287f376f53c8ea3cc9d1/src/opengl.zig
const std = @import("std"); const Map = @import("./map.zig").Map; pub fn main() anyerror!void { var map = Map.init(); defer map.deinit(); const inp = std.io.getStdIn().reader(); var buf: [10240]u8 = undefined; while (try inp.readUntilDelimiterOrEof(&buf, '\n')) |line| { try map.process_lin...
https://raw.githubusercontent.com/gonzus/AdventOfCode/7e972b92a23db29461b2869713a3251998af5822/2021/p09/p09a.zig
const std = @import("std"); const t = @import("../../types.zig"); const vk = @import("vulkan"); const zwin = @import("zwin"); const Allocator = @import("../../allocator.zig"); const Ctx = @import("Context.zig"); const Pipeline = @import("Pipeline.zig"); const shaders = @import("shaders"); const Buffer = @import("Buffer...
https://raw.githubusercontent.com/IridescenceTech/Aether-Platform/f94978e25bc2e532bdf616e06ac621705c96812b/src/graphics/Vulkan/Mesh.zig
const std = @import("std"); const testing = std.testing; const print = std.debug.print; pub fn hasPiece(buf: []const u8, index: u32) bool { const byte_index = index / 8; const offset: u3 = @truncate(index % 8); if (byte_index < 0 or byte_index >= buf.len) { return false; } return buf[byte...
https://raw.githubusercontent.com/duyquang6/zigtor/30984dd24ed912e09c90607438116430b0c8a17c/src/bitfield.zig
const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; const maxInt = std.math.maxInt; // Returns whether x has a normalized representation (i.e. integer part of mantissa is 1). pub fn isNormal(x: anytype) bool { const T = @TypeOf(x); switch (T) { f16 => { ...
https://raw.githubusercontent.com/natanalt/zig-x86_16/1b38fc3ef5e539047c76604ffe71b81e246f1a1e/lib/std/math/isnormal.zig
// // When Andrew Kelley announced the idea of a new programming language // - namely Zig - in his blog on February 8, 2016, he also immediately // stated his ambitious goal: to replace the C language! // // In order to be able to achieve this goal at all, Zig should be // as compatible as possible with its "predecesso...
https://raw.githubusercontent.com/smn-1/ziglings-smn/b4a446d4317748bd4d01c7b35e857928275fe33e/exercises/093_hello_c.zig