code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const debug = std.debug; const allocator = std.heap.page_allocator; const mem = std.mem; const filePathUtils = @import("FilePathUtils.zig"); const c = @import("../c.zig"); pub const ImageFileError = error{ STBI_LoadFailed, STBI_WriteFailed, }; pub const ImageFile = struct { m_...
src/coreutil/ImageFileUtil.zig
pub const FONT_ICON_FILE_NAME_FAR = "fa-regular-400.ttf"; pub const FONT_ICON_FILE_NAME_FAS = "fa-solid-900.ttf"; pub const ICON_MIN_FA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xe005, .hexadecimal); pub const ICON_MAX_FA = @import("std").zig.c_translation.promoteIntLiteral(c_int, 0xf8ff, .hexadecima...
src/deps/imgui/fonts/fontawesome.zig
const std = @import("std"); const ArrayList = std.ArrayList; // TODO: change to "core" when we dependencies untangled const core = @import("../index.zig"); const Coord = core.geometry.Coord; const sign = core.geometry.sign; const GameEngine = @import("./game_engine.zig").GameEngine; const game_model = @import("./game_m...
src/server/game_server.zig
const std = @import("std"); const print = std.debug.print; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day15.txt"); pub fn main() !void { var timer = try std.time.Timer.start(); var map = std.ArrayList(u8).init(gpa); defer { map.deinit(); } var width : usize = 0...
src/day15.zig
const Coff = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const log = std.log.scoped(.coff); allocator: Allocator, file: std.fs.File, name: []const u8, header: Header, section_table: std.ArrayListUnmanaged(SectionHeader) = .{}, sections: std.ArrayListUnmanaged(Section) = .{}, relocations...
src/Coff.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const json = std.json; const StringHashMap = std.StringHashMap; //; const c = @import("c.zig"); const math = @import("math.zig"); usingnamespace math; //; // glfw parser thing // parse the base64 buffers to u8 buffer // for default 3d utils // ha...
src/gltf.zig
const std = @import("std"); pub const CaseFoldMap = @import("../../components.zig").CaseFoldMap; pub const Props = @import("../../components.zig").DerivedCoreProperties; pub const Cats = @import("../../components.zig").DerivedGeneralCategory; pub const LowerMap = @import("../../components.zig").LowerMap; pub const Tit...
src/components/aggregate/Letter.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; pub const Submarine = struct { pub const Mode = enum { Simple, Complex, }; mode: Mode, xpos: usize, depth: usize, aim: usize, pub fn init(mode: Mode) Submarine { var ...
2021/p02/submarine.zig
const std = @import("std"); const print = @import("std").debug.print; const fs = std.fs; const os = std.os; const mem = @import("std").mem; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; pub const io_mode = .evented; const web = @import("zhp"); const spi = @import("bus/spi.zig"); const config = @import("config...
src/main.zig
const builtin = @import("builtin"); const georgios = @import("georgios"); comptime {_ = georgios;} const system_calls = georgios.system_calls; pub const panic = georgios.panic; const Game = struct { const Rng = georgios.utils.Rand(u32); const Dir = enum { Up, Down, Right, Le...
programs/snake/snake.zig
const std = @import("std"); const os = @import("root").os; const pmm = os.memory.pmm; const vmm = os.memory.vmm; const paging = os.memory.paging; const platform = os.platform; // Shared memory object pub const MemoryObject = struct { frames: []usize, ref_count: usize, allocator: *std.mem.Allocator, pag...
src/kepler/memory.zig
const std = @import("std"); const math = std.math; const mem = std.mem; const Allocator = mem.Allocator; const Self = @This(); const print = std.debug.print; const CFO = @import("./CFO.zig"); const SSA_GVN = @import("./SSA_GVN.zig"); const builtin = @import("builtin"); // const stage2 = builtin.zig_backend != .stage1;...
src/FLIR.zig
const std = @import("std"); const Token = struct { tag: Tag, loc: Loc, pub const Loc = struct { start: usize, end: usize, }; pub const Tag = union(enum) { kw_type, kw_struct, kw_ref, kw_flat, kw_view, kw_entry, kw_fn, ...
src/tokenizer.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const AutoHashMap = std.AutoHashMap; const Id = @import("./ui.zig").Id; const Rect = @import("./ui.zig").Rect; const Text = @import("./ui.zig").Text; const TextAlignment = @import("./ui.zig").TextAlignment; const Triangl...
src/drawer.zig
pub fn isUnassigned(cp: u21) bool { if (cp < 0x378 or cp > 0x10ffff) return false; return switch (cp) { 0x378...0x379 => true, 0x380...0x383 => true, 0x38b => true, 0x38d => true, 0x3a2 => true, 0x530 => true, 0x557...0x558 => true, 0x58b...0x58c...
.gyro/ziglyph-jecolon-github.com-c37d93b6/pkg/src/autogen/derived_general_category.zig
const std = @import("std"); const Vec4 = @import("vector.zig").Vec4; const initPoint = @import("vector.zig").initPoint; const initVector = @import("vector.zig").initVector; const Mat4 = @import("matrix.zig").Mat4; const Ray = @import("ray.zig").Ray; const Color = @import("color.zig").Color; const World = @import("wo...
camera.zig
const std = @import("std"); const testing = std.testing; const objc = @import("objc.zig"); const object = objc.object; const Class = objc.Class; const id = objc.id; const SEL = objc.SEL; /// Enum representing typecodes as defined by Apple's docs https://developer.apple.com/library/archive/documentation/Cocoa/Concept...
modules/platform/vendored/zig-objcrt/src/type-encoding.zig
const std = @import("std"); const math = std.math; const mem = std.mem; const assert = std.debug.assert; const wz = @import("../main.zig"); const util = @import("../util.zig"); pub const ChunkEvent = struct { data: []const u8, final: bool = false, }; pub const Event = union(enum) { header: wz.MessageHe...
src/parser/message.zig
const std = @import("std"); const expect = std.testing.expect; const test_allocator = std.testing.allocator; const Allocator = std.mem.Allocator; const Point = struct { x: i64, y: i64, }; const HeightMap = struct { const Self = @This(); allocator: Allocator, heights: []u8, width: i64, heig...
day09/src/main.zig
usingnamespace @import("core.zig"); const panic = std.debug.panic; const glfw = @import("glfw"); const MouseButtonCount: usize = @enumToInt(glfw.mouse_button.last); const KeyboardButtonCount: usize = @enumToInt(glfw.Key.last()); pub const TextInput = std.ArrayList(u16); const ButtonInput = struct { current_state...
src/input.zig
const std = @import("std"); const print = std.debug.print; const nanoid = @import("nanoid.zig"); const app_name = "nanoid"; const app_version = "0.1.0"; fn version() void { print("{s} version {s}\n", .{ app_name, app_version }); } fn usage() void { print("Usage:\n", .{}); print(" {s} ...
main.zig
const std = @import("std"); const os = @import("root").os; /// SingleListener is a helper that allows one thread /// to listen for events triggered by many producers pub const SingleListener = struct { /// Value that will be used for blocking const BLOCK_VAL: usize = @divFloor(std.math.maxInt(usize), 2); ...
src/thread/single_listener.zig
const std = @import("std"); const platform = @import("../platform.zig"); const uefiConsole = @import("console.zig"); const L = std.unicode.utf8ToUtf16LeStringLiteral; const uefi = std.os.uefi; const NO_PROTECT = "Protected mode not enabled, UEFI specification violation!\r\n"; const PAGING_ENABLED = "Paging is enabled...
src/kernel/uefi/systeminfo.zig
const std = @import("std"); const builtin = @import("builtin"); fn isProgramAvailable(builder: *std.build.Builder, program_name: []const u8) !bool { const env_map = try std.process.getEnvMap(builder.allocator); const path_var = env_map.get("PATH") orelse return false; var path_iter = std.mem.tokenize(u8, p...
build.zig
const std = @import("std"); const zap = @import("zap"); const hyperia = @import("hyperia.zig"); const os = std.os; const mem = std.mem; const math = std.math; const builtin = std.builtin; const testing = std.testing; const assert = std.debug.assert; pub const cache_line_length = switch (builtin.cpu.arch) { .x86_...
mpmc.zig
const std = @import("std"); const testing = std.testing; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const mustache = @import("../mustache.zig"); const TemplateOptions = mustache.options.TemplateOptions; const ref_counter = @import("ref_counter.zig"); const parsing = @import("parsing.zig");...
src/parsing/text_part.zig
pub const ZigGrammar = \\Program { TopLevelStmt* } \\TopLevelStmt @inline { StructMember | Statement } \\VModifier { 'pub' } \\Modifier { 'const' | 'var' } \\ExternModifier { 'extern' StringLiteral? } \\Statement @inline { \\ FunctionDecl | VariableDecl | IfStatement | LabeledStatement | ...
parser/grammars.zig
const std = @import("../../std.zig"); const windows = std.os.windows; const WINAPI = windows.WINAPI; const DWORD = windows.DWORD; const HANDLE = windows.HANDLE; const PENUM_PAGE_FILE_CALLBACKW = windows.PENUM_PAGE_FILE_CALLBACKW; const HMODULE = windows.HMODULE; const BOOL = windows.BOOL; const BOOLEAN = windows.BOOLEA...
lib/std/os/windows/psapi.zig
const std = @import("std"); const assert = std.debug.assert; const ast = std.zig.ast; const Token = std.zig.Token; const clang = @import("clang.zig"); const ctok = std.c.tokenizer; const CToken = std.c.Token; const mem = std.mem; const math = std.math; const CallingConvention = std.builtin.CallingConvention; pub con...
src/translate_c.zig
const std = @import("std"); const liu = @import("liu"); const erlang = @import("./erlang.zig"); const ext = erlang.ext; const BBox = erlang.BBox; const Vec2 = liu.Vec2; const KeyCode = liu.gamescreen.KeyCode; pub const camera: *Camera = &camera_; var camera_: Camera = .{}; pub const rows: [3]liu.gamescreen.KeyRow = ....
src/routes/erlang/util.zig
const std = @import("std"); const Codegen = @import("../Codegen.zig"); const Tree = @import("../Tree.zig"); const NodeIndex = Tree.NodeIndex; const x86_64 = @import("zig").codegen.x86_64; const Register = x86_64.Register; const RegisterManager = @import("zig").RegisterManager; const Fn = @This(); const Value = union(...
src/codegen/x86_64.zig
const Version = @import("builtin").Version; pub const version = Version{ .major = 1, .minor = 5, .patch = 4 }; pub const magic_number: u32 = 0x07230203; pub const Opcode = extern enum(u16) { OpNop = 0, OpUndef = 1, OpSourceContinued = 2, OpSource = 3, OpSourceExtension = 4, OpName = 5, OpMe...
src/codegen/spirv/spec.zig
const mecha = @import("../mecha.zig"); const std = @import("std"); const math = std.math; const mem = std.mem; const testing = std.testing; const unicode = std.unicode; /// Constructs a parser that parses a single utf8 codepoint based on /// a `predicate`. If the `predicate` returns true, the parser will /// return t...
src/utf8.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; const timezone = std.c.timezone; const rusage = std.c.rusage; extern "c" fn __errno() *c_int; pub const _errno = __errno; pub const dl_iterate_phdr...
lib/std/c/netbsd.zig
const std = @import("std"); const mem = std.mem; const os = std.os; const debug = std.debug; const io = std.io; const json = std.json; const fs = std.fs; const fmtDuration = std.fmt.fmtDuration; const bin_file = @import("bin_file.zig"); const Float = f32; const Dataset = @import("csv_img_dataset.zig").forData(Float, ...
src/main.zig
const std = @import("../std.zig"); const testing = std.testing; /// Performs multiple async functions in parallel, without heap allocation. /// Async function frames are managed externally to this abstraction, and /// passed in via the `add` function. Once all the jobs are added, call `wait`. /// This API is *not* thr...
lib/std/event/batch.zig
const std = @import("std"); const wal_ns = @import("./wal.zig"); const pointer = @import("./pointer.zig"); const record_ns = @import("./record.zig"); const dm_ns = @import("./disk_manager.zig"); const header = @import("./header.zig"); const serialize = @import("serialize"); const Pointer = pointer.Pointer; const Wal ...
src/sst.zig
const std = @import("std"); const debug = std.debug; const testing = std.testing; const ArrayList = std.ArrayList; const global_allocator = debug.global_allocator; fn mergeT(comptime T: type) type { return struct { const Self = @This(); const LT = fn (T, T) bool; fn init() Self { ...
src/merge.zig
const std = @import("std"); pub fn FCFS(comptime K: type, comptime V: type) type { return struct { seed: u32 = 0xc70f6907, alloc: std.mem.Allocator, max_load_factor: f16 = 0.70, map_buf: []?K = undefined, value_buf: []?V = undefined, load: usize = 0, iter_off...
src/main.zig
const std = @import("std"); const builtin = @import("builtin"); const python = @cImport({ @cDefine("_NO_CRT_STDIO_INLINE", "1"); @cDefine("PY_SSIZE_T_CLEAN", {}); @cInclude("Python.h"); }); const TypeInfo = std.builtin.TypeInfo; pub const PyObject = struct { ref: Ptr, const Ptr = [*c]python.PyObj...
src/pymodule.zig
pub const MAX_COUNTER_PATH = @as(u32, 256); pub const PDH_MAX_COUNTER_NAME = @as(u32, 1024); pub const PDH_MAX_INSTANCE_NAME = @as(u32, 1024); pub const PDH_MAX_COUNTER_PATH = @as(u32, 2048); pub const PDH_MAX_DATASOURCE_PATH = @as(u32, 1024); pub const H_WBEM_DATASOURCE = @as(i32, -1); pub const PDH_MAX_SCALE = @as(i3...
win32/system/performance.zig
const std = @import("std"); const Location = @import("location.zig").Location; pub const UnaryOperator = enum { negate, boolean_not, }; pub const BinaryOperator = enum { add, subtract, multiply, divide, modulus, boolean_or, boolean_and, less_than, greater_than, greater...
src/library/compiler/ast.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; test "static eval list init" { try expect(static_vec3.data[2] == 1.0); try expect(vec3(0.0, 0.0, 3.0).data[2] == 3.0); } const static_vec3 = vec3(0.0, 0.0, 1.0); pub const Vec3 = struct { data: [3]f3...
test/behavior/eval_stage1.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const data = @embedFile("data/day19.txt"); const EntriesList = std.ArrayList(Record); const Found = error { MatchFound }; const Rest = struct { remain: std.ArrayList(u8), search: ...
src/day19.zig
const std = @import("std"); const utils = @import("../util.zig"); const Ansi = @import("./code.zig").Ansi; const Style = @import("./style.zig").Style; const control_code = std.ascii.control_code; const os = std.os; const io = std.io; const fmt = std.fmt; const print = std.debug.print; const reader = io.getStdIn().reade...
src/term/colors.zig
const std = @import("std"); const c = @cImport({ @cInclude("src/cursesflags.h"); @cInclude("curses.h"); }); const Error = error.CursesError; fn checkError(res: c_int) !c_int { if (res == c.ERR) { return Error; } return res; } pub const KEY_RESIZE: c_int = c.KEY_RESIZE; pub const KEY_LEFT...
src/curses.zig
const sf = struct { pub usingnamespace @import("../sfml.zig"); pub usingnamespace sf.system; pub usingnamespace sf.graphics; pub usingnamespace sf.window; }; const RenderWindow = @This(); // Constructor/destructor /// Inits a render window with a size, a bits per pixel (most put 32) a title, a style...
src/sfml/graphics/RenderWindow.zig
const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const print = std.debug.print; const err = std.log.err; const warn = std.log.warn; // Helper functions /// Initialize registers pub fn init_reg() [4]u32 { return [1]u32{ 0 } ** 4; } /// Warn that an operator is currently in todo fn...
src/main.zig
pub const WasiHandle = i32; pub const Char8 = u8; pub const Char32 = u32; pub fn WasiPtr(comptime T: type) type { return [*c]const T; } pub fn WasiMutPtr(comptime T: type) type { return [*c]T; } pub const WasiStringBytesPtr = WasiPtr(Char8); pub const WasiString = extern struct { ptr: WasiStringBytesPtr, ...
example-output/zig.zig
const Object = @This(); const std = @import("std"); const assert = std.debug.assert; const elf = std.elf; const fs = std.fs; const log = std.log.scoped(.elf); const math = std.math; const mem = std.mem; const Allocator = mem.Allocator; const Atom = @import("Atom.zig"); const Elf = @import("../Elf.zig"); file: fs.Fil...
src/Elf/Object.zig
const std = @import( "std" ); usingnamespace @import( "../core/core.zig" ); usingnamespace @import( "../core/glz.zig" ); pub const VerticalCursor = struct { axis: *const Axis, cursor: f64, thickness_LPX: f64, rgba: [4]GLfloat, coords: [8]GLfloat, prog: VerticalCursorProgram, vbo: GLuint, ...
src/time/cursor.zig
const w4 = @import("../wasm4.zig"); const buttons = @import("button.zig"); const Situation = @import("../components/situation.zig").Situation; const std = @import("std"); const textWrap = @import("wrapping-text.zig").textWrap; const PROMPT_HEIGHT: u8 = 120; const SCREEN_SIZE: u8 = 160; const X_OFFSET: u8 = 2; pub co...
src/components/prompt.zig
const std = @import("std"); const task = @import("task.zig"); pub const Color = enum { Black, Blue, Green, Aqua, Red, Purple, Yellow, White, pub fn format( self: Color, comptime fmt: []const u8, options: std.fmt.FormatOptions, context: var, ...
src/prompt.zig
const std = @import("std"); const fmt = std.fmt; const mem = std.mem; const Sha512 = std.crypto.hash.sha2.Sha512; /// Ed25519 (EdDSA) signatures. pub const Ed25519 = struct { /// The underlying elliptic curve. pub const Curve = @import("edwards25519.zig").Edwards25519; /// Length (in bytes) of a seed requi...
lib/std/crypto/25519/ed25519.zig
const std = @import("std"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const global_allocator = &gpa.allocator; pub fn main() anyerror!void { var exa = EXA{ .memory = std.heap.ArenaAllocator.init(global_allocator), .code = undefined, }; } pub const EXA = struct { const Self = @Thi...
src/main.zig
const std = @import("std"); const expectEqual = std.testing.expectEqual; const expectEqualSlices = std.testing.expectEqualSlices; pub const PathComponent = struct { name: []const u8, path: []const u8, }; pub const PathComponentIterator = struct { path: []const u8, i: usize, const Self = @This(); ...
src/path_components.zig
const builtin = @import("builtin"); const std = @import("std"); const testing = std.testing; const FREE_SLOT = 0; // Use the provided function to re-seed the default PRNG implementation. var xoro = std.rand.Xoroshiro128.init(42); pub fn seed_default_prng(seed: u64) void { xoro.seed(seed); } // If you want to rea...
src/cuckoofilter.zig
const std = @import("std"); const pc_keyboard = @import("../../pc_keyboard.zig"); pub const EXTENDED_KEY_CODE: u8 = 0xE0; pub const KEY_RELEASE_CODE: u8 = 0xF0; /// Implements state logic for scancode set 2 /// /// Start: /// F0 => Release /// E0 => Extended /// xx => Key Down /// /// Release: /// xxx => Key Up /// ...
src/keycode/scancodes/scancode_set2.zig
const std = @import("std"); /// Sets whether or not buztd should daemonize /// itself. Don't use this if running buztd as a systemd /// service or something of the sort. pub const should_daemonize: bool = false; /// Free RAM percentage figures below this threshold are considered to be near terminal, meaning /// tha...
src/config.zig
const std = @import("std"); const expect = std.testing.expect; const minInt = std.math.minInt; test "@bitReverse" { comptime try testBitReverse(); try testBitReverse(); } fn testBitReverse() !void { // using comptime_ints, unsigned try expect(@bitReverse(u0, 0) == 0); try expect(@bitReverse(u5, 0x...
test/behavior/bitreverse.zig
const std = @import("std"); const assert = std.debug.assert; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = &gpa.allocator; defer _ = gpa.deinit(); const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); if (a...
src/day05.zig
const std = @import("std"); const testing = std.testing; const allocator = std.heap.page_allocator; pub const Game = struct { const SIZE = 10_000; pub const Mode = enum { Simple, Recursive, }; const Cards = struct { values: [SIZE]usize, top: usize, bot: usize,...
2020/p22/game.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const print = std.debug.print; const file = @embedFile("../input.txt"); const CellState = enum { floor, occupied, empty, }; var row_length: usize = undefined; const Coord = struct { row: i64, column: i64, pub f...
2020/day11/zig/day11.zig
const os = @import("root").os; const std = @import("std"); const range = os.lib.range.range; const paging = os.memory.paging; const pmm = os.memory.pmm; const font_fixed_6x13 = .{ .width = 6, .height = 13, .base = 0x20, .data = @embedFile("fixed6x13.bin"), }; const font_fixed_8x13 = .{ .width = 8, .h...
src/drivers/io/vesa_log.zig
const std = @import("std"); const builtin = @import("builtin"); const Builder = @import("std").build.Builder; pub fn build(b: *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 ta...
build.zig
const clap = @import("clap"); const SDL = @import("sdl2"); const std = @import("std"); const Machine = @import("Machine.zig"); const DEFAULT_EXE_ARG = "pacman"; const COINAGE = std.ComptimeStringMap(u8, .{ .{ "free", 0x00 }, .{ "1:1", 0x01 }, .{ "1:2", 0x02 }, .{ "2:1", 0x03 }, }); const LIVES = std...
src/main.zig
const std = @import("std"); const info = std.log.info; const warn = std.log.warn; const bus = @import("bus.zig"); const cop0 = @import("cop0.zig"); const cop1 = @import("cop1.zig"); /// Sign extend 8-bit data fn exts8(data: u8) u64 { return @bitCast(u64, @intCast(i64, @bitCast(i8, data))); } /// Sign extend 1...
src/core/cpu.zig
usingnamespace @import("psptypes.zig"); pub const SceMpegLLI = extern struct { pSrc: ScePVoid, pDst: ScePVoid, Next: ScePVoid, iSize: SceInt32, }; pub const SceMpegYCrCbBuffer = extern struct { iFrameBufferHeight16: SceInt32, iFrameBufferWidth16: SceInt32, iUnknown: SceInt32, iUnknown2...
src/psp/sdk/pspmpeg.zig
const std = @import("std"); const off_t = std.c.off_t; const size_t = std.c.size_t; const list = @import("list.zig"); const shmarea = @import("shmarea.zig"); const local = @import("local.zig"); pub const snd_pcm_stream_t = enum(c_int) { PLAYBACK = 0, CAPTURE, }; pub const snd_pcm_access_t = enum(c_int) { ...
modules/platform/vendored/zig-alsa/src/pcm.zig
const std = @import("std"); const math = @import("math.zig"); const files = @import("files.zig"); const config = @import("config.zig"); const term = @import("term.zig"); const mem = std.mem; const print = std.debug.print; const assert = std.debug.assert; const expect = std.testing.expect; const Allocator = std.mem.Allo...
libs/edit.zig
const std = @import("std.zig"); const builtin = std.builtin; const io = std.io; const fs = std.fs; const mem = std.mem; const debug = std.debug; const panic = std.debug.panic; const assert = debug.assert; const warn = std.debug.warn; const ArrayList = std.ArrayList; const StringHashMap = std.StringHashMap; const Alloca...
lib/std/build.zig
const std = @import("std"); const os = std.os; const io = std.io; const mem = std.mem; const Allocator = mem.Allocator; const Buffer = std.Buffer; const llvm = @import("llvm.zig"); const c = @import("c.zig"); const builtin = @import("builtin"); const Target = @import("target.zig").Target; const warn = std.debug.warn; c...
src-self-hosted/compilation.zig
const builtin = @import("builtin"); const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; /// Returns the least integer value greater than of equal to x. /// /// Special Cases: /// - ceil(+-0) = +-0 /// - ceil(+-inf) = +-inf /// - ceil(nan) = nan pub fn ceil(x: anytype) @...
lib/std/math/ceil.zig
const std = @import("std"); const mem = std.mem; const NonCanonicalError = std.crypto.errors.NonCanonicalError; /// 2^252 + 27742317777372353535851937790883648493 pub const field_size = [32]u8{ 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00, 0x00, ...
lib/std/crypto/25519/scalar.zig
const std = @import("std"); const heap = std.heap; const io = std.io; const testing = std.testing; const ArrayList = std.ArrayList; const filter = @import("filter.zig"); const ui = @import("ui.zig"); const version = "0.5-dev"; const version_str = std.fmt.comptimePrint("zf {s} <NAME>", .{version}); const help = ...
src/main.zig
const std = @import("std"); const TestContext = @import("../../src-self-hosted/test.zig").TestContext; // self-hosted does not yet support PE executable files / COFF object files // or mach-o files. So we do the ZIR transform test cases cross compiling for // x86_64-linux. const linux_x64 = std.zig.CrossTarget{ .cp...
test/stage2/zir.zig
const std = @import("std.zig"); const assert = std.debug.assert; const testing = std.testing; const Allocator = std.mem.Allocator; // Imagine that `fn at(self: *Self, index: usize) &T` is a customer asking for a box // from a warehouse, based on a flat array, boxes ordered from 0 to N - 1. // But the warehouse actuall...
lib/std/segmented_list.zig
const std = @import("std"); pub const Futex = if (std.builtin.os.tag == .windows) WindowsFutex else if (std.builtin.os.tag == .linux) LinuxFutex else if (std.Target.current.isDarwin()) DarwinFutex else if (std.builtin.link_libc) PosixFutex else @compileError("Platform not supported"); const LinuxF...
src/runtime/Futex.zig
const std = @import("std"); const basic_type = @import("basic_type.zig"); const assert = std.debug.assert; const testing = std.testing; const log = std.log.scoped(.grid); const IndexLinkList = @import("IndexLinkList.zig"); const node_null = basic_type.node_null; const Index = basic_type.Index; const Grid = @This(); co...
src/physic/Grid.zig
const builtin = @import("builtin"); const std = @import("std"); const assert = std.debug.assert; const root = @import("root"); pub const pl = if (builtin.os.tag == .windows) WindowsPlatform else UnixPlatform; // win32.h const WindowsPlatform = struct { const ws2 = std.os.windows.ws2_32; pub const SocketHan...
enet.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...
win32/media/audio/direct_music.zig
//! See: //! - Prefix/Huffman coding, //! - Canonical Huffman, //! - Package-merge algorithm. const std = @import("std"); const math = std.math; const expect = std.testing.expect; const expectError = std.testing.expectError; const print = std.debug.print; const ArrayList = std.ArrayList; const Allocator = std.mem.All...
src/package_merge.zig
const std = @import("std"); const fs = std.fs; const print = std.debug.print; const c = @cImport({ @cInclude("linux/spi/spidev.h"); @cInclude("sys/ioctl.h"); @cInclude("sys/errno.h"); }); // const Config = extern struct { // unsigned int mode; // unsigned int bits_per_word; // unsigned int sp...
src/bus/spi.zig
const std = @import("../../std.zig"); const maxInt = std.math.maxInt; const pid_t = linux.pid_t; const uid_t = linux.uid_t; const clock_t = linux.clock_t; const stack_t = linux.stack_t; const sigset_t = linux.sigset_t; const linux = std.os.linux; const SYS = linux.SYS; const sockaddr = linux.sockaddr; const socklen_t ...
lib/std/os/linux/sparc64.zig
const Array = @import("std").ArrayList; const Builder = @import("std").build.Builder; const builtin = @import("builtin"); const join = @import("std").mem.join; pub fn build(b: &Builder) void { //// // Default step. // const kernel = buildKernel(b); const terminal = buildServer(b, "terminal"); ...
build.zig
const std = @import("std"); const builtin = @import("builtin"); const lola = @import("../main.zig"); const whitespace = [_]u8{ 0x09, // horizontal tab 0x0A, // line feed 0x0B, // vertical tab 0x0C, // form feed 0x0D, // carriage return 0x20, // space }; const root = @import("root"); const mi...
src/library/libraries/stdlib.zig
const std = @import("std"); const aarch64 = @import("../../../codegen/aarch64.zig"); const assert = std.debug.assert; const log = std.log.scoped(.reloc); const macho = std.macho; const math = std.math; const mem = std.mem; const meta = std.meta; const reloc = @import("../reloc.zig"); const Allocator = mem.Allocator; c...
src/link/MachO/reloc/aarch64.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const os = std.os; const linux = os.linux; const IO_Uring = linux.IO_Uring; const log = std.log.scoped(.server); pub fn main() anyerror!void { std.log.info("All your codebase are belong to us.", .{}); var gpa = std.heap.GeneralPurposeAllocator(.{...
src/hybrid.zig
const std = @import("std"); const assert = std.debug.assert; const c = @cImport({ @cInclude("cgltf.h"); }); const Error = @import("main.zig").Error; const mem = @import("memory.zig"); pub const DataHandle = *opaque {}; pub fn parseAndLoadFile(gltf_path: [:0]const u8) Error!DataHandle { var options = std.mem.z...
libs/zmesh/src/gltf.zig
const std = @import("std"); const assert = std.debug.assert; const _debug = if (false) std.debug.print else _noopDebugPrint; fn _noopDebugPrint(comptime fmt: []const u8, args: anytype) void { _ = fmt; _ = args; // do nothing } var _nxt: usize = 0; fn _debugGenNum() usize { _nxt += 1; return _nxt...
ziggen.zig
const std = @import("std"); const mem = std.mem; const meta = std.meta; const net = std.net; usingnamespace @import("../frame.zig"); usingnamespace @import("../primitive_types.zig"); usingnamespace @import("../error.zig"); const testing = @import("../testing.zig"); /// ERROR is sent by a node if there's an error proc...
src/frames/error.zig
const std = @import("std"); const Entity = @import("Entity.zig").Entity; const EntityManager = @import("EntityManager.zig").EntityManager; const behaviourSystems = @import("BehaviourSystems.zig"); const ComponentManager = @import("ComponentData.zig").ComponentManager; const debug = std.debug; const time = std.time; co...
src/game/GameWorld.zig
const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const zigimg = @import("zigimg/zigimg.zig"); const IntegerColor8 = zigimg.color.IntegerColor8; const OctTreeQuantizer = zigimg.OctTreeQuantizer; const fs = std.fs; const mem = std.mem; const std = @import("std"); pub const ImageConverterError = erro...
GBA/assetconverter/image_converter.zig
const std = @import("std"); const bcm2835 = @import("bcm2835.zig"); const peripherals = @import("peripherals.zig"); /// enumerates the GPio level (high/low) pub const Level = enum(u1) { High = 0x1, Low = 0x0 }; /// enumerates the gpio functionality /// the enum values are the bits that need to be written into the //...
src/gpio.zig
const std = @import("std"); const use_test_input = false; const filename = if (use_test_input) "day-4_test-input" else "day-4_real-input"; const draw_count = if (use_test_input) 27 else 100; const board_count = if (use_test_input) 3 else 100; pub fn main() !void { std.debug.print("--- Day 4 ---\n", .{}); var...
day-4.zig
pub const NETSH_ERROR_BASE = @as(u32, 15000); pub const ERROR_NO_ENTRIES = @as(u32, 15000); pub const ERROR_INVALID_SYNTAX = @as(u32, 15001); pub const ERROR_PROTOCOL_NOT_IN_TRANSPORT = @as(u32, 15002); pub const ERROR_NO_CHANGE = @as(u32, 15003); pub const ERROR_CMD_NOT_FOUND = @as(u32, 15004); pub const ERROR_ENTRY_P...
deps/zigwin32/win32/network_management/net_shell.zig
const c = @import("c.zig"); const nk = @import("../nuklear.zig"); const std = @import("std"); const testing = std.testing; pub const Buttons = enum(u8) { left = c.NK_BUTTON_LEFT, middle = c.NK_BUTTON_MIDDLE, right = c.NK_BUTTON_RIGHT, double = c.NK_BUTTON_DOUBLE, }; pub const Keys = enum(u8) { no...
src/input.zig
const std = @import("std"); const math = std.math; const L = std.unicode.utf8ToUtf16LeStringLiteral; const zwin32 = @import("zwin32"); const w32 = 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 cmp = @import("cmp.zig"); const testing = @import("std").testing; fn test__cmpsi2(a: i32, b: i32, expected: i32) !void { var result = cmp.__cmpsi2(a, b); try testing.expectEqual(expected, result); } test "cmpsi2" { // minInt == -2147483648 // maxInt == 2147483647 // minInt/2 == -1073741824 ...
lib/std/special/compiler_rt/cmpsi2_test.zig
const std = @import("std"); const math = std.math; const expect = std.testing.expect; const maxInt = std.math.maxInt; pub fn __log2h(a: f16) callconv(.C) f16 { // TODO: more efficient implementation return @floatCast(f16, log2f(a)); } pub fn log2f(x_: f32) callconv(.C) f32 { const ivln2hi: f32 = 1.442871...
lib/compiler_rt/log2.zig