code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const allocator = std.heap.page_allocator; const Map = @import("./map.zig").Map; pub fn main() !void { var maps: [4]Map = undefined; var j: usize = 0; while (j < 4) : (j += 1) { maps[j] = Map.init(); } var r: usize = 0; var first: []const u8 = undefined; ...
2019/p18/p18b.zig
const std = @import("std"); const assert = std.debug.assert; /// Provides FIFO (First-In First-Out) queue. `push` and `pop` are O(1) amortized. pub fn ArrayDeque(comptime T: type) type { return struct { alloc: *std.mem.Allocator, buffer: []T, head: usize, tail: usize, pub f...
src/array_deque.zig
const length_shift = 22; const offset_mask = (1 << length_shift) - 1; // 4_194_303 const literal_type = 0 << 30; // 0 pub const match_type = 1 << 30; // 1_073_741_824 // The length code for length X (MIN_MATCH_LENGTH <= X <= MAX_MATCH_LENGTH) // is length_codes[length - MIN_MATCH_LENGTH] var length_codes = [_]u32{ ...
lib/std/compress/deflate/token.zig
pub const TestCase = struct{ start_line: u32, end_line: u32, example: u32, sec: []const u8, html: []const u8, markdown: []const u8, }; pub const all_cases = []TestCase{ TestCase{ .example = 1, .sec = "Tabs", .html = "<pre><code>foo\tbaz\t\tbim\n</code></pre>\n", ...
src/markdown/test_suite.zig
const Self = @This(); const std = @import("std"); const wlr = @import("wlroots"); const wayland = @import("wayland"); const wl = wayland.server.wl; const zriver = wayland.server.zriver; const server = &@import("main.zig").server; const util = @import("util.zig"); const Output = @import("Output.zig"); const OutputSt...
source/river-0.1.0/river/StatusManager.zig
const std = @import("std"); const builtin = std.builtin; const log = std.log.scoped(.archive); const macho = std.macho; const mem = std.mem; const native_endian = builtin.target.cpu.arch.endian(); const Arch = std.Target.Cpu.Arch; pub fn decodeArch(cputype: macho.cpu_type_t, comptime logError: bool) !std.Target.Cpu.A...
src/link/MachO/fat.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day02.txt"); const MoveCommand = union(enum) { up_down: i32, forward: i32, }; fn followCommandsPt1(commands: []const MoveCommand) util.Point(i32) { var point = util.Point(i32){}; for (commands) |command| {...
src/day02.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const testing = std.testing; const expect = testing.expect; /// An interface for std.process.args which works like C's argc/argv. It just /// builds upfront an slice containing all of the arguments so that they can be /// accessed directly. pub const Arg...
src/args.zig
usingnamespace @import("root").preamble; /// Semaphore waiting queue node const WaitingNode = struct { /// Number of resources thread is waiting for count: usize = undefined, /// Task waiting to be waken up task: *os.thread.Task = undefined, /// Queue hook queue_hook: lib.containers.queue.Node ...
subprojects/flork/src/thread/semaphore.zig
const std = @import("std"); const util = @import("util.zig"); const Allocator = std.mem.Allocator; const testing = std.testing; const Error = util.Error; /// Xor8 is the recommended default, no more than a 0.3% false-positive probability. /// /// See `Xor` for more details. pub const Xor8 = Xor(u8); /// Xor16 provide...
src/xorfilter.zig
//-------------------------------------------------------------------------------- // Section: Types (14) //-------------------------------------------------------------------------------- const CLSID_FhConfigMgr_Value = @import("../zig.zig").Guid.initString("ed43bb3c-09e9-498a-9df6-2177244c6db4"); pub const CLSID_FhC...
deps/zigwin32/win32/storage/file_history.zig
const gllparser = @import("../gllparser/gllparser.zig"); const Error = gllparser.Error; const Parser = gllparser.Parser; const ParserContext = gllparser.Context; const Result = gllparser.Result; const NodeName = gllparser.NodeName; const ResultStream = gllparser.ResultStream; const PosKey = gllparser.PosKey; const Pars...
src/combn/combinator/repeated_ambiguous.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const glfw = @import("glfw"); const gpu = @import("gpu"); const zgpu = @import("zgpu"); const c = zgpu.cimgui; const zm = @import("zmath"); const zmesh = @import("zmesh"); const wgsl = @import("physically_based_rendering_wgsl.zig"); co...
samples/physically_based_rendering_wgpu/src/physically_based_rendering_wgpu.zig
const std = @import("std"); const assert = std.debug.assert; const LLVMBool = bool; pub const LLVMAttributeIndex = c_uint; pub const ValueRef = opaque { pub const addAttributeAtIndex = LLVMAddAttributeAtIndex; extern fn LLVMAddAttributeAtIndex(*const ValueRef, Idx: LLVMAttributeIndex, A: *const AttributeRef)...
src/llvm_bindings.zig
const std = @import("std"); const root = @import("root"); /// Queues a build job for the C code of Wasm3. /// This builds a static library that depends on libc, so make sure to link that into your exe! pub fn compile(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget, wasm3_src_root: []const u8...
submod_build_plugin.zig
const std = @import("std"); pub const Token = struct { tag: Tag, loc: Loc, pub const Loc = struct { start: usize, end: usize, }; pub const keywords = std.ComptimeStringMap(Tag, .{ .{ "and", .insn_and }, .{ "add", .insn_add }, .{ "lda", .insn_lda }, ...
src/lexer.zig
const std = @import("std"); const ast = @import("ast.zig"); const DFS = @import("utils.zig").DepthFirstIterator; const log = std.log; pub const Language = enum { Unknown = 0, Python, R, Julia, C, Cpp, pub inline fn match(language_name: []const u8) Language { var result: Language = ...
src/code_chunks.zig
const sf = @import("../sfml.zig"); pub const SoundBuffer = struct { const Self = @This(); // Constructor/destructor /// Loads music from a file pub fn initFromFile(path: [:0]const u8) !Self { var sound = sf.c.sfSoundBuffer_createFromFile(path); if (sound == null) return sf...
src/sfml/audio/sound_buffer.zig
const std = @import("std"); const pkgs = struct { const tvg = std.build.Pkg{ .name = "tvg", .path = "src/lib/tvg.zig", }; const args = std.build.Pkg{ .name = "args", .path = "lib/zig-args/args.zig", }; }; pub fn build(b: *std.build.Builder) !void { const target = b....
build.zig
const std = @import("std"); const tracy = @import("tracy"); const Tree = @import("fetch-rewards-be-coding-exercise").transaction_tree.Tree; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = &gpa.allocator; const t = tracy.trace(@src()); ...
benchmark/insert_random_check_balance.zig
export fn mission0_main() noreturn { Bss.prepare(); Exceptions.prepare(); Mission.prepare(); Uart.prepare(); Timer0.prepare(); Timer1.prepare(); Timer2.prepare(); LedMatrix.prepare(); CycleActivity.prepare(); KeyboardActivity.prepare(); StatusActivity.prepare(); Mission...
mission0_mission_selector.zig
const std = @import("std"); const string = []const u8; const range = @import("range").range; const flag = @import("flag"); const linters = [_]fn (std.mem.Allocator, []const u8, *Source, std.fs.File.Writer) WorkError!void{ @import("./tools/dupe_import.zig").work, @import("./tools/todo.zig").work, @import("....
src/main.zig
const std = @import("std"); const pike = @import("pike"); const sync = @import("sync.zig"); const os = std.os; const net = std.net; const mem = std.mem; const meta = std.meta; const testing = std.testing; usingnamespace @import("socket.zig"); pub fn Client(comptime opts: Options) type { return struct { c...
client.zig
const std = @import("std"); const gen3 = @import("../gen3.zig"); const rom = @import("../rom.zig"); const script = @import("../script.zig"); const mem = std.mem; const lu16 = rom.int.lu16; const lu32 = rom.int.lu32; pub const CommandDecoder = script.CommandDecoder(Command, struct { fn isEnd(cmd: Command) bool {...
src/core/gen3/script.zig
const std = @import("std"); const use_test_input = false; const filename = if (use_test_input) "day-11_test-input" else "day-11_real-input"; const edge_length = 10; pub fn main() !void { std.debug.print("--- Day 11 ---\n", .{}); var file = try std.fs.cwd().openFile(filename, .{}); defer file.close(); ...
day-11.zig
pub const MDM_REGISTRATION_FACILITY_CODE = @as(u32, 25); pub const DEVICE_ENROLLER_FACILITY_CODE = @as(u32, 24); pub const MREGISTER_E_DEVICE_MESSAGE_FORMAT_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2145845247)); pub const MENROLL_E_DEVICE_MESSAGE_FORMAT_ERROR = @import("../zig.zig").typedConst(HRESUL...
deps/zigwin32/win32/management/mobile_device_management_registration.zig
const std = @import("std"); const json = std.json; const mem = std.mem; const Allocator = mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const dict_module = @import("dict.zig"); const DictArrayUnmanaged = dict_module.DictArrayUnmanaged; const ArrayListUnmanaged = std.ArrayListUnmanaged; const logger = s...
src/notes.zig
const std = @import("std"); const ir = @import("ir.zig"); const trace = @import("tracy.zig").trace; /// Perform Liveness Analysis over the `Body`. Each `Inst` will have its `deaths` field populated. pub fn analyze( /// Used for temporary storage during the analysis. gpa: *std.mem.Allocator, /// Used to tac...
src-self-hosted/liveness.zig
const Output = @This(); const std = @import("std"); const log = std.log; const math = std.math; const mem = std.mem; const os = std.os; const wayland = @import("wayland"); const wl = wayland.client.wl; const wp = wayland.client.wp; const ext = wayland.client.ext; const Lock = @import("Lock.zig"); const gpa = std.he...
src/Output.zig
const std = @import("std"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } fn matches(line: []const u8, pattern: []const u8, sep: []const u8) ?[2]u32 { if (line.len < pattern.len) return ...
2016/day8.zig
const std = @import("std"); const tvg = @import("tvg.zig"); fn JoinLength(comptime T: type) comptime_int { const info = @typeInfo(T); var len: usize = 0; inline for (info.Struct.fields) |fld| { len += @typeInfo(fld.field_type).Array.len; } return len; } fn join(list: anytype) [JoinLength...
src/lib/builder.zig
pub const HeaderType = enum { Accept, AcceptCharset, AcceptEncoding, AcceptLanguage, AcceptRanges, AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowMethods, AccessControlAllowOrigin, AccessControlExposeHeaders, AccessControlMaxAge, AccessControl...
src/headers/name.zig
const std = @import("std"); const logger = std.log.scoped(.day02); const real_data = @embedFile("../data/day02.txt"); pub fn main() !void { logger.info("Part one: {}", .{partOne(real_data)}); logger.info("Part two: {}", .{partTwo(real_data)}); } fn partOne(data: []const u8) !u64 { var lines = std.mem.tok...
src/day02.zig
const std = @import("std"); usingnamespace @import("zalgebra"); const gl = @import("c.zig").gl; const c_allocator = std.heap.c_allocator; const panic = std.debug.panic; pub const Shader = struct { name: []const u8, program_id: u32, vertex_id: u32, fragment_id: u32, geometry_id: ?u32, pub fn c...
demo/common/shader.zig
const std = @import("std"); const Arena = std.heap.ArenaAllocator; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const yeti = @import("yeti"); const initCodebase = yeti.initCodebase; const MockFileSystem = yeti.FileSystem; const components = yeti.components; co...
src/tests/test_uniform_function_call_syntax.zig
const c = @cImport({ @cInclude("cfl_image.h"); }); pub const Image = struct { inner: ?*c.Fl_Image, pub fn scale(self: *Image, width: i32, height: i32, proportional: bool, can_expand: bool) void { c.Fl_Image_scale(self.inner, width, height, @boolToInt(proportional), @boolToInt(can_expand)); } ...
src/image.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const command = @import("command.zig"); const help = @import("./help.zig"); const argp = @import("./arg.zig"); const iterators = @import("./iterators.zig"); pub const ParseResult = struct { action: command.Action, args: []const []const u8, }; p...
src/parser.zig
const std = @import("std"); const builtin = @import("builtin"); const IsWasm = builtin.target.isWasm(); const stdx = @import("stdx"); const fatal = stdx.fatal; const platform = @import("platform"); const graphics = @import("graphics"); const Color = graphics.Color; const ui = @import("ui"); const Row = ui.widgets.Row; ...
ui/examples/3d.zig
const std = @import("std"); const os = std.os; const mem = std.mem; const elf = std.elf; const math = std.math; const assert = std.debug.assert; const native_arch = std.Target.current.cpu.arch; // This file implements the two TLS variants [1] used by ELF-based systems. // // The variant I has the following layout in m...
lib/std/os/linux/tls.zig
const std = @import("std"); const math = std.math; const mem = std.mem; const assert = std.debug.assert; const Allocator = std.mem.Allocator; const Air = @import("Air.zig"); const Type = @import("type.zig").Type; const Module = @import("Module.zig"); const expect = std.testing.expect; const expectEqual = std.testing.ex...
src/register_manager.zig
const std = @import("std.zig"); fn ok(comptime s: []const u8) void { std.testing.expect(std.json.validate(s)); } fn err(comptime s: []const u8) void { std.testing.expect(!std.json.validate(s)); } fn any(comptime s: []const u8) void { std.testing.expect(true); } /////////////////////////////////////////...
std/json_test.zig
const std = @import("std"); const random = std.crypto.random; const Stack = std.ArrayList(u16); /// This is the default font found on Tobias' guide. const default_font = [_]u8 { 0xF0, 0x90, 0x90, 0x90, 0xF0, // 0 0x20, 0x60, 0x20, 0x20, 0x70, // 1 0xF0, 0x10, 0xF0, 0x80, 0xF0, // 2 0xF0, 0x10, 0xF0, 0x...
src/lib/chipz.zig
const BlendOperation = @import("enums.zig").BlendOperation; const BlendFactor = @import("enums.zig").BlendFactor; const CompareFunction = @import("enums.zig").CompareFunction; const StencilOperation = @import("enums.zig").StencilOperation; const VertexFormat = @import("enums.zig").VertexFormat; const VertexStepMode = ...
gpu/src/data.zig
const std = @import("std"); const testing = std.testing; const expect = testing.expect; //; fn assertIsNumberType(comptime T: type) void { const type_info = @typeInfo(T); std.debug.assert(type_info == .Float or type_info == .Int); } pub fn TVec2(comptime T: type) type { return extern struct { com...
src/math.zig
const std = @import("std"); const fs = std.fs; const ArrayList = std.ArrayList; const ArrayListSentineled = std.ArrayListSentineled; const allocPrint0 = std.fmt.allocPrint0; const err = @import("error.zig"); const errorAt = err.errorAt; const setTargetString = err.setTargetString; const setTargetFilename = err.setTarge...
src/tokenize.zig
const IntOrFloat = @import("types.zig").IntOrFloat; pub const PostscriptWindowsCharacterSet = enum(u32) { Ansi = 1, Default = 2, Symbol = 3, Macintosh = 4, ShiftJis = 5, Hangul = 6, HangulJohab = 7, Gb2312 = 8, ChineseBig5 = 9, Greek = 10, Turkish = 11, Vietnamese = 12,...
src/font_info.zig
const addv = @import("addo.zig"); const testing = @import("std").testing; fn test__addosi4(a: i32, b: i32) !void { var result_ov: c_int = undefined; var expected_ov: c_int = undefined; var result = addv.__addosi4(a, b, &result_ov); var expected: i32 = simple_addosi4(a, b, &expected_ov); try testing...
lib/std/special/compiler_rt/addosi4_test.zig
const std = @import("std"); const __truncsfhf2 = @import("truncXfYf2.zig").__truncsfhf2; fn test__truncsfhf2(a: u32, expected: u16) !void { const actual = @bitCast(u16, __truncsfhf2(@bitCast(f32, a))); if (actual == expected) { return; } return error.TestFailure; } test "truncsfhf2" { tr...
lib/std/special/compiler_rt/truncXfYf2_test.zig
const std = @import("../std.zig"); const builtin = @import("builtin"); const maxInt = std.math.maxInt; const iovec = std.os.iovec; const iovec_const = std.os.iovec_const; extern "c" fn _errnop() *c_int; pub const _errno = _errnop; pub extern "c" fn find_directory(which: c_int, volume: i32, createIt: bool, path_ptr: ...
lib/std/c/haiku.zig
const CodeSignature = @This(); const std = @import("std"); const assert = std.debug.assert; const fs = std.fs; const log = std.log.scoped(.link); const macho = std.macho; const mem = std.mem; const testing = std.testing; const Allocator = mem.Allocator; const Sha256 = std.crypto.hash.sha2.Sha256; const hash_size: u8 ...
src/link/MachO/CodeSignature.zig
const std = @import("std"); const bits = @import("bits.zig"); const int = @import("int.zig"); const libpoke = @import("pokemon/index.zig"); const math = std.math; const mem = std.mem; const rand = std.rand; const debug = std.debug; const assert = debug.assert; /// A generic enum for different randomization options. ...
src/randomizer.zig
pub const NEUTRAL = 0x00; pub const INVARIANT = 0x7f; pub const AFRIKAANS = 0x36; pub const ALBANIAN = 0x1c; pub const ALSATIAN = 0x84; pub const AMHARIC = 0x5e; pub const ARABIC = 0x01; pub const ARMENIAN = 0x2b; pub const ASSAMESE = 0x4d; pub const AZERI = 0x2c; pub const AZERBAIJANI = 0x2c; pub const BANGLA = 0x45; ...
lib/std/os/windows/lang.zig
const std = @import("std"); const cpu = @import("cpu.zig"); const c = @cImport({ @cInclude("SDL2/SDL.h"); }); const Allocator = std.mem.Allocator; pub const log_level = .info; var screen: [0x4000]u8 = undefined; var running: bool = true; fn readSlice(userdata: usize, addr: usize) u8 { const slice = @intToPtr...
src/main.zig
const std = @import("std"); const Allocator = mem.Allocator; const ArrayList = std.ArrayList; const Token = std.zig.Token; const ast = std.zig.ast; const json = std.json; const mem = std.mem; const parse = std.zig.parse; const testing = std.testing; const warn = std.debug.warn; pub const Span = struct { start: ...
src/outline/outline.zig
const std = @import("std"); usingnamespace @import("imgui"); const colors = @import("../colors.zig"); const ts = @import("../tilescript.zig"); const thickness: f32 = 2; pub fn drawWindow(state: *ts.AppState) void { if (igBegin("Brushes", null, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowF...
tilescript/windows/brushes.zig
const std = @import("std"); const mem = @import("mem.zig"); const vtable = @import("vtable.zig"); const testing = std.testing; const read = @This(); pub fn Reader(comptime E: type) type { return struct { pub const Error = E; const VTable = struct { pub const Impl = @OpaqueType(); ...
src/read.zig
const std = @import("std"); const expect = std.testing.expect; pub const Identifier = []const u8; pub const Valid = struct { identifier: Identifier, fn clone(self: @This()) @This() { return Invalid{ .identifier = self.identifier, }; } }; pub const Invalid = struct { iden...
src/lib.zig
const std = @import("std"); const math = std.math; const zp = @import("../../zplay.zig"); const alg = zp.deps.alg; const Vec3 = alg.Vec3; const Mat4 = alg.Mat4; const Self = @This(); const MoveDirection = enum { forward, backward, left, right, up, down, }; /// up vector of the world world_up: ...
src/graphics/3d/Camera.zig
const std = @import("std"); pub const MethodDescriptor = struct { const Self = @This(); parameters: []const Descriptor, return_type: *const Descriptor, pub fn stringify(self: Self, writer: anytype) anyerror!void { try writer.writeByte('('); for (self.parameters) |param| try param.stri...
src/descriptors.zig
const std = @import("std"); const gl = @import("zgl"); const glfw = @import("glfw"); const nanovg = @import("nanovg"); const v = @import("v.zig"); const World = @import("World.zig"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allo...
main.zig
const std = @import("std"); const ascii = std.ascii; const mem = std.mem; const fs = std.fs; const io = std.io; pub fn main() !void { const allocator = std.heap.page_allocator; const out = try fs.cwd().createFile("status_codes.zig", .{}); defer out.close(); const stdout = out.writer(); const fi...
.gyro/hzzp-truemedian-github.com-91ab8e74/pkg/scripts/generate_status_codes.zig
const std = @import("std"); /// Globally unique entity identifier, usable as a UUIDv4 pub const EntityId = u128; pub const EidHash = struct { // We can use this incredibly fast hash function because our bits are already randomly distributed pub fn hash(_: EidHash, eid: EntityId) u64 { return @truncate...
znt.zig
const std = @import("std"); const c = @import("../c.zig"); const zupnp = @import("../lib.zig"); /// Make an HTTP request and get a response. pub fn request(method: zupnp.web.Method, url: [:0]const u8, client_request: zupnp.web.ClientRequest) !zupnp.web.ClientResponse { const logger = std.log.scoped(.@"zupnp.web.r...
src/web/client.zig
const Tree = @import("Tree.zig"); const TokenIndex = Tree.TokenIndex; const NodeIndex = Tree.NodeIndex; const Parser = @import("Parser.zig"); const Compilation = @import("Compilation.zig"); const Type = @This(); pub const Qualifiers = packed struct { @"const": bool = false, atomic: bool = false, @"volatil...
src/Type.zig
usingnamespace @import("raylib"); const std = @import("std"); const math = std.math; const warn = std.debug.warn; const panic = std.debug.panic; const grid_width: i32 = 10; const grid_height: i32 = 20; const grid_cell_size: i32 = 32; const margin: i32 = 20; const piece_preview_width = grid_cell_size * 5; const screen_...
src/main.zig
const std = @import("std.zig"); const StringHashMap = std.StringHashMap; const mem = std.mem; const Allocator = mem.Allocator; const testing = std.testing; /// BufMap copies keys and values before they go into the map, and /// frees them when they get removed. pub const BufMap = struct { hash_map: BufMapHashMap, ...
lib/std/buf_map.zig
const libpoke = @import("index.zig"); const std = @import("std"); const fun = @import("../../lib/fun-with-zig/src/index.zig"); const mem = std.mem; const debug = std.debug; const generic = fun.generic; const lu16 = fun.platform.lu16; const lu32 = fun.platform.lu32; const lu64 = fun.platform.lu64; pub fn Section(compt...
src/pokemon/gen3-constants.zig
const std = @import("std"); const BitInStream = std.io.BitInStream; const Endian = std.builtin.Endian; const min = std.math.min; const warn = std.debug.warn; const Block = @import("./block.zig").Block; const RawBlock = @import("./block.zig").RawBlock; const HuffmanBlock = @import("./block.zig").HuffmanBlock; const Blo...
src/raw_deflate_reader.zig
const builtin = @import("builtin"); const TypeId = builtin.TypeId; const std = @import("std"); const math = std.math; const assert = std.debug.assert; const warn = std.debug.warn; const misc = @import("modules/zig-misc/index.zig"); const saturateCast = misc.saturateCast; const DBG = false; pub const ColorU8 = Color...
src/color.zig
const std = @import("std"); const os = @import("root").os; /// Allocator used to allocate memory for new tasks const task_alloc = os.memory.vmm.backed(.Ephemeral); /// Load balancer lock. Locked when scheduler finds the best CPU for the task /// or when task terminates var balancer_lock = os.thread.Spinlock{}; /// M...
src/thread/scheduler.zig
const std = @import("std"); const builtin = @import("builtin"); const time = std.os.time; const winmm = @import("audio/backend/winmm.zig"); pub const Backend = enum { Wasapi, Winmm, Null, }; pub const PlayerError = error{}; pub const AudioMode = union(enum) { const Self = @This(); Mono: usize,...
src/audio.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const Allocator = std.mem.Allocator; const mem = std.mem; const HashMap = std.HashMap; const AutoHashMap = std.AutoHashMap; test "TaggedUnion.HashMap" { var direct_allocator = std.heap.DirectAllocator.init(); defer dire...
tagged_union/tagged_union.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const Allocator = std.mem.Allocator; const mem = std.mem; const HashMap = std.HashMap; const AutoHashMap = std.AutoHashMap; test "HashMap.struct" { var direct_allocator = std.heap.DirectAllocator.init(); defer direct_al...
hash_map/hash_map_x.zig
const std = @import("std"); const ConstantPool = @This(); allocator: std.mem.Allocator, entries: std.ArrayListUnmanaged(Entry), utf8_entries_map: std.StringHashMapUnmanaged(u16), pub fn init(allocator: std.mem.Allocator, entry_count: u16) !*ConstantPool { var c = try allocator.create(ConstantPool); c.* = Con...
src/ConstantPool.zig
const std = @import("std"); const cu = @import("cuda_cimports.zig").cu; pub const Attribute = enum(c_uint) { /// Maximum number of threads per block MaxThreadsPerBlock = 1, /// Maximum block dimension X MaxBlockDimX = 2, /// Maximum block dimension Y MaxBlockDimY = 3, /// Maximum block dime...
cudaz/src/attributes.zig
const std = @import("std"); const zp = @import("../../zplay.zig"); const gl = zp.deps.gl; pub const PrimitiveType = enum(c_uint) { points = gl.GL_POINTS, line_strip = gl.GL_LINE_STRIP, line_loop = gl.GL_LINE_LOOP, lines = gl.GL_LINES, line_strip_adjacency = gl.GL_LINE_STRIP_ADJACENCY, lines_adj...
src/graphics/common/drawcall.zig
const Allocator = std.mem.Allocator; const FormatInterface = @import("../format_interface.zig").FormatInterface; const ImageFormat = image.ImageFormat; const ImageReader = image.ImageReader; const ImageInfo = image.ImageInfo; const ImageSeekStream = image.ImageSeekStream; const PixelFormat = @import("../pixel_format.zi...
src/formats/netpbm.zig
const std = @import("std"); const rpc = @import("rpc.zig"); const Server = @import("main.zig").Server; pub const keys = @import("keys.zig"); pub const Key = keys.Key; /// Data sent to Client which represents the data to draw on the screen. pub const DrawData = struct { lines: []const Line, pub const Line = s...
src/kisa.zig
const std = @import("std"); const assert = std.debug.assert; // ----------------------- Public API ------------------------- // ---------------------------- Implementation ----------------------------- const ImageDosHeader = extern struct { signature: u16, cblp: u16, cp: u16, crlc: u16, cparhd...
src/winmd.zig
const std = @import("std"); const Self = @This(); const BIOS_FILE = @embedFile("../gba.bin"); const BIOS_START = 0x00000000; const BIOS_END = 0x00003FFF; const BIOS_SIZE = BIOS_END - BIOS_START + 1; const WRAM_OB_START = 0x02000000; const WRAM_OB_END = 0x0203FFFF; const WRAM_OB_SIZE = WRAM_OB_END - WRAM_OB_START + 1;...
src/Bus.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const config = @import("../config.zig"); const Cluster = @import("cluster.zig").Cluster; const Network = @import("network.zig").Network; const StateMachine = @import("state_machine.zig").StateMachine; const MessagePool = @import("../me...
src/test/state_checker.zig
const std = @import("std"); const ArrayList = std.ArrayList; const SemanticVersion = std.SemanticVersion; const Target = std.Target; const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const process = std.process; const u...
src/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const testing = std.testing; const expectEqual = testing.expectEqual; const ArrayList = std.ArrayList; // https://encoding.spec.whatwg.org/#concept-stream pub fn IoQueue(comptime T: type) type { return struct { allocator: *Allocator, ...
src/io_queue.zig
const std = @import("std.zig"); const assert = std.debug.assert; const testing = std.testing; const mem = std.mem; const math = std.math; const builtin = @import("builtin"); /// Stable in-place sort. O(n) best case, O(pow(n, 2)) worst case. O(1) memory (no allocator required). pub fn insertionSort(comptime T: type, it...
lib/std/sort.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const bog = @import("bog.zig"); const Vm = bog.Vm; const Module = bog.Module; const util = @import("util.zig"); pub const Type = enum(u8) { none = 0, int, num, bool, str, tuple, map, list, err, ran...
src/value.zig
const std = @import("std"); const system = std.os.linux; const ArrayList = std.ArrayList; const Candidate = filter.Candidate; const File = std.fs.File; const filter = @import("filter.zig"); // Select Graphic Rendition (SGR) attributes const Attribute = enum(u8) { RESET = 0, REVERSE = 7, FG_CYAN = 36, ...
src/ui.zig
const builtin = @import("builtin"); const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const rotr = std.math.rotr; // ---------------------------------------------------------------------------- const arm_cmse = @import("../drivers/arm_cmse.zig"); const arm_m = @import("...
src/monitor/shadowexcstack.zig
const graphics = @import("didot-graphics"); const zlm = @import("zlm"); const std = @import("std"); usingnamespace @import("assets.zig"); const Mesh = graphics.Mesh; const Window = graphics.Window; const Material = graphics.Material; const Allocator = std.mem.Allocator; pub const GameObjectArrayList = std.ArrayList(G...
didot-objects/objects.zig
const std = @import("std"); const builtin = @import("builtin"); const panic = std.debug.panic; usingnamespace @import("c.zig"); // settings const SCR_WIDTH: u32 = 1920; const SCR_HEIGHT: u32 = 1080; const vertexShaderSource: [:0]const u8 = \\#version 330 core \\layout (location = 0) in vec3 aPos; \\void ...
src/1_2_hello_triangle.zig
const std = @import("std"); const Process = @import("process.zig").Process; /// Cooperative scheduler for processes. Each process is invoked once per tick. If a process terminates, it's /// removed automatically from the scheduler and it's never invoked again. A process can also have a child. In /// this case, the pro...
src/process/scheduler.zig
const std = @import("std"); const os = std.os; const assert = std.debug.assert; const FIFO = @import("fifo.zig").FIFO; const Time = @import("time.zig").Time; const buffer_limit = @import("io.zig").buffer_limit; pub const IO = struct { kq: os.fd_t, time: Time = .{}, timeouts: FIFO(Completion) = .{}, co...
src/io_darwin.zig
const std = @import("std"); const helper = @import("helper.zig"); const Allocator = std.mem.Allocator; const HashMap = std.AutoHashMap; const ArrayList = std.ArrayList; const input = @embedFile("../inputs/day13.txt"); pub fn run(alloc: Allocator, stdout_: anytype) !void { var parsed = try Input.init(alloc, input)...
src/day13.zig
const std = @import("std"); const fs = std.fs; const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; const CrossTarget = std.zig.CrossTarget; const Mode = std.builtin.Mode; const builtin = @import("builtin"); pub fn build(b: *Builder) void { const target = b.standardTargetOptions(.{}); ...
build.zig
const std = @import("std"); const zs = @import("zstack.zig"); // Puts an upper bound on a game of 49.7 days for 1 ms tick cycle, or 397 days for // a more usual 8ms tick cycle. pub const ReplayInput = packed struct { tick: u32, keys: u32, }; pub const ReplayInputIterator = struct { const Self = @This(); ...
src/replay.zig
const builtin = @import("builtin"); const is_test = builtin.is_test; const low = switch (builtin.endian) { builtin.Endian.Big => 1, builtin.Endian.Little => 0, }; const high = 1 - low; pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem: ?*DoubleInt) DoubleInt { @setRuntimeSafet...
lib/std/special/compiler_rt/udivmod.zig
const std = @import("std"); const warn = std.debug.warn; const pf = @import("parse-float.zig"); const c = @cImport({ @cInclude("lzma_header.h"); @cInclude("easylzma/simple.h"); }); // Taken from std/debug/leb128.zig fn readULEB128(comptime T: type, in_stream: var) !T { const ShiftT = std.meta.IntType(fal...
src/osureplay.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "AHCI", .filter = .info, }).write; const memory = os.memory; const thread = os.thread; const platform = os.platform; const bf = lib.util.bitfields; const libalign = lib.util.libalign; const abar_size = 0x1100; const port_...
subprojects/flork/src/drivers/block/ahci.zig
const std = @import("std"); const engine = @import("kiragine"); usingnamespace engine.kira.log; const gl = engine.kira.gl; const c = engine.kira.c; const windowWidth = 1024; const windowHeight = 768; const title = "Textures"; const targetfps = 60; var texture: engine.Texture = undefined; const rect: engine.Rectangl...
src/tests/atlaspacker.zig
const std = @import("../std.zig"); const io = std.io; /// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as /// well as files. /// For memory sources, if the supplied byte buffer is const, then `io.Writer` is not available. /// The error set of the stream functions is the error set of...
lib/std/io/stream_source.zig
const std = @import("std"); const c = @import("internal/c.zig"); const internal = @import("internal/internal.zig"); const log = std.log.scoped(.git); const git = @import("git.zig"); pub const Transaction = opaque { /// Free the resources allocated by this transaction /// /// If any references remain locke...
src/transaction.zig