code
stringlengths
38
801k
repo_path
stringlengths
6
263
const magic = 0xeb9f; const version = 1; pub const ext = @import("btf_ext.zig"); /// All offsets are in bytes relative to the end of this header pub const Header = packed struct { magic: u16, version: u8, flags: u8, hdr_len: u32, /// offset of type section type_off: u32, /// length of ty...
lib/std/os/linux/bpf/btf.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const c = @import("../c.zig"); const zupnp = @import("../lib.zig"); const request = @import("request.zig"); const Server = @This(); const logger = std.log.scoped(.@"zupnp.web.Server"); arena: ArenaAllocato...
src/web/server.zig
const std = @import("../index.zig"); const builtin = @import("builtin"); const assert = std.debug.assert; const event = std.event; const mem = std.mem; const posix = std.os.posix; const windows = std.os.windows; const Loop = std.event.Loop; pub const Server = struct { handleRequestFn: async<*mem.Allocator> fn (*Se...
std/event/tcp.zig
const std = @import("std"); const tls = @import("iguanaTLS"); const network = @import("network"); pub const Backend = enum { network, std, experimental, }; const backend: Backend = std.meta.globalOption("zfetch_backend", Backend) orelse .network; const Socket = switch (backend) { .network => network...
src/connection.zig
const std = @import("std"); const os = std.os; const mem = std.mem; const elf = std.elf; const builtin = @import("builtin"); const assert = std.debug.assert; // This file implements the two TLS variants [1] used by ELF-based systems. // // The variant I has the following layout in memory: // --------------------------...
lib/std/os/linux/tls.zig
const std = @import("std"); const Builder = std.build.Builder; const glfw = @import("libs/mach-glfw/build.zig"); const system_sdk = @import("libs/mach-glfw/system_sdk.zig"); pub fn build(b: *Builder) void { const mode = b.standardReleaseOptions(); const target = b.standardTargetOptions(.{}); const options...
gpu-dawn/build.zig
const utils = @import("utils.zig"); const std = @import("std"); const math = std.math; const mem = std.mem; const isApproxEq = utils.isApproxEq; const isAnyNan = utils.isAnyNan; const expect = std.testing.expect; const assert = std.debug.assert; const panic = std.debug.panic; pub const Vec2 = extern struct { pub...
src/algebra.zig
const print = @import("std").debug.print; // This struct is the model of a model boat. We can transform it // to any scale we would like: 1:2 is half-size, 1:32 is // thirty-two times smaller than the real thing, and so forth. const Schooner = struct { name: []const u8, scale: u32 = 1, hull_length: u32 = 1...
exercises/068_comptime3.zig
const std = @import("std"); const clap = @import("clap"); const assert = std.debug.assert; pub const Param = struct { pub const Repository = struct {}; pub const Directory = struct {}; pub const Package = struct {}; pub const AnyFile = struct {}; pub const File = struct {}; short_name: ?u8 = ...
src/completion.zig
pub const MIXERCONTROL_CONTROLTYPE_CUSTOM = @as(u32, 0); pub const MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = @as(u32, 268500992); pub const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = @as(u32, 268566528); pub const MIXERCONTROL_CONTROLTYPE_PEAKMETER = @as(u32, 268566529); pub const MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = @as...
win32/media/audio.zig
const std = @import("std"); const Image = @This(); const colormap_len = 0x100; width: u32, height: u32, pixels: []u8, colormap: ?[]u8 = null, allocator: *std.mem.Allocator, pub fn initFromFile(allocator: *std.mem.Allocator, file_path: []const u8) !Image { var image_width: u32 = undefined; var image_height: ...
src/Image.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const gui = @import("gui"); const nvg = @import("nanovg"); const Rect = @import("gui/geometry.zig").Rect; const Point = @import("gui/geometry.zig").Point; const ColorForegroundBackgroundWidget = @This(); pub const ColorType = enum { foreground, ...
src/ColorForegroundBackgroundWidget.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); fn sum1(mem: []const u8, node_idx: usize) struct { sum: usize, size: usize } { const child_count = mem[node_idx + 0]; const data_count = mem[node_idx + 1]; var sum: usize = 0; var idx = node_idx + 2; var c...
2018/day08.zig
const std = @import("std"); const debug = std.debug; const assert = debug.assert; const assertError = debug.assertError; const warn = debug.warn; /// Array of u1, typically for maximum performance min_num_bits == 2^n in size pub fn ArrayU1(comptime min_num_bits: usize) type { const UsizeIdx = switch (@sizeOf(usize...
array-u1.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; pub fn main() !void { var allocator = &std.heap.DirectAllocator.init().allocator; const result1 = try step_dependency_order(allocator, dependency_hierarchy); defer allocator.free(result1); debug.warn("07-1: {}\n", result1); ...
2018/day_07.zig
const std = @import("std"); const mem = @import("std").mem; const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; pub const gpa = &...
src/util.zig
pub const IOCTL_MTP_CUSTOM_COMMAND = @as(u32, 827348045); pub const MTP_NEXTPHASE_READ_DATA = @as(u32, 1); pub const MTP_NEXTPHASE_WRITE_DATA = @as(u32, 2); pub const MTP_NEXTPHASE_NO_DATA = @as(u32, 3); pub const RSA_KEY_LEN = @as(u32, 64); pub const SAC_SESSION_KEYLEN = @as(u32, 8); pub const SAC_PROTOCOL_WMDM = @as(...
win32/media/device_manager.zig
const std = @import("std"); const print = @import("std").debug.print; const web = @import("zhp"); const Datetime = web.datetime.Datetime; const status = @import("handlers/status.zig"); const info = @import("handlers/info.zig"); const threads = @import("threads.zig"); const recording = @import("recording.zig"); pub ...
src/handlers.zig
const std = @import("std"); const print = @import("std").debug.print; const led_driver = @import("led_driver.zig"); const gnss = @import("gnss.zig"); const config = @import("config.zig"); const recording = @import("recording.zig"); const exif = @import("exif.zig"); const web = @import("zhp"); pub const GnssContext ...
src/threads.zig
const std = @import("std"); const vec4 = std.meta.Vector(4, f64); fn vec1to4(f: f64) vec4 { return @splat(4, f); } fn runInParallel(tasks: []std.Thread, len: usize, comptime f: anytype, args: anytype) !void { const len_per_task = @divTrunc(len, tasks.len + 1); for (tasks) |*task, i| { const first ...
bench/algorithm/spectral-norm/2-m.zig
const builtin = @import("builtin"); const expect = @import("std").testing.expect; test "@mulAdd" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZi...
test/behavior/muladd.zig
const builtin = @import("builtin"); const std = @import("std.zig"); const math = std.math; const debug = std.debug; const assert = std.debug.assert; const testing = std.testing; /// There is a trade off of how quickly to fill a bloom filter; /// the number of items is: /// n_items / K * ln(2) /// the rate of false...
lib/std/bloom_filter.zig
const clap = @import("clap"); const datetime = @import("datetime"); const folders = @import("known_folders"); const std = @import("std"); const anime = @import("anime.zig"); const base64 = std.base64; const fs = std.fs; const heap = std.heap; const io = std.io; const json = std.json; const math = std.math; const mem ...
src/main.zig
const std = @import("std"); const warn = std.debug.warn; const assert = std.debug.assert; const File = std.fs.File; const files = @import("../Files.zig"); const loadFile = files.loadFile; pub const c = @cImport({ @cInclude("stb_image.h"); }); fn save(path: []const u8, w: u32, h: u32, data: []const u8) !void { ...
src/RGB10A2/RGB10A2.zig
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...
build.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const nvg = @import("nanovg"); const gui = @import("../gui.zig"); const Point = @import("../geometry.zig").Point; const Rect = @import("../geometry.zig").Rect; const Button = @This(); pub const ButtonStyle = enum(u8) { default, toolbar, }; wid...
src/gui/widgets/Button.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const _value = @import("./value.zig"); const _chunk = @import("./chunk.zig"); const _disassembler = @import("./disassembler.zig"); const _obj = @import("./obj.zig"); const Allocator = std.mem.Allocator; const Config = @impo...
src/vm.zig
const std = @import("std"); const builtin = @import("builtin"); const log = std.log.scoped(.OpenGL); pub const GLenum = c_uint; pub const GLboolean = u8; pub const GLbitfield = c_uint; pub const GLbyte = i8; pub const GLubyte = u8; pub const GLshort = i16; pub const GLushort = u16; pub const GLint = c_int; pub const ...
modules/graphics/vendored/zig-opengl-exports/gl_4v4.zig
const std = @import("std"); const swizzles = @import("swizzle.zig"); /// Returns a zero-size namespace struct defining vector operations for /// given size `N` (min: 1) and component type `C` (any integer or float). /// The actual vector type used for these operations is the built-in /// `std.meta.Vector` aka SIMD-opt...
src/vec-simd.zig
const std = @import("std"); const assert = std.debug.assert; // TODO // Cannot use testing allocator because I was too lazy to write the deinit() // method for Node (our graph). // // const allocator = std.testing.allocator; const allocator = std.heap.page_allocator; pub const Map = struct { pub const Pos = struc...
2019/p18/map.zig
const std = @import("std"); const panic = std.debug.panic; usingnamespace @import("zalgebra"); usingnamespace @import("../transform.zig"); usingnamespace @import("../chunk/chunk.zig"); const c = @import("../c.zig"); const opengl = @import("../opengl_renderer.zig"); const glfw = @import("../glfw_platform.zig"); usingna...
src/world/world.zig
const std = @import("std"); pub const NodeKind = enum { string, number, boolean, null_, array, object, }; pub const Node = union(NodeKind) { string: []const u8, number: f64, boolean: bool, null_: void, array: []const Node, object: std.StringHashMap(Node), pub fn de...
zig/node.zig
const std = @import("std"); const Array = std.ArrayList; fn add_indent(out_buffer : anytype, indent: usize) !void { var i : usize = 0; while (i < indent) : (i+=1) { try out_buffer.append(' '); } } const BfOpEnum = enum { push, pop, inc, dec, print, input, open_while, ...
generator.zig
const std = @import("std"); const TaskList = std.ArrayList(Task); const c = @cImport({ @cInclude("stdlib.h"); @cInclude("errno.h"); @cInclude("notcurses/direct.h"); }); const logger = std.log.scoped(.maid); var logfile_optional: ?std.fs.File = null; // based on the default std.log impl pub fn log( ...
src/main.zig
const Elf = @This(); const std = @import("std"); const bits = @import("bits.zig"); const assert = std.debug.assert; const elf = std.elf; const fmt = std.fmt; const fs = std.fs; const log = std.log.scoped(.zelf); const mem = std.mem; const Allocator = mem.Allocator; allocator: *Allocator, file: fs.File, header: elf....
src/Elf.zig
const std = @import("std"); const pkmn = @import("pkmn"); // https://en.wikipedia.org/wiki/ANSI_escape_code pub const ANSI = struct { pub const RED = "\x1b[31m"; pub const RESET = "\x1b[0m"; }; const Tool = enum { bide, confusion, chance, crit, damage, disable, distribution, m...
src/tools/rng.zig
const std = @import("std"); const config = @import("config.zig"); const gradient = @import("gradient.zig"); const Gradient = gradient.Gradient; const version = @import("version.zig").version; const VTE = @import("vte"); const c = VTE.c; const gtk = VTE.gtk; const allocator = std.heap.page_allocator; const fmt = std.fmt...
src/prefs.zig
const std = @import("std"); const testing = std.testing; const mem = std.mem; const expect = testing.expect; const expectEqual = testing.expectEqual; test "access the null element of a null terminated array" { const S = struct { fn doTheTest() !void { var array: [4:0]u8 = .{ 'a', 'o', 'e', 'u' ...
test/behavior/array_stage1.zig
const std = @import("std"); const mem = std.mem; const Tree = std.zig.Ast; const Node = Tree.Node; const TokenIndex = Tree.TokenIndex; const NodeIndex = Tree.Node.Index; pub const zloppy_comment = "// XXX ZLOPPY"; comptime { if (zloppy_comment[0] != '/' or zloppy_comment[1] != '/') @compileError("zloppy_...
src/zloppy.zig
const std = @import("std"); const Game = struct { allocator: std.mem.Allocator, rolls: []u8, boards: []Board, fn parse(allocator: std.mem.Allocator, text: []const u8) !Game { var rolls = std.ArrayList(u8).init(allocator); defer rolls.deinit(); var boards = std.ArrayList(Board)...
src/04.zig
const std = @import("std"); const Postgres = @import("postgres"); const build_options = @import("build_options"); const Pg = Postgres.Pg; const Result = Postgres.Result; const Builder = Postgres.Builder; const FieldInfo = Postgres.FieldInfo; const Parser = Postgres.Parser; const testing = std.testing; const Allocator...
tests/database.zig
const std = @import("std"); const Builder = std.build.Builder; const generator = @import("generator.zig"); fn concatAndReturnBuffer(allocator: std.mem.Allocator, one: []const u8, two: []const u8) !std.Buffer { var b = try std.Buffer.init(allocator, one); try b.append(two); return b; } pub fn build(b: *Bui...
build.zig
const std = @import("std"); const http = @import("apple_pie"); const router = http.router; pub const transaction_tree = @import("./transaction_tree.zig"); const context = @import("./context.zig"); const Context = @import("./context.zig").Context; //pub const io_mode = .evented; pub fn main() !void { var gpa = std...
src/main.zig
const std = @import("std"); const pkgs = struct { // TinyVG package const tvg = std.build.Pkg{ .name = "tvg", .path = .{ .path = "src/lib/tinyvg.zig" }, .dependencies = &.{ptk}, }; const ptk = std.build.Pkg{ .name = "ptk", .path = .{ .path = "vendor/parser-toolki...
build.zig
const std = @import("std"); const math = std.math; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const Self = @This(); const FLIR = @import("./FLIR.zig"); f: *FLIR, vardef: []u16, // Simple and Efficient Construction of Static Single Assignment Form // <NAME> et al, 2013 pub fn ssa_gvn(flir: *F...
src/SSA_GVN.zig
const std = @import("std"); const pkgs = @import("deps.zig").pkgs; const builtin = @import("builtin"); const Mode = std.builtin.Mode; const CrossTarget = std.zig.CrossTarget; const Target = std.Target; const BuildTarget = struct { name: []const u8, cross_target: CrossTarget, mode: Mode, }; pub fn build(...
build-all.zig
const std = @import("std"); const print = std.debug.print; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day12.txt"); const Type = enum { Start, End, Big, Small, }; const Cave = struct { exits : [16]i16, ty : Type, pub fn init(name : []const u8) @This() { ...
src/day12.zig
const Buffer = @import("Buffer.zig"); const Sampler = @import("Sampler.zig"); const TextureView = @import("TextureView.zig"); const BindGroupLayout = @import("BindGroupLayout.zig"); const BindGroup = @This(); /// The type erased pointer to the BindGroup implementation /// Equal to c.WGPUBindGroup for NativeInstance. ...
gpu/src/BindGroup.zig
const std = @import("std"); const expect = std.testing.expect; const mem = std.mem; const maxInt = std.math.maxInt; test "int to ptr cast" { const x = @as(usize, 13); const y = @intToPtr(*u8, x); const z = @ptrToInt(y); expect(z == 13); } test "integer literal to pointer cast" { const vga_mem = @i...
test/stage1/behavior/cast.zig
const std = @import("../std.zig"); const assert = std.debug.assert; const testing = std.testing; const mem = std.mem; const Token = std.zig.Token; pub const TokenIndex = u32; pub const ByteOffset = u32; pub const TokenList = std.MultiArrayList(struct { tag: Token.Tag, start: ByteOffset, }); pub const NodeList...
lib/std/zig/ast.zig
const std = @import("std"); const version = @import("version"); const zzz = @import("zzz"); const api = @import("api.zig"); const uri = @import("uri"); const build_options = @import("build_options"); const Dependency = @import("Dependency.zig"); usingnamespace @import("common.zig"); const Self = @This(); const Allocat...
src/Lockfile.zig
const std = @import("std"); const mem = std.mem; const hzzp = @import("hzzp"); const zuri = @import("uri"); const tls = @import("iguanaTLS"); const conn = @import("connection.zig"); const Protocol = conn.Protocol; const Connection = conn.Connection; /// All RFC 7231 and RFC 5789 HTTP methods. pub const Method = en...
src/request.zig
const std = @import("std"); const console = @import("src/console.zig"); 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 def...
build.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ines = @import("../ines.zig"); const console_ = @import("../console.zig"); const Config = console_.Config; const Console = console_.Console; const Cpu = @import("../cpu.zig").Cpu; const Ppu = @import("../ppu.zig").Ppu; const GenericMapper = @imp...
src/mapper/mmc3.zig
const kernel = @import("../../kernel.zig"); const x86_64 = @import("../x86_64.zig"); const log = kernel.log.scoped(.ACPI); const TODO = kernel.TODO; const Virtual = kernel.Virtual; const Physical = kernel.Physical; const Signature = enum(u32) { APIC = @ptrCast(*const u32, "APIC").*, FACP = @ptrCast(*const u32,...
src/kernel/arch/x86_64/acpi.zig
pub const SHORT_PACKET_TERMINATE = @as(u32, 1); pub const AUTO_CLEAR_STALL = @as(u32, 2); pub const PIPE_TRANSFER_TIMEOUT = @as(u32, 3); pub const IGNORE_SHORT_PACKETS = @as(u32, 4); pub const ALLOW_PARTIAL_READS = @as(u32, 5); pub const AUTO_FLUSH = @as(u32, 6); pub const RAW_IO = @as(u32, 7); pub const MAXIMUM_TRANSF...
win32/devices/usb.zig
const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const MemError = @import("../mem.zig").MemError; const VRAM_SIZE = 64 * 1024; pub const Vip = struct { disp_pixels: [224][384]u8, vram: []u8, pub fn new(allocator: *Allocator) !Vip { var vram = try allocator.al...
src/hw/vip.zig
const std = @import("std"); const warn = @import("std").debug.warn; const assert = @import("std").debug.assert; const draw = @import("draw.zig"); const todo = @import("todo.zig"); const misc = @import("misc.zig"); usingnamespace @import("c.zig"); fn getHomeDir() [*c]u8 { var homedir = getenv("HOME"); if (home...
src/main.zig
const std = @import("std"); pub const ErasedPtr = struct { ptr: usize, pub fn init(ptr: anytype) ErasedPtr { if (@sizeOf(@TypeOf(ptr)) == 0) { return .{ .ptr = undefined }; } return .{ .ptr = @ptrToInt(ptr) }; } pub fn as(self: ErasedPtr, comptime T: type) *T { ...
src/ecs/ecs/utils.zig
const std = @import("std"); const assert = std.debug.assert; const builtin = std.builtin; const mem = std.mem; const net = std.net; const os = std.os; const linux = os.linux; const testing = std.testing; usingnamespace @import("tigerbeetle.zig"); pub fn main() !void { var addr = try net.Address.parseIp4("127.0.0....
src/toy.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = true; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const assert = std.debug.assert; pub const main = tools.defaultMain("2021/day08.txt", run); pub fn run(input: []const u8, gpa...
2021/day08.zig
const std = @import("std"); const warn = std.debug.warn; const assert = std.debug.assert; var g_u1: u1 = 0; var pg_u1: *volatile u1 = &g_u1; var g_i1: i1 = 0; var pg_i1: *volatile i1 = &g_i1; test "g_u1" { assert(g_u1 == 0); assert(pg_u1 == &g_u1); pg_u1.* = 1; assert(g_u1 == 1); assert(@sizeOf(...
xx.zig
const std = @import("std"); const c = @import("c/c.zig"); const utils = @import("utils.zig"); const types = @import("types.zig"); pub const Event = union(enum) { const Self = @This(); key: types.KeyEvent, mouse: types.MouseEvent, window_buffer_size: types.Coords, menu: u32, focus...
src/events.zig
const std = @import("std"); const Allocator = mem.Allocator; const mem = std.mem; const ast = std.zig.ast; const Visib = @import("visib.zig").Visib; const event = std.event; const Value = @import("value.zig").Value; const Token = std.zig.Token; const errmsg = @import("errmsg.zig"); const Scope = @import("scope.zig").Sc...
src-self-hosted/decl.zig
const std = @import("../std.zig"); const Cpu = std.Target.Cpu; pub const Feature = enum { @"64bit", @"64bitregs", altivec, booke, bpermd, cmpb, crbits, crypto, direct_move, e500, extdiv, fcpsgn, float128, fpcvt, fprnd, fpu, fre, fres, frsqrte,...
lib/std/target/powerpc.zig
const builtin = @import("builtin"); const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Node = ast.Node; const Token = std.zig.Token; const Tree = ast.Tree; const ast = std.zig.ast; const mem = std.mem; const parse = std.zig.parse; const sort = std.sort.sort; const w...
src/zig/types.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const testing = std.testing; const expect = testing.expect; usingnamespace @import("csv"); var default_buffer = [_]u8{0} ** 1024; fn getTokenizer(file: std.fs.File, buffer: []u8, config: CsvConfig) !CsvTokenizer(std.fs.File.Reader) { ...
test/csv_tokenizer.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; usingnamespace @import("../parse.zig"); test "explicit doc" { const source = \\--- !tapi-tbd \\tbd-version: 4 \\abc-version: 5 \\... ; var tree = Tree.init(testing.allocator); defer tree.dein...
src/link/tapi/parse/test.zig
const c = @import("main.zig").c; const std = @import("std"); const assert = std.debug.assert; const gui = @import("gui.zig"); // To check OpenGL for errors at runtime const gl_safety_checks = true; // Draw buffers for microui const buffer_size: u32 = 16384; var tex_buf = std.mem.zeroes([buffer_size * 8]f32); var ver...
src/renderer.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const data = @embedFile("../inputs/day14.txt"); pub fn main() anyerror!void { var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa_impl.deinit(); const gpa = gpa_impl.allocator(); return m...
src/day14.zig
const std = @import("std"); const c = @import("c.zig"); const commands = @import("commands.zig"); pub const fontname = "Ubuntu-14"; pub const Arg = union { Int: i32, UInt: u32, float: f32, StringList: []const []const u8, String: []const u8, }; const ActionDef = struct { modifier: u32, c...
src/config.zig
const std = @import("std"); const debug = std.debug.print; const testing = std.testing; const kvstore = @import("kvstore.zig"); const io = @import("io.zig"); const config = @import("config.zig"); const utils = @import("utils.zig"); const findAllVariables = @import("parser_variables.zig").findAllVariables; const expand...
src/parser.zig
// Copyright (C) 2014-2021 <NAME> <EMAIL> // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, pub...
src/twin.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 Literal = @import("../parser/literal...
src/combn/combinator/oneof_ambiguous.zig
const api = switch (cfg.platform) { .web => @import("gfx_web.zig"), .win => @compileError("Not yet implemented!"), }; const cfg = @import("cfg.zig"); const std = @import("std"); pub const ContextDesc = struct { surface_desc: SurfaceDesc, adapter_desc: AdapterDesc = .{}, device_desc: DeviceDesc = .{...
src/gfx.zig
const ctz = @import("count0bits.zig"); const testing = @import("std").testing; fn test__ctzti2(a: u128, expected: i32) !void { var x = @bitCast(i128, a); var result = ctz.__ctzti2(x); try testing.expectEqual(expected, result); } test "ctzti2" { try test__ctzti2(0x00000000_00000000_00000000_00000001, 0...
lib/std/special/compiler_rt/ctzti2_test.zig
const std = @import("std"); const mach = @import("mach"); const gpu = @import("gpu"); compute_pipeline: gpu.ComputePipeline, render_pipeline: gpu.RenderPipeline, sprite_vertex_buffer: gpu.Buffer, particle_buffers: [2]gpu.Buffer, particle_bind_groups: [2]gpu.BindGroup, sim_param_buffer: gpu.Buffer, frame_counter: usize...
examples/boids/main.zig
const builtin = @import("builtin"); const arm_m = @import("arm_m"); const tzmcfi_monitor = @import("tzmcfi-monitor"); const port = @import("ports/" ++ @import("build_options").BOARD ++ "/secure.zig"); // ---------------------------------------------------------------------------- const exports = @import("monitor/export...
examples/monitor.zig
usingnamespace @import("common.zig"); pub const cpu_mesh: CpuMesh = .{ .index_size = @sizeOf(@TypeOf(indices)), .geom_size = @sizeOf(@TypeOf(positions)) + @sizeOf(@TypeOf(colors)) + @sizeOf(@TypeOf(normals)), .index_count = indices.len, .vertex_count = positions.len, .indice...
src/cube.zig
const rom = @import("../rom.zig"); const script = @import("../script.zig"); const std = @import("std"); const builtin = std.builtin; const mem = std.mem; const li32 = rom.int.li32; const lu16 = rom.int.lu16; const lu32 = rom.int.lu32; pub fn getScriptOffsets(data: []const u8) []const li32 { var len: usize = 0; ...
src/core/gen5/script.zig
const std = @import("std"); const warn = std.debug.warn; const CanonicalHuffmanTree = @import("./huffman.zig").CanonicalHuffmanTree; pub fn BlockTree(comptime InputBitStream: type) type { return struct { const Self = @This(); pub const TLitTree = CanonicalHuffmanTree(u4, 31 + 257); pub co...
src/block_tree.zig
const std = @import("std"); const builtin = @import("builtin"); const uefi = @import("uefi/uefi.zig"); const state = @import("state.zig"); const graphics = @import("graphics.zig"); const gdt = @import("gdt.zig"); export fn EfiMain(img: uefi.Handle, sys: *uefi.SystemTable) uefi.Status { state.uefi_image = img; ...
src/boot.zig
pub const PORT_PCR_MUX_SHIFT = 8; pub const PORT_PCR_MUX_MASK = 0x700; pub const PORT_PCR_SRE_MASK = 0x4; pub const PORT_PCR_DSE_MASK = 0x40; pub const WDOG_UNLOCK_SEQ2 = 0xD928; pub const WDOG_UNLOCK_SEQ1 = 0xC520; pub const WDOG_STCTRLH_ALLOWUPDATE_MASK = 0x10; pub const PMC_REGSC_BGBE_MASK = 0x1; pub const PMC_RE...
src/teensy3_2/mk20dx256.zig
const std = @import("std"); const platform = @import("../platform.zig"); const time = std.time; const vfs = @import("../vfs.zig"); const util = @import("../util.zig"); const RefCount = util.RefCount; const File = vfs.File; const Node = vfs.Node; const c = @cImport({ @cInclude("miniz/miniz.h"); }); /// Support f...
kernel/fs/zipfs.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 Blame = opaque { pub fn deinit(self: *Blame) void { log.debug("Blame.deinit called", .{}); c.git_blame_fr...
src/blame.zig
const std = @import("std"); const assert = std.debug.assert; const mem = @import("memory.zig"); pub const cgltf = @import("zcgltf.zig"); pub fn parseAndLoadFile(gltf_path: [:0]const u8) cgltf.Error!*cgltf.Data { const options = cgltf.Options{ .memory = .{ .alloc = mem.zmeshAllocUser, ...
modules/graphics/vendored/zmesh/src/io.zig
const std = @import("std"); const fs = std.fs; const io = std.io; const Rom = @import("cart.zig").Cart.Rom; const Allocator = std.mem.Allocator; pub const InesError = error{ MissingMagic, UnexpectedEndOfPrgRom, UnexpectedEndOfChrRom, }; pub const Mirroring = enum { horizontal, vertical, fou...
src/ines.zig
const std = @import("std"); const utils = @import("utils"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const sort = std.sort; const print = utils.print; const desc_i32 = sort.desc(i32); const OctupusMap = struct { width: usize, height: usize, energy: []i32, f...
day11/src/main.zig
const std = @import("std"); const log = std.log; const mem = std.mem; const os = std.os; const ScreenWidth = 64; const ScreenHeight = 32; const PrgRomAddress = 0x200; const StackAddress = 0xEA0; const ScreenAddress = 0xF00; pub const Chip8 = struct { Screen: [ScreenHeight][ScreenWidth]u1, KeyDown: [16]bool, ...
src/chip8.zig
const std = @import("std"); const print = @import("std").debug.print; const PriorityQueue = std.PriorityQueue; const ArrayList = std.ArrayList; const test_allocator = std.testing.allocator; const Point = struct { x: i32, y: i32, distance: u64, }; fn min_compare(a: Point, b: Point) std.math.Order { ret...
day_15/day_15.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const config = @import("config.zig"); const MessagePool = @import("message_pool.zig").MessagePool; const Message = MessagePool.Message; const vr = @import("vr.zig"); const Header = vr.Header; const Replica = vr.Replica; const RingBuffe...
src/test_message_bus.zig
const std = @import("std"); const example_input = @embedFile("./example_input.txt"); const puzzle_input = @embedFile("./puzzle_input.txt"); pub fn main() !void { std.debug.print("--- Part One ---\n", .{}); std.debug.print("Result: {d}\n", .{try part1(std.testing.allocator, puzzle_input)}); std.debug.print...
src/day07/day07.zig
const std = @import("std"); const builtin = @import("builtin"); const deque = @import("deque"); const Allocator = std.mem.Allocator; const Thread = std.Thread; pub const TaskFn = fn () anyerror!void; pub fn Future(comptime T: type) type { return union(enum) { const Self = @This(); Error: anyerr...
src/threadpool.zig
const std = @import("std"); const mem = std.mem; const open_flags = .{ .access_sub_paths = true, .iterate = true, }; pub const Iterator = struct { allocator: mem.Allocator, root: std.fs.Dir, segments: std.ArrayListUnmanaged([]const u8), stack: std.ArrayListUnmanaged(std.fs.Dir.Iterator), c...
.gyro/glob-mattnite-github.com-7d17d551/pkg/src/main.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "SHAPE", .global_id = 0 }; pub const OP = u8; pub const KIND = u8; pub const SO = extern enum(c_uint) { @"Set" = 0, @"Union" = 1, @"Intersect" = 2, @"Subtract" = 3, @"Invert" = 4, }; pub const SK = extern enum(c_uint) { ...
src/auto/shape.zig
const std = @import("std"); const debug = std.debug; const fmt = std.fmt; const io = std.io; const math = std.math; const mem = std.mem; const meta = std.meta; const testing = std.testing; const ston = @This(); pub const Parser = @import("src/Parser.zig"); pub usingnamespace @import("src/meta.zig"); /// The type s...
ston.zig
const std = @import("std"); const resolvePath = @import("resolvePath.zig").resolvePath; pub const Server = struct { server: std.net.StreamServer, pub fn init(ip: []const u8, port: u16) !Server { var server = std.net.StreamServer.init(.{ .reuse_address = true, }); errdefer s...
src/server.zig
const builtin = @import("builtin"); const std = @import("std"); const File = std.os.File; const Timer = std.os.time.Timer; const warn = std.debug.warn; const assert = std.debug.assert; /// Return the time stamp counter plus auxilliary information. /// The auxilary information is an u32 unique to each cpu. If two ///...
timer/timer.zig
const x86_64 = @import("../index.zig"); const bitjuggle = @import("bitjuggle"); const std = @import("std"); /// Specifies which element to load into a segment from /// descriptor tables (i.e., is a index to LDT or GDT table /// with some additional flags). /// /// See Intel 3a, Section 3.4.2 "Segment Selectors" pub co...
src/structures/gdt.zig
const std = @import("std"); const db = @import("db.zig"); pub fn main() anyerror!void { var gpalloc = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = &gpalloc.allocator; const stderr = std.io.getStdErr().writer(); const stdout = std.io.getStdOut().writer(); if (@import("builtin").os.ta...
src/main.zig