code
stringlengths
38
801k
repo_path
stringlengths
6
263
pub const WDS_CLI_TRANSFER_ASYNCHRONOUS = @as(u32, 1); pub const WDS_CLI_NO_SPARSE_FILE = @as(u32, 2); pub const PXE_DHCP_SERVER_PORT = @as(u32, 67); pub const PXE_DHCP_CLIENT_PORT = @as(u32, 68); pub const PXE_SERVER_PORT = @as(u32, 4011); pub const PXE_DHCPV6_SERVER_PORT = @as(u32, 547); pub const PXE_DHCPV6_CLIENT_P...
deps/zigwin32/win32/system/deployment_services.zig
const std = @import("std"); const stdx = @import("stdx"); const log = stdx.log.scoped(.ast); const document = stdx.textbuf.document; const _parser = @import("parser.zig"); const Parser = _parser.Parser; const NodePtr = _parser.NodePtr; const TokenRef = _parser.TokenRef; const NodeSlice = _parser.NodeSlice; const Node...
parser/ast.zig
const std = @import("std"); const str = []const u8; const Allocator = std.mem.Allocator; const Dir = std.fs.Dir; const root = @import("root"); const builtin = @import("builtin"); pub const windows_spec = Os.Spec.Windows.spec; pub const mac_spec = Os.Spec.MacOs.spec; pub const xdg_spec = Os.Spec.Xdg.spec; pub const Di...
lib/src/dirs.zig
const std = @import("std"); const print = std.debug.print; pub const Value = union(enum) { boolean: bool, number: f64, nil, obj: *Obj, }; pub const ObjType = enum { OBJ_STRING, }; pub const Obj = struct { objType: ObjType, next: ?*Obj, }; pub const ObjString = struct { obj: Obj, ...
vm/src/value.zig
const std = @import("std"); const string = []const u8; const input = @embedFile("../input/day07.txt"); pub fn main() !void { // var iter = std.mem.split(u8, std.mem.trim(u8, input, "\n"), ","); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const alloc =...
src/day07.zig
const std = @import("../index.zig"); const os = std.os; const assert = std.debug.assert; const io = std.io; const a = std.debug.global_allocator; const builtin = @import("builtin"); const AtomicRmwOp = builtin.AtomicRmwOp; const AtomicOrder = builtin.AtomicOrder; test "makePath, put some files in it, deleteTree" { ...
std/os/test.zig
pub const UPNP_E_ROOT_ELEMENT_EXPECTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220992)); pub const UPNP_E_DEVICE_ELEMENT_EXPECTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2147220991)); pub const UPNP_E_SERVICE_ELEMENT_EXPECTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, ...
win32/devices/enumeration/pnp.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Fish = ArrayList(u8); //-------------------------------------------------------------------------------------------------- pub fn part1() anyerror!void { const file = std.fs.cwd().openFile("data/day06_input.txt...
src/day06.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 Certificate = extern struct { /// Type of certificate cert_type: CertificateType, pub const CertificateType = enu...
src/certificate.zig
const std = @import("std"); const tools = @import("tools"); const Computer = struct { const Data = i32; boot_image: []const Data, memory_bank: []Data, const insn_halt = 99; const insn_add = 1; const insn_mul = 2; const insn_input = 3; const insn_output = 4; const insn_jne = 5; // ...
2019/day05.zig
const std = @import("std"); pub fn RPNStack(comptime T: type) type { const DEFAULT_MAX = 20; return struct { allocator: *std.mem.Allocator, buf: []T, len: usize, pub fn init(allocator: *std.mem.Allocator) !RPNStack(T) { return RPNStack(T) { .allocato...
rpnstack.zig
const std = @import("std"); const Builder = std.build.Builder; const os = std.os; const path = os.path; const builtin = @import("builtin"); const CACHE_DIR = "./zig-cache/"; const MAIN_PROGRAM = "src/main.zig"; pub fn build(b: *Builder) !void { const mode = b.standardReleaseOptions(); const main = b.addObjec...
build.zig
comptime { if (std.Target.current.os.tag != .uefi) { asm ( \\.extern __pmm_base \\.extern __dram_base \\ \\.global dram_base \\.global pmm_head \\ \\ .section .data.memmap \\ // Prekernel reclaimable ...
src/lib/pmm.zig
const ORG_NAME = "FabioWare"; const APP_NAME = "Karaoke"; const std = @import("std"); const builtin = @import("builtin"); const c = @cImport({ @cInclude("video.h"); @cInclude("glad/glad.h"); }); const nvg = @import("nanovg"); const gl = @import("zgl.zig"); const za = @import("zalgebra"); const Menu = @import(...
src/main.zig
const std = @import("../std.zig"); const assert = std.debug.assert; const builtin = @import("builtin"); const macho = std.macho; usingnamespace @import("../os/bits.zig"); extern "c" fn __error() *c_int; pub extern "c" fn _NSGetExecutablePath(buf: [*]u8, bufsize: *u32) c_int; pub extern "c" fn _dyld_get_image_header(i...
std/c/darwin.zig
const wordSize: u4 = 12; const inputFile = @embedFile("./input/day03.txt"); const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; // const assert = std.debug.assert; const MostCommonResult = enum { Zero, One, Equal, All, }; // Returns an array of 0, 1, or 2 ...
src/day03.zig
usingnamespace @import("MathUtil.zig"); usingnamespace @import("Vec3.zig"); const math = @import("std").math; pub const identity = Quat{ .x = 0.0, .y = 0.0, .z = 0.0, .w = 1.0 }; pub const Quat = packed struct { x: f32 = 0.0, y: f32 = 0.0, z: f32 = 0.0, w: f32 = 0.0, pub fn Equals(lhs: *const Qu...
src/math/Quat.zig
const std = @import("std"); const c = @cImport(@cInclude("picohttpparser.h")); const fmt = std.fmt; const assert = std.debug.assert; pub fn addTo(step: *std.build.LibExeObjStep, comptime dir: []const u8) void { step.addCSourceFile(dir ++ "/lib/picohttpparser.c", &[_][]const u8{}); step.addIncludeDir(dir ++ "...
picohttp/picohttp.zig
const std = @import("std"); const types = @import("types.zig"); const descriptors = @import("descriptors.zig"); const Reflector = @This(); allocator: *std.mem.Allocator, env: *types.JNIEnv, pub fn init(allocator: *std.mem.Allocator, env: *types.JNIEnv) Reflector { return .{ .allocator = allocator, .env = env }; ...
src/Reflector.zig
pub const CGD_DEFAULT = @as(u32, 0); pub const CGD_UNKNOWN_PROPERTY = @as(u32, 0); pub const CGD_STRING_PROPERTY = @as(u32, 1); pub const CGD_DATE_PROPERTY = @as(u32, 2); pub const CGD_BINARY_PROPERTY = @as(u32, 4); pub const CGD_ARRAY_NODE = @as(u32, 8); //-------------------------------------------------------------...
deps/zigwin32/win32/system/contacts.zig
pub const SP_LOW_CONFIDENCE = @as(i32, -1); pub const SP_NORMAL_CONFIDENCE = @as(u32, 0); pub const DEFAULT_WEIGHT = @as(u32, 1); pub const SP_MAX_WORD_LENGTH = @as(u32, 128); pub const SP_MAX_PRON_LENGTH = @as(u32, 384); pub const SP_EMULATE_RESULT = @as(u32, 1073741824); pub const SP_STREAMPOS_ASAP = @as(u32, 0); pub...
deps/zigwin32/win32/media/speech.zig
pub const D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION = @as(u32, 2048); pub const D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION = @as(u32, 4096); pub const D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION = @as(u32, 2048); pub const D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION = @as(u32, 4096); pub const D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION = @as(u3...
win32/graphics/direct3d.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; pub const Display = struct { // digit segments length digits with same length // ----- -------- ------ ----------------------- // 0 abc.efg 6 0, 6, 9 // 6 ab.defg 6 0, 6, 9 ...
2021/p08/display.zig
const std = @import("std"); const assert = @import("std").debug.assert; const time = std.time; const c = @cImport({ @cInclude("ed25519.h"); @cInclude("ed25519-donna.h"); // @cInclude("sodium.h"); }); const message = [_]u8{ 'h','e','l','l','o' }; // ed25519-donna var skEd25519: c.ed25519_secret_key = [_]u8{ 'a',...
src/main.zig
pub const FrameBufferType = enum(u8) { ARGB = 0, RGBA = 1, ABGR = 2, BGRA = 3 }; pub const Color = u32; pub const Position = struct { x: u32, y: u32, pub inline fn offsetX(self: Position, x: u32) Position { return .{ .x = self.x + x, .y = self.y }; } pub inline fn offsetY(self: Position,...
kernel/framebuffer.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day14.txt"); /// Represents a polymer pair. pub const Pair = struct { pub const Self = @This(); item1: u8, item2: u8, pub fn initFromSlice(pair: []const u8) Self { util.assert(pair.len == 2); ...
src/day14.zig
const inputFile = @embedFile("./input/day07.txt"); const std = @import("std"); const Allocator = std.mem.Allocator; // const ArrayList = std.ArrayList; const assert = std.debug.assert; /// Part 1 /// Simplest solution, no math knowledge required /// Brute forces from 0 - max, /// The distance from the current point t...
src/day07.zig
const std = @import("std"); const alphabet = @import("bio/alphabet.zig"); const Sequence = @import("sequence.zig").Sequence; const Cigar = @import("cigar.zig").Cigar; const CigarOp = @import("cigar.zig").CigarOp; pub const ExtendAlignResult = struct { score: i32, pos_one: usize, pos_two: usize, }; pub co...
src/extend_align.zig
const std = @import("std"); const io = std.io; const process = std.process; const Allocator = std.mem.Allocator; const VM = @import("./vm.zig").VM; const debug = @import("./debug.zig"); pub fn main() !void { var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = init: { ...
src/main.zig
const std = @import("std.zig"); const assert = std.debug.assert; const meta = std.meta; const mem = std.mem; const Allocator = mem.Allocator; const testing = std.testing; /// A MultiArrayList stores a list of a struct type. /// Instead of storing a single list of items, MultiArrayList /// stores separate lists for eac...
lib/std/multi_array_list.zig
const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const Mir = @This(); const bits = @import("bits.zig"); const Air = @import("../../Air.zig"); const Instruction = bits.Instruction; const Register = bits.Register; instructions: std.MultiArrayList(Inst).Slice, /// The m...
src/arch/sparcv9/Mir.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const assert = std.debug.assert; pub fn RingBuffer(comptime T: type, comptime len_opt: ?usize) type { return struct { const Self = @This(); const Cond = if (len_opt) |buffer_len| struct { const Buffer = ...
src/liu/buffers.zig
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 => true, 0xc78...0xc7e => true, 0xd58...0xd5e => true, 0xd70...0xd78 => tru...
src/components/autogen/DerivedNumericType.zig
const std = @import("std"); const tractor = @import("tractor.zig"); const clibs = @import("clibs.zig"); const ray = clibs.ray; const chip = clibs.chipmunk; fn makeTexture() ray.RenderTexture2D { var tex = ray.LoadRenderTexture(8, 8); ray.BeginTextureMode(tex); ray.ClearBackground(ray.BLANK); ray.DrawC...
src/main.zig
const util = @import("../sdf_util.zig"); pub const info: util.SdfInfo = .{ .name = "Displacement Noise", .data_size = @sizeOf(Data), .function_definition = function_definition, .enter_command_fn = enterCommand, .exit_command_fn = exitCommand, .sphere_bound_fn = sphereBound, }; pub const Data ...
src/sdf/modifiers/displacement_noise.zig
const std = @import("std"); const math = std.math; const glfw = @import("glfw"); const zgpu = @import("zgpu"); const gpu = zgpu.gpu; const c = zgpu.cimgui; const zm = @import("zmath"); const content_dir = @import("build_options").content_dir; const window_title = "zig-gamedev: triangle (wgpu)"; // zig fmt: off const ...
samples/triangle_wgpu/src/triangle_wgpu.zig
const std = @import("std"); const c = @import("../c.zig"); const math = @import("../math/math.zig"); var allocator = std.heap.page_allocator; pub const Shader = struct { programId: c.GLuint, pub fn init(name: []const u8) Shader { return Shader { .programId = loadShaderFromRelativePath(name) }; } ...
src/gfx/shader.zig
const std = @import( "std" ); const Allocator = std.mem.Allocator; usingnamespace @import( "../core/core.zig" ); usingnamespace @import( "../core/gtkz.zig" ); usingnamespace @import( "../core/support.zig" ); usingnamespace @import( "cursor.zig" ); usingnamespace @import( "curve.zig" ); pub fn TimeView( comptime N: usi...
src/time/view.zig
const std = @import("std"); const root = @import("main.zig"); const math = std.math; const testing = std.testing; pub const Vec2 = Vector2(f32); pub const Vec2_f64 = Vector2(f64); pub const Vec2_i32 = Vector2(i32); /// A 2 dimensional vector. pub fn Vector2(comptime T: type) type { if (@typeInfo(T) != .Float and ...
src/vec2.zig
const c = @import("../c_global.zig").c_imp; const std = @import("std"); // dross-rs //const Timer = @import("../utils/timer.zig").Timer; const ResourceHandler = @import("resource_handler.zig").ResourceHandler; const Renderer = @import("../renderer/renderer.zig").Renderer; const font = @import("../renderer/font/font.zig...
src/core/application.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqualSlices = std.testing.expectEqualSlices; const expectEqual = std.testing.expectEqual; const mem = std.mem; const x = @intToPtr([*]i32, 0x1000)[0..0x500]; const y = x[0x100..]; test "compile time slice of pointer to hard coded address" { ...
test/stage1/behavior/slice.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "Interrupts", .filter = .info, }).write; const platform = os.platform; const range = lib.util.range; const scheduler = os.thread.scheduler; const idt = @import("idt.zig"); const gdt = @import("gdt.zig"); const pic = @impo...
subprojects/flork/src/platform/x86_64/interrupts.zig
const std = @import("std"); const builtin = @import("builtin"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const AutoHashMap = std.AutoHashMap; const min = std.math.min; const warn = std.debug.warn; /// Top Level pub const Device = struct { name: ArrayList(u8), version: ArrayList(u8)...
src/svd.zig
const std = @import("std"); const math = std.math; const testing = std.testing; const assert = std.debug.assert; const cuda = @import("cudaz"); const cu = cuda.cu; const png = @import("png.zig"); const utils = @import("utils.zig"); const resources_dir = "resources/hw4/"; const log = std.log.scoped(.HW4); const log...
CS344/src/hw4.zig
const std = @import("std"); const zap = @import("zap"); const hyperia = @import("hyperia"); const picohttp = @import("picohttp"); const Timer = hyperia.Timer; const Reactor = hyperia.Reactor; const SpinLock = hyperia.sync.SpinLock; const AsyncSocket = hyperia.AsyncSocket; const CircuitBreaker = hyperia.CircuitBreaker...
example_http_client.zig
pub const ID_DOCUMENTPACKAGETARGET_MSXPS = Guid.initString("9cae40a8-ded1-41c9-a9fd-d735ef33aeda"); pub const ID_DOCUMENTPACKAGETARGET_OPENXPS = Guid.initString("0056bb72-8c9c-4612-bd0f-93012a87099d"); pub const ID_DOCUMENTPACKAGETARGET_OPENXPS_WITH_3D = Guid.initString("63dbd720-8b14-4577-b074-7bb11b596d28"); //-----...
deps/zigwin32/win32/storage/xps/printing.zig
const std = @import("std"); const assert = std.debug.assert; pub const Cancellation = error{ GeneratorCancelled, }; pub const State = enum { Initialized, Started, Error, Returned, Cancelled }; /// Generator handle, to be used in Handle's Ctx type /// /// `T` is the type that the generator yields /// `Return` is ...
src/generator.zig
// Copyright (c) 2020 <NAME> // 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, publish, distrib...
demos/io_uring/net_blocking.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const testing = std.testing; const assert = std.debug.assert; const mustache = @import("mustache.zig"); const TemplateOptions = mustache.options.TemplateOptions; const TemplateSource = mustache.options.Tem...
src/template.zig
const std = @import("std"); pub const instructions = struct { pub const CallBreak = packed struct { pub const Mode = packed enum(u12) { ecall, ebreak }; opcode: u7 = 0b1110011, unused1: u5 = 0, unused2: u3 = 0, unused3: u5 = 0, mode: u12, //: Mode }; // I-typ...
src-self-hosted/codegen/riscv64.zig
const kernel = @import("kernel.zig"); const Virtual = @This(); const Physical = kernel.Physical; const log = kernel.log.scoped(.Virtual); pub const Memory = @import("virtual_memory.zig"); pub const Address = @import("virtual_address.zig"); pub var initialized = false; pub const AddressSpace = struct { arch: kerne...
src/kernel/virtual.zig
const std = @import("std"); const expect = std.testing.expect; const Route = @import("router.zig").Route; const router = @import("router.zig"); const http = @import("http.zig"); const Router = router.Router; const HandlerFn = router.HandlerFn; const Request = http.Request; const Response = http.Response; const Headers ...
src/routez/routes.zig
//-------------------------------------------------------------------------------- // Section: Types (8) //-------------------------------------------------------------------------------- const IID_IProtectionPolicyManagerInterop_Value = Guid.initString("4652651d-c1fe-4ba1-9f0a-c0f56596f721"); pub const IID_IProtectio...
win32/security/enterprise_data.zig
const std = @import("std"); const builtin = @import("builtin"); const ingble = @import("ingble.zig"); const gatt = @import("gatt_client_async.zig"); const print = ingble.platform_printf; const enable_print = ingble.print_info == 1; const rom_crc: ingble.f_crc_t = @intToPtr(ingble.f_crc_t, 0x00000f79); fn same_vers...
examples-gcc/central_fota/src/fota_client.zig
const std = @import("std"); const tools = @import("tools"); 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); } pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); var arena ...
2017/day16.zig
const clap = @import("clap"); const format = @import("format"); const std = @import("std"); const ston = @import("ston"); const util = @import("util"); const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const log = std.log; const math = std.math; const mem = std....
src/randomizers/tm35-rand-starters.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Connection = @import("connection.zig").Connection; const c = @import("c.zig"); const unionInitEnum = @import("util.zig").unionInitEnum; const odbc = @import("types.zig"); const SqlReturn = odbc.SqlReturn; const odbc_error = @import("error.zig")...
src/statement.zig
const assert = @import("std").debug.assert; pub const DrawListSharedData = opaque {}; pub const Context = opaque {}; pub const DrawCallback = ?fn (parent_list: ?*const DrawList, cmd: ?*const DrawCmd) callconv(.C) void; pub const DrawIdx = u16; pub const ID = u32; pub const InputTextCallback = ?fn (data: ?*InputTextCal...
include/imgui.zig
const std = @import("std"); const testing = std.testing; pub const TokenKind = enum { inline_whitespace, builtin_id, user_id, arg, newline, assign_op, double_quoted_string, comment, open_paren, close_paren, single_quoted_string, escape_sequence, }; pub const token0 = @in...
src/lex.zig
pub const Opcode = enum(u8) { nop = 0x00, aconst_null = 0x01, iconst_m1 = 0x02, iconst_0 = 0x03, iconst_1 = 0x04, iconst_2 = 0x05, iconst_3 = 0x06, iconst_4 = 0x07, iconst_5 = 0x08, lconst_0 = 0x09, lconst_1 = 0x0a, fconst_0 = 0x0b, fconst_1 = 0x0c, fconst_2 = 0x0...
src/bytecode/ops.zig
const sf = struct { pub usingnamespace @import("../sfml.zig"); pub usingnamespace sf.network; }; const SocketSelector = @This(); // Constructor/destructor /// Creates a new socket selector pub fn create() SocketSelector { var sock = sf.c.sfSocketSelector_create(); if (sock) |s| { return Sock...
src/sfml/network/SocketSelector.zig
const std = @import("std"); const fs = std.fs; const mem = std.mem; const os = std.os; const testing = std.testing; const aur = @import("aur.zig"); const color = @import("color.zig"); const curl = @import("curl.zig"); const Pkgbuild = @import("pkgbuild.zig").Pkgbuild; const Version = @import("version.zig").Version; p...
src/pacman.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const gui = @import("gui"); const nvg = @import("nanovg"); const geometry = @import("gui/geometry.zig"); const Point = geometry.Point; const Rect = geometry.Rect; const EditorWidget = @import("EditorWidget.zig"); const NewDocumentWidget = @This(); wid...
src/NewDocumentWidget.zig
//-------------------------------------------------------------------------------- // Section: Types (1) //-------------------------------------------------------------------------------- pub const UAL_DATA_BLOB = extern struct { Size: u32, RoleGuid: Guid, TenantId: Guid, Address: SOCKADDR_STORAGE, ...
win32/system/user_access_logging.zig
const std = @import("std"); const zupnp = @import("zupnp"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const logger = std.log.scoped(.Website); pub fn main() !void { var lib = try zupnp.ZUPnP.init(std.heap.page_allocator, .{}); defer lib.deinit(); lib.server.stati...
samples/website/src/main.zig
const std = @import("std"); const tests = @import("tests.zig"); const fs = std.fs; const io = std.io; const mem = std.mem; const log = std.log; const fmt = std.fmt; const TokenIterator = mem.TokenIterator; const stdout = &io.getStdOut().writer(); const READ_BUF_SIZE: u16 = 4096; // Total 1GB 500MB 300MB 200...
src/main.zig
const std = @import("std"); pub const bits = struct { pub const fd_t = u32; pub const uid_t = void; pub const gid_t = void; pub const mode_t = usize; pub const timespec = struct { tv_sec: u32, tv_nsec: u32, }; pub const STDOUT_FILENO = 1; pub const STDERR_FILENO = 2; ...
src/os.zig
const arm = @import("arm.zig"); const intc = @import("intc.zig"); const log = @import("log.zig"); const panic = @import("panic.zig").panic; pub const IrqHandler = struct { pub const Context = struct { // @fieldParentPtr doesn't work with zero-sized types, hence this // field. See: https://github.co...
interrupt.zig
const std = @import("std"); const CPUData = extern union(enum) { /// The base clock speed of this CPU. /// /// Do note that this data may or may not be accurate, /// depending on the current system in use. /// /// For example, macOS provides a neat way to check this: /// `sysctl hw.cpufrequ...
lib/core/cpu.zig
const std = @import("std"); const math = std.math; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanicOnFail = zwin32.hrPanicOnFail; const hrPanic = zwin32.hrPanic; const zd3d12 = @import("zd3d12"); const common = @import("...
samples/textured_quad/src/textured_quad.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Vec2 = tools.Vec2; const Map = tools.Map(u8, 64, 64, false); pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { var arena = std.heap.ArenaAllocator.init(allocator); defer arena.dei...
2018/day18.zig
const std = @import("std"); const print = std.debug.print; const assert = std.debug.assert; const threads = @import("threads.zig"); const config = @import("config.zig"); const MAX_FILENAME_LENGTH = 64; const FileData = struct { name: [MAX_FILENAME_LENGTH:0]u8, name_length: usize, mtime: i128, ctime:...
src/recording.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) !void { const target = b.standardTargetOptions(.{}); const mode = releaseOptions(b); var code: u8 = undefined; const tags = b.execAllowFail( &.{ "git", "describe", "--tags" }, &code, std.ChildProcess.StdIo.Ignore, ...
build.zig
const os = @import("root").os; const atmcqueue = os.lib.atmcqueue; /// Task queue is a generic helper for the queue of tasks (allows to enqueue/dequeue them) /// It does no locking (though it disables interrupts) for its operations pub const TaskQueue = struct { queue: atmcqueue.MPSCUnboundedQueue(os.thread.Task, "a...
src/thread/task_queue.zig
pub const MARSHALINTERFACE_MIN = @as(u32, 500); pub const ASYNC_MODE_COMPATIBILITY = @as(i32, 1); pub const ASYNC_MODE_DEFAULT = @as(i32, 0); pub const STGTY_REPEAT = @as(i32, 256); pub const STG_TOEND = @as(i32, -1); pub const STG_LAYOUT_SEQUENTIAL = @as(i32, 0); pub const STG_LAYOUT_INTERLEAVED = @as(i32, 1); pub con...
deps/zigwin32/win32/storage/structured_storage.zig
const std = @import("std"); const log = std.log.scoped(.state_machine); pub const StateMachine = struct { pub const Operation = enum(u8) { /// Operations reserved by VR protocol (for all state machines): reserved, init, register, hash, }; state: u128, pub fn ...
src/test/state_machine.zig
const vk = @import("vk"); const memory = @import("memory.zig"); pub fn createDefaultImage( physical: vk.VkPhysicalDevice, device: vk.VkDevice, width: usize, height: usize, format: vk.VkFormat, tiling: vk.VkImageTiling, usage: vk.VkImageUsageFlags, properties: vk.VkMemoryPropertyFlags, img: *vk.VkIm...
graphics/src/backend/vk/image.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqualSlices = std.testing.expectEqualSlices; // Most tests here can be comptime but use runtime so that a stacktrace // can show failure location. // // Note certain results of `@typeName()` expect `behavior.zig` to be the // root file. Running...
test/behavior/typename.zig
const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const Ast = std.zig.Ast; const Zir = @import("Zir.zig"); const Module = @import("Module.zig"); const LazySrcLoc = Module.LazySrcLoc; /// Write human-readable, debug formatted ZIR code to a file. pub ...
src/print_zir.zig
const std = @import("std.zig"); const builtin = @import("builtin"); const debug = std.debug; const fs = std.fs; const io = std.io; const mem = std.mem; const math = std.math; const leb = @import("leb128.zig"); const ArrayList = std.ArrayList; pub usingnamespace @import("dwarf_bits.zig"); const PcRange = struct { ...
lib/std/dwarf.zig
const std = @import("std"); const assert = std.debug.assert; const expect = std.testing.expect; const print = std.debug.print; const time = std.time; const Random = std.rand.Random; const Sha256 = std.crypto.hash.sha2.Sha256; const Timer = time.Timer; const W = 8; fn PrivateKey(comptime Hash: type) type { const n...
src/main.zig
const std = @import("std"); const string = []const u8; const range = @import("range").range; const input = @embedFile("../input/day04.txt"); const BingoBoard = [5][5]u32; pub fn main() !void { // part 1 blk: { var iter = std.mem.split(u8, input, "\n"); const temp_numbers = iter.next().?; ...
src/day04.zig
const std = @import("std"); const serial = @import("serial-port.zig"); pub const Color = enum(u4) { black = 0, blue = 1, green = 2, cyan = 3, red = 4, magenta = 5, brown = 6, lightGray = 7, gray = 8, lightBlue = 9, lightGreen = 10, lightCyan = 11, lightRed = 12, ...
src/kernel/arch/x86/boot/tty.zig
const std = @import("std"); const ascii = std.ascii; const assert = std.debug.assert; const nodes = @import("nodes.zig"); const strings = @import("strings.zig"); const zunicode = @import("zunicode"); pub const AutolinkProcessor = struct { allocator: *std.mem.Allocator, text: *[]u8, pub fn init(allocator: ...
src/autolink.zig
const std = @import("std"); const hzzp = @import("hzzp"); const wz = @import("wz"); const ssl = @import("zig-bearssl"); const analBuddy = @import("analysis-buddy"); const format = @import("format.zig"); const request = @import("request.zig"); const util = @import("util.zig"); const agent = "zigbot9001/0.0.1"; const ...
src/main.zig
pub extern fn sokol_main(argc: c_int, argv: [*c][*c]u8) sapp_desc; pub extern fn sapp_isvalid() bool; pub extern fn sapp_width() c_int; pub extern fn sapp_height() c_int; pub extern fn sapp_color_format() c_int; pub extern fn sapp_depth_format() c_int; pub extern fn sapp_sample_count() c_int; pub extern fn sapp_high_dp...
src/deps/sokol/sokol_app.zig
const fmath = @import("index.zig"); const expo2 = @import("_expo2.zig").expo2; pub fn sinh(x: var) -> @typeOf(x) { const T = @typeOf(x); switch (T) { f32 => @inlineCall(sinhf, x), f64 => @inlineCall(sinhd, x), else => @compileError("sinh not implemented for " ++ @typeName(T)), } } ...
src/sinh.zig
const std = @import("std"); const assert = std.debug.assert; const allocator = std.heap.page_allocator; const Computer = @import("./computer.zig").Computer; pub const Map = struct { pub const Pos = struct { x: usize, y: usize, pub fn init(x: usize, y: usize) Pos { return Pos{ ...
2019/p19/map.zig
const std = @import("std"); const helper = @import("helper.zig"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const input = @embedFile("../inputs/day16.txt"); pub fn run(alloc: Allocator, stdout_: anytype) !void { const binary: []const u1 = try convertToBinary(alloc, input); defer al...
src/day16.zig
const std = @import("std"); const panic = std.debug.panic; const utils = @import("utils.zig"); const print = utils.print; const puts_e = utils.puts_e; const types = @import("types.zig"); const NodeKind = types.NodeKind; const Node = types.Node; const List = types.List; const allocator = std.heap.page_allocator; co...
lib/json.zig
const std = @import("std"); const testing = std.testing; const assert = @import("std").debug.assert; const mem = std.mem; const MAX_BYTE = 255; const MAX_SHORT = 65535; const MAX_INT = 4294967295; const Fletcher16 = struct { c0: u16, c1: u16, const Self = @This(); pub fn init() Self { return ...
fletcher.zig
pub const Link = ZigLLDLink; extern fn ZigLLDLink( oformat: ObjectFormatType, args: [*:null]const ?[*:0]const u8, arg_count: usize, append_diagnostic: fn (context: usize, ptr: [*]const u8, len: usize) callconv(.C) void, context_stdout: usize, context_stderr: usize, ) bool; pub const ObjectForm...
src/llvm.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const data = @embedFile("../inputs/day05.txt"); pub fn main() anyerror!void { var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa_impl.deinit(); const gpa = gpa_impl.allocator(); return m...
src/day05.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const ArrayList = std.ArrayList; const Builder = std.build.Builder; const File = std.fs.File; const InstallDir = std.build.InstallDir; const LibExeObjStep = std.build.LibExeObjStep; const Step = std.build.S...
lib/std/build/InstallRawStep.zig
const std = @import("std"); 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; const int = i64; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../dat...
src/day13.zig
const std = @import("std"); const Self = @This(); fn root() []const u8 { return std.fs.path.dirname(@src().file) orelse "."; } const root_path = root() ++ "/"; pub const include_dir = root_path ++ "include"; pub const Library = struct { step: *std.build.LibExeObjStep, pub fn link(self: Library, other: *...
lame.zig
const std = @import("std"); const assert = std.debug.assert; const Framebuffer = @import("Framebuffer.zig"); const zp = @import("../../zplay.zig"); const sdl = zp.deps.sdl; const gl = zp.deps.gl; const Self = @This(); pub const Api = enum { opengl, vulkan, metal, }; pub const Capability = enum(c_uint) { ...
src/graphics/common/Context.zig
const std = @import("std"); const gemtext = @import("../gemtext.zig"); const Fragment = gemtext.Fragment; const line_ending = "\r\n"; fn fmtRtfText( data: []const u8, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void { _ = fmt; _ = options; const illegal =...
src/renderers/rtf.zig
const std = @import("std"); const wren = @import("wren"); pub var alloc = std.testing.allocator; // This is basically all the separate example programs squished together into // one file so they can be ran all at once. // See the other Zig files in example/ for cleaner examples. // This will be a foreign class in ...
example/everything.zig
pub const DMUS_MAX_DESCRIPTION = @as(u32, 128); pub const DMUS_MAX_DRIVER = @as(u32, 128); pub const DMUS_EFFECT_NONE = @as(u32, 0); pub const DMUS_EFFECT_REVERB = @as(u32, 1); pub const DMUS_EFFECT_CHORUS = @as(u32, 2); pub const DMUS_EFFECT_DELAY = @as(u32, 4); pub const DMUS_PC_INPUTCLASS = @as(u32, 0); pub const DM...
deps/zigwin32/win32/media/audio/direct_music.zig