code
stringlengths
38
801k
repo_path
stringlengths
6
263
const common = @import("../common.zig"); pub const NarcOffset = struct { file: usize, offset: usize, }; pub const OverlayOffset = struct { overlay: usize, offset: usize, }; pub const Info = struct { game_title: [11:0]u8, gamecode: [4]u8, version: common.Version, starters: [3][]const ...
src/core/gen5/offsets.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const trait = std.meta.trait; const vk = @import("../include/vk.zig"); const Render = @import("../lib.zig").Render; const Context = @import("../backend/context.zig").Context; const Pipeline = @import("../backend/pipeline.zig").Pipeline; const RenderPass...
render/src/program/pipeline.zig
const std = @import("std"); const math = @import("utils/math.zig"); const Component = @import("Component.zig"); const StateMachine = @import("ActionStates/StateMachine.zig"); const CommonStates = @import("ActionStates/CommonStates.zig"); const Input = @import("Input.zig"); const CharacterData = @import("CharacterData.z...
src/GameSimulation.zig
const AyArgparse = @This(); const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; args: [][]u8 = undefined, arguments: std.StringHashMapUnmanaged([]const u8) = .{}, positionals: std.ArrayListUnmanaged([]const u8) = .{}, allocator: Allocator, params: []const ParamDesc, pub const ParamDesc ...
AyArgparse.zig
const std = @import("std"); const IOPort = @import("../IOPort.zig"); const TextConsole = @This(); pub const ForegroundColor = enum(u4) { black = 0, blue = 1, green = 2, cyan = 3, red = 4, purple = 5, dark_orange = 6, light_gray = 7, gray = 8, light_blue = 9, light_green = 1...
kernel/console/TextConsole.zig
const std = @import("std"); const PortIO = @import("port.zig"); /// ATA Bus: /// Primary: BAR0: 0x1F0, BAR1: 0x3F4 /// Secondary: BAR0: 0x170, BAR1: 0x374 pub const Bus = enum { Primary, Secondary }; pub const Drive = enum { Master, Slave }; pub fn PIODevice(comptime bus: Bus, comptime drv: Drive) type { ...
src/io/ata.zig
const std = @import("std"); const NativeVector = @import("native_vector.zig").NativeVector; const assert = std.debug.assert; pub fn indexOfScalar(comptime T: type, items: []const T, value: T) ?usize { var i: usize = 0; if (comptime NativeVector.supportsType(T)) { const vec = NativeVector.init(T); ...
src/algorithms.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const e = @import("engine.zig"); const Engine = e.Engine; const ByteCodeError = e.ByteCodeError; const DatabaseError = e.DatabaseError; const c = @import("card.zig"); const Card = c.Card; test "initialize engine" { const state = try initEngine(std....
engine/src/main.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Grid = ArrayList(ArrayList(u8)); const Coord = struct { i: i32, j: i32 }; const neighbor_relative_coords = [_]Coord{ Coord{ .i = -1, .j = -1 }, Coord{ .i = 0, .j = -1 }, Coord{ .i = 1, .j = -1 }, Coord{ .i = -1, .j = 0 }, Coord{ .i...
src/day18.zig
const std = @import("std"); const builtin = @import("builtin"); const os = std.os; const io = std.io; const mem = std.mem; const Allocator = mem.Allocator; const ArrayList = std.ArrayList; const Buffer = std.Buffer; const arg = @import("arg.zig"); const introspect = @import("introspect.zig"); const Args = arg.Args; c...
src/main.zig
const std = @import("std"); const LineReader = @import("LineReader.zig").LineReader; const ByteWriter = @import("ByteWriter.zig").ByteWriter; const imageExtensions = [_][]const u8{ ".png", ".jpeg", ".jpg", ".gif", ".webp", }; const videoExtensions = [_][]const u8{ ".mp4", }; const audioExtensio...
src/main.zig
const std = @import("std"); const mpack = @import("./mpack.zig"); const ArrayList = std.ArrayList; const mem = std.mem; const stringToEnum = std.meta.stringToEnum; const dbg = std.debug.print; //pub fn dbg(a: anytype, b: anytype) void {} const AttrOffset = struct { start: u32, end: u32 }; attr_arena: ArrayList(u8), a...
src/RPC.zig
const std = @import("std"); const fmt = std.fmt; const fs = std.fs; const os = std.os; pub const ProcEntry = struct { pid: os.pid_t, dir: fs.Dir, oom_score: u16 = undefined, oom_score_adj: i16 = undefined, exe: [os.PATH_MAX-1:0]u8 = undefined, vm_rss: u32 = undefined, pub fn init(pid: os....
src/proc.zig
const std = @import("std"); const req = @import("request.zig"); const Client = @import("client.zig").Client; const BasicPerformFunctionPrototype = fn (*std.mem.Allocator, []const u8) anyerror!req.Response; pub fn get(allocator: std.mem.Allocator, url: []const u8) !req.Response { var client = try Client.init(alloc...
src/oneshot.zig
const std = @import("std"); const math = std.math; const affine = @import("affine.zig"); const V3 = affine.V3; const v3 = V3.init; const invPi: f64 = 0.31830988618379067; const invTau: f64 = 0.15915494309189534; const Jazbz = @import("jabz.zig").Jazbz(f64); const gmath = @import("gmath.zig").gmath(f64); const clamp...
lib/brdf.zig
const std = @import("std"); const log = std.log; const assert = std.debug.assert; const cudaz = @import("cudaz"); const cu = cudaz.cu; const png = @import("png.zig"); const utils = @import("utils.zig"); const hw1_kernel = @import("hw1_pure_kernel.zig"); const resources_dir = "resources/hw1_resources/"; pub fn main(...
CS344/src/hw1_pure.zig
const std = @import("std"); const lib = @import("lib.zig"); const fs = std.fs; const mem = std.mem; const io = std.io; const TangleStep = @This(); const Allocator = std.mem.Allocator; const Builder = std.build.Builder; const Step = std.build.Step; const Parser = lib.Parser; const Interpreter = lib.Interpreter; const S...
lib/TangleStep.zig
const std = @import("std"); const debug = std.debug; pub const IRQ_VECTOR_BASE = 0x50; pub const Cpuid = struct { eax: u32, ebx: u32, ecx: u32, edx: u32, }; pub const CpuInfo = struct { vendorId: [12]u8, family: u32, model: u32, modelName: [48]u8, stepping: u32, // cacheSize: ...
src/kernel/arch/x86/boot/cpu.zig
const Square = @import("../types/enums.zig").Square; const attacks = @import("attacks.zig"); pub const file_masks = [8]u64{ 0x0101010101010101, 0x0202020202020202, 0x0404040404040404, 0x0808080808080808, 0x1010101010101010, 0x2020202020202020, 0x4040404040404040, 0x8080808080808080 }; pub const rank_masks = [8]u64{ 0...
src/bitboards/masks.zig
const std = @import("std"); const input = @import("input.zig"); pub fn run(stdout: anytype) anyerror!void { { var input_ = try input.readFile("inputs/day20"); defer input_.deinit(); const result = try part1(&input_); try stdout.print("20a: {}\n", .{ result }); std.debug.as...
src/day20.zig
const print = @import("std").debug.print; // Oops! const Narcissus = struct { me: *Narcissus = undefined, myself: *Narcissus = undefined, echo: void = undefined, fn fetchTheMostBeautifulType() type { return @This(); } }; pub fn main() void { var narcissus: Narcissus = Narcissus{}; ...
exercises/065_builtins2.zig
const std = @import("std"); const testing = std.testing; const StringTable = @import("./strtab.zig").StringTable; const allocator = std.heap.page_allocator; pub const Food = struct { const Mask = struct { bits: [256]u1, pub fn init() Mask { var self = Mask{ .bits = [_]...
2020/p21/food.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...
2016/day21.zig
// Copyright (c) 2018 <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...
src/unicode/unicode.zig
const std = @import("std"); usingnamespace @import("common.zig"); usingnamespace @import("location.zig"); usingnamespace @import("lexer.zig"); usingnamespace @import("ast.zig"); usingnamespace @import("types.zig"); usingnamespace @import("error_handler.zig"); pub const Parser = struct { allocator: *std....
src/parser.zig
const std = @import("../std.zig"); const builtin = @import("builtin"); const assert = std.debug.assert; const macho = std.macho; const native_arch = builtin.target.cpu.arch; const maxInt = std.math.maxInt; const iovec_const = std.os.iovec_const; extern "c" fn __error() *c_int; pub extern "c" fn NSVersionOfRunTimeLibra...
lib/std/c/darwin.zig
const partOne = 133 * 134 / 2; const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Str = []const u8; const BitSet = std.DynamicBitSet; const StrMap = std.StringHashMap; const HashMap = std.HashMap; const Map = std.AutoHashMap; const PriorityQueue = std.PriorityQueue; cons...
src/day17.zig
const std = @import("std"); const assert = std.debug.assert; const kernel = @import("root"); const lib = kernel.lib; pub const vga = @import("x86/vga.zig"); pub const serial = @import("x86/serial.zig"); pub const pic = @import("x86/pic.zig"); pub const keyboard = @import("x86/keyboard.zig"); pub const mm = @import("x...
kernel/arch/x86.zig
const std = @import("std"); const opt = @import("opt.zig"); const warn = std.debug.warn; const Allocator = std.mem.Allocator; const stdout = &std.io.getStdOut().outStream(); /// Print uniq adjacent lines... no flags yet pub fn uniq(file: std.fs.File, options: PrintOptions) !void { // read first line of input v...
src/uniq.zig
const std = @import("std"); const stdin = std.io.getStdIn().reader(); const stdout = std.io.getStdOut().writer(); fn readInto(arr: []bit, off: usize) !bool { var buf: [1000]u8 = undefined; if (try stdin.readUntilDelimiterOrEof(buf[0..], '\n')) |line| { for (line) |c, i| { arr[i + off] = if ...
day20.zig
const std = @import("std"); const Builder = std.build.Builder; const Pkg = std.build.Pkg; fn addIupReference(step: *std.build.LibExeObjStep) !void { if (step.target.isWindows()) { // workarround, forcing MSVC ABI step.target.abi = .msvc; step.linkSystemLibrary("Gdi32"); step.linkS...
build.zig
const std = @import("std"); const upaya = @import("upaya"); usingnamespace upaya.imgui; pub fn main() !void { upaya.run(.{ .init = init, .update = update, .setupDockLayout = setupDockLayout, .docking = true, }); } fn init() void {} fn update() void { // note: the MenuItems...
examples/docking.zig
const std = @import("std"); const Source = @This(); pub const Id = enum(u32) { unused = 0, generated = 1, _, }; pub const Location = struct { id: Id = .unused, byte_offset: u32 = 0, line: u32 = 0, pub fn eql(a: Location, b: Location) bool { return a.id == b.id and a.byte_offset ==...
src/Source.zig
const std = @import("std"); const ds = @import("ds.zig"); // Stores allocator with data ptr. pub fn Box(comptime T: type) type { if (@typeInfo(T) == .Pointer and @typeInfo(T).Pointer.size == .Slice) { return BoxSlice(T); } else if (@typeInfo(T) == .Struct) { return BoxPtr(T); } @compile...
stdx/ds/box.zig
const std = @import("std"); const stdx = @import("stdx"); const graphics = @import("../../graphics.zig"); const gpu = graphics.gpu; const OpenTypeFont = graphics.OpenTypeFont; const Glyph = gpu.Glyph; const FontId = graphics.FontId; const VMetrics = graphics.VMetrics; const log = std.log.scoped(.font); // Represents ...
graphics/src/backend/gpu/render_font.zig
pub const ENCLAVE_RUNTIME_POLICY_ALLOW_FULL_DEBUG = @as(u32, 1); pub const ENCLAVE_RUNTIME_POLICY_ALLOW_DYNAMIC_DEBUG = @as(u32, 2); pub const ENCLAVE_UNSEAL_FLAG_STALE_KEY = @as(u32, 1); pub const ENCLAVE_FLAG_FULL_DEBUG_ENABLED = @as(u32, 1); pub const ENCLAVE_FLAG_DYNAMIC_DEBUG_ENABLED = @as(u32, 2); pub const ENCLA...
win32/system/environment.zig
const std = @import("std"); const game = @import("game.zig"); const assert = std.debug.assert; const TypeInfo = std.builtin.TypeInfo; /// a concept-like / trait like metafunction to /// check at compile time whether a given argument's type satisfies the /// prng interface necessary for generating a random dice throw f...
src/dice.zig
const std = @import("std"); const core = @import("core"); const sdl = @import("./sdl.zig"); const Coord = core.geometry.Coord; const makeCoord = core.geometry.makeCoord; const Rect = core.geometry.Rect; pub const Button = enum { up, down, left, right, start_attack, start_kick, backspace, ...
src/gui/input_engine.zig
const std = @import("std"); pub const InitFn = fn (std.mem.Allocator) anyerror!void; pub const DeinitFn = fn (std.mem.Allocator) void; pub const FrameFn = fn (FrameInput) anyerror!bool; pub const AudioPlaybackFn = fn (AudioPlaybackStream) anyerror!u32; /// Defines the structure that is passed to the audio playback fn...
modules/platform/src/common.zig
const std = @import("std"); const I = @import("instruments.zig"); const Instrument = I.Instrument; const G = @import("global_config.zig"); const print = std.debug.print; const InstrumentList = std.ArrayList(*Instrument); pub fn benchmarkInstruments(instr: InstrumentList, n_frames: u32) f32 { var begin = std.time....
src/benchmarks.zig
const std = @import("std"); const parser = @import("parser.zig").Parser; const Allocator = std.mem.Allocator; const real = @import("Real.zig"); const Local = enum(u8) { _ }; const Register = enum(u8) { _, pub fn id(n: u8) Register { return @intToEnum(Register, n); } }; // Using an union makes eac...
src/ir.zig
const note_frequencies = @import("zang-12tet"); const c = @import("common/c.zig"); pub const AudioOut = union(enum) { mono: usize, stereo: struct { left: usize, right: usize }, }; pub const KeyBinding = struct { row: u1, key: i32, rel_freq: f32, }; // note: arpeggiator will cycle in this order, s...
examples/common.zig
const std = @import("std"); const testing = std.testing; const expect = testing.expect; const expectEqual = testing.expectEqual; const expectApproxEqRel = testing.expectApproxEqRel; pub const Quaternion = packed struct { x: f32, y: f32, z: f32, w: f32, pub fn init(x: f32, y: f32, z: f32, w: f32) Q...
src/quaternion.zig
const std = @import("std"); const format = @import("format.zig"); const value = @import("value.zig"); const expect = std.testing.expect; pub const encodeValue = @import("encode_value.zig").encodeValue; pub const decodeValue = @import("decode_value.zig").decodeValue; pub const encode = @import("encode.zig").encode; pub...
src/main.zig
const std = @import("std"); const Token = @import("token.zig").Token; const ArrayList = std.ArrayList; const StringHashMap = std.hash_map.StringHashMap; const ParseError = @import("parse_error.zig").ParseError; pub const Node = union(enum) { Document: Document, DocumentType: DocumentType, DocumentFragment:...
src/node.zig
const std = @import("std"); pub const audio_graph = @import("audio_graph.zig"); pub const system = @import("system.zig"); pub const module = @import("module.zig"); pub const modules = module.modules; pub const sample_buffer = @import("sample_buffer.zig"); const Utility = modules.Utility; const SamplePlayer = modules....
src/main.zig
const std = @import("std"); const objects = @import("didot-objects"); const models = @import("didot-models"); const zlm = @import("zlm"); const Allocator = std.mem.Allocator; fn to_f32(value: std.json.Value) f32 { return switch (value) { .Float => |float| @floatCast(f32, float), .Integer => |int| @...
src/scene.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList(usize); const parseUnsigned = std.fmt.parseUnsigned; fn chainAdapters(adapters: []usize, dist: []usize, diff: *ArrayList) !void { var prev: usize = 0; var dx: usize = undefined; for (adapters) |adapter| { ...
2020/zig/src/10.zig
const std = @import("std"); /// Node in filesystem tree pub fn FSNode(comptime T: type, max_name_length: usize) type { return struct { /// Hashmap key & value type pub const HashMapKeyVal = *[]const u8; /// Hashmap context type const HashmapContext = struct { pub fn has...
fsnode.zig
const std = @import("std"); const bld = std.build; const main = @import("src/main.zig"); const Mode = main.Mode; const Testdata = struct { mode: Mode, foldername: []const u8, exp_exit_code: u8, }; // 0123, 3 only with file output, 01 only with check const Testcases = [_]Testdata{ // TODO utf8 control s...
build.zig
const std = @import("std"); const builtin = @import("builtin"); const IsWasm = builtin.target.isWasm(); const stdx = @import("stdx"); const platform = @import("platform"); const Window = platform.Window; const graphics = @import("graphics"); const Color = graphics.Color; const ui = @import("ui"); const TextEditor = ui....
ui/examples/text_demo.zig
const std = @import("std"); const builtin = @import("builtin"); const liu = @import("./lib.zig"); const Vec2 = liu.Vec2; var frame_id: u64 = 0; var time: f64 = undefined; var key_data: [256]KeyInfo = [_]KeyInfo{.{}} ** 256; var dims: @Vector(2, u32) = @Vector(2, u32){ 0, 0 }; var mouse: MouseData = .{}; comptime { ...
src/liu/gamescreen.zig
const std = @import("../std.zig"); const builtin = std.builtin; const fs = std.fs; const File = std.fs.File; test "openSelfExe" { if (builtin.os.tag == .wasi) return error.SkipZigTest; const self_exe_file = try std.fs.openSelfExe(); self_exe_file.close(); } const FILE_LOCK_TEST_SLEEP_TIME = 5 * std.time....
lib/std/fs/test.zig
const std = @import("std"); const testing = std.testing; const zupnp = @import("zupnp"); const SUT = struct { const one = "one"; const two = "two"; const three = "three"; const contents = one ++ two ++ three; const content_type = "test/whatever"; const dest = "/endpoint"; const Endpoint = ...
test/web/test_get_requests.zig
const AllImageFormats = @import("formats/all.zig"); const Allocator = std.mem.Allocator; const Color = color.Color; const ColorStorage = color.ColorStorage; const FormatInterface = @import("format_interface.zig").FormatInterface; const PixelFormat = @import("pixel_format.zig").PixelFormat; const color = @import("color....
src/image.zig
const std = @import("std"); const version = @import("version"); const tar = @import("tar"); const glob = @import("glob"); const zzz = @import("zzz"); const Dependency = @import("Dependency.zig"); usingnamespace @import("common.zig"); const Self = @This(); const Allocator = std.mem.Allocator; arena: std.heap.ArenaAll...
src/Package.zig
const std = @import("std"); const mach = @import("mach"); const gpu = @import("gpu"); const App = mach.App(*FrameParams, .{}); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var allocator = gpa.allocator(); const ctx = try allocator.create(FrameParams); var app = try App.ini...
examples/main.zig
usingnamespace @import("../utils/bitboard.zig"); const console = @import("../utils/console.zig"); const masks = @import("masks.zig"); const Color = @import("../types/enums.zig").Color; const Square = @import("../types/enums.zig").Square; const File = @import("../types/enums.zig").File; const Piece = @import("../type...
src/bitboards/attacks.zig
const std = @import("std"); const string = []const u8; const List = std.ArrayList(string); const extras = @import("extras"); const range = @import("range").range; var singles: std.StringArrayHashMap(string) = undefined; var multis: std.StringArrayHashMap(List) = undefined; pub fn init(alloc: std.mem.Allocator) void {...
src/lib.zig
pub usingnamespace @import("wrapper.zig"); pub const struct___sbuf = extern struct { _base: [*c]u8, _size: c_int, }; pub const FILE = extern struct { _p: [*c]u8, _r: c_int, _w: c_int, _flags: c_short, _file: c_short, _bf: struct___sbuf, _lbfsize: c_int, _cookie: ?*c_void, _...
src/deps/imgui/imgui.zig
const std = @import("std"); const tls = @import("tls.zig"); const enums = @import("enums.zig"); const structs = @import("structs.zig"); pub fn printRecord(record: structs.Record, note: []const u8) anyerror!void { std.debug.print("\n===> {s}\n", .{note}); std.debug.print("Type is {}\n", .{record.type}); std...
src/debug.zig
const std = @import("std"); const mem = std.mem; const io = std.io; const os = std.os; const assert = std.debug.assert; const wayland = @import("wayland"); const wl = wayland.client.wl; const zriver = wayland.client.zriver; const flags = @import("flags"); const usage = \\usage: riverctl [options] <command> ...
source/river-0.1.0/riverctl/main.zig
const std = @import("std"); const vk = @import("vk"); const glfw = @import("glfw"); const imgui = @import("imgui"); const render = @import("render.zig"); const impl_glfw = @import("imgui_impl_glfw.zig"); const impl_vulkan = @import("imgui_impl_vulkan.zig"); const assert = std.debug.assert; const USE_VULKAN_DEBUG_REP...
src/render_vulkan.zig
const std = @import("std"); const ArrayList = std.ArrayList; const print = std.debug.print; const sort = std.sort; const testing = std.testing; const tokenize = std.mem.tokenize; var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; const gpa = gpa_impl.allocator(); const input = @embedFile("./input.txt"); pub fn ...
src/day10/day10.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 StatusList = opaque { pub fn deinit(self: *StatusList) void { log.debug("StatusList.deinit called", .{}); ...
src/status_list.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; const unicode = std.unicode; const ascii = @import("ascii.zig"); // Functionality by popular Unicode General Category. pub const letter = @import("category/letter.zig"); pub const mark = @import("category/mark.zig"); pub const number = @imp...
src/ziglyph.zig
const std = @import("std"); const fs = std.fs; const clock_speed = 500; // 2Mhz const memory_size = 0x10000; // number of values a 16-bit integer can hold pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); const args = try std.process.argsAlloc(allo...
emu/src/main.zig
const c = @cImport({ @cInclude("lauxlib.h"); @cInclude("lua.h"); @cInclude("lundump.h"); @cInclude("lstate.h"); }); const std = @import("std"); const Allocator = std.mem.Allocator; // need a non-opaque struct definition to get at the `top` field const lua_State = extern struct { // common header ...
test/luac.zig
const std = @import("std"); const day1 = @import("day1.zig"); const day2 = @import("day2.zig"); const day3 = @import("day3.zig"); const day4 = @import("day4.zig"); const day5 = @import("day5.zig"); const day6 = @import("day6.zig"); const day7 = @import("day7.zig"); const day8 = @import("day8.zig"); const day9 = @import...
zig/src/main.zig
//-------------------------------------------------------------------------------- // Section: Types (28) //-------------------------------------------------------------------------------- pub const D2D_COLOR_F = extern struct { r: f32, g: f32, b: f32, a: f32, }; pub const D2D1_COLOR_F = extern struct...
win32/graphics/direct2d/common.zig
const std = @import( "std" ); const min = std.math.min; const maxInt = std.math.maxInt; pub usingnamespace @import( "c.zig" ); usingnamespace @import( "util.zig" ); pub const GlzError = error { GenericFailure, }; pub fn glzBufferData( target: GLenum, comptime T: type, values: []const T, usage: GLenum ) void { ...
src/core/glz.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { //[1518-07-10 23:54] Guard #3167 begins shift //[1518-04-15 00:20] falls asleep //[1518-09-30 00:49] wakes up const Shift = struct {...
2018/day04.zig
const std = @import("std"); const zlm = @import("zlm"); const Piece = @import("piece.zig").Piece; const ROM = @import("../rom.zig").ROM; const ROMView = @import("../rom.zig").ROMView; /// The material (color/texture) of a shape. const Material = struct { param: u8, cmd: u8, }; /// The data common to all sha...
src/track/piece_renderer.zig
const std = @import("std"); test "Leading 0's" { const cases = [_]u8{ 0b10000011, 0b01010000, 0b00101000, 0b00010010, 0b00001100, 0b00000110, 0b00000011, 0b00000001, }; for (cases) |case, i| testing.expectEqual(leading_zeros(case), @intCast(u...
src/vint.zig
const std = @import("std"); const builtin = @import("builtin"); 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 ...
build.zig
const std = @import("std"); usingnamespace (@import("../machine.zig")); usingnamespace (@import("../util.zig")); test "AVX-512" { const m32 = Machine.init(.x86_32); const m64 = Machine.init(.x64); const reg = Operand.register; const pred = Operand.registerPredicate; const predRm = Operand.rmPredic...
src/x86/tests/avx_512.zig
const std = @import("std"); const builtin = @import("builtin"); const fmt = std.fmt; const util = @import("util.zig"); const platform = @import("platform.zig"); const Cookie = util.Cookie; const c = @cImport({ @cInclude("wasm3/source/m3_env.h"); }); pub const Error = error{ Unknown, CantCreateEnv, Ca...
kernel/wasm3.zig
const std = @import("std"); const builtin = @import("builtin"); const meta = std.meta; const testing = std.testing; const TypeInfo = std.builtin.TypeInfo; const cudaz_options = @import("cudaz_options"); pub const cu = @import("cuda_cimports.zig").cu; pub const cuda_errors = @import("cuda_errors.zig"); pub const check ...
cudaz/src/cuda.zig
const std = @import("std"); const upaya = @import("upaya"); const data = @import("map.zig"); // var simple_map = @import("runtime_map.zig").Map.init(state.map); // simple_map.saveAsJson("/Users/desaro/Desktop/hi.json"); // var buf = aya.mem.SdlBufferStream.init("/Users/desaro/Desktop/hi.json", .write); // try std.json...
tilescript/runtime_map.zig
const std = @import("std"); const bench = @import("root"); pub fn setup(gpa: std.mem.Allocator, options: *bench.Options) !void { _ = gpa; _ = options; } pub fn run(gpa: std.mem.Allocator, context: void) !void { _ = context; // Benchmarks ported from https://github.com/martinus/map_benchmark const ...
benchmarks/std-hash-map/random-find.zig
const std = @import("std"); const ast = @import("ast.zig"); const gc = @import("gc.zig"); const Interpreter = @import("interpreter.zig").Interpreter; const intrinsics = @import("intrinsics.zig"); /// Interpreter driver program pub fn main() !void { var interpreter = try Interpreter.init(); defer interpreter.de...
src/main.zig
const std = @import("std"); const Type = @import("types.zig").Type; const testing = std.testing; const allocator = std.heap.page_allocator; pub const Status = extern union { byte: Type.Byte, bits: Bits, pub const Name = enum { Carry = 0, Zero = 1, Interrupt = 2, Decimal = ...
src/status.zig
const std = @import("std"); const aoc = @import("aoc-lib.zig"); fn get(bm: *aoc.ByteMap, x: usize, y: usize) usize { var mw = bm.width(); var mh = bm.height(); var v = bm.getXY(x % mw, y % mh) - '0'; v += @intCast(u8, x / mw); v += @intCast(u8, y / mh); while (v > 9) : (v -= 9) {} return @a...
2021/15/aoc.zig
const kernel = @import("../../kernel.zig"); const x86_64 = @import("../x86_64.zig"); const Physical = kernel.Physical; const Virtual = kernel.Virtual; const TODO = kernel.TODO; const log = kernel.log.scoped(.Paging_x86_64); const PML4Table = [512]PML4E; const PDPTable = [512]PDPTE; const PDTable = [512]PDE; const PT...
src/kernel/arch/x86_64/paging.zig
pub const XK_BackSpace = 0xff08; pub const XK_Tab = 0xff09; pub const XK_Return = 0xff0d; pub const XK_Pause = 0xff13; pub const XK_Scroll_Lock = 0xff14; pub const XK_Escape = 0xff1b; pub const XK_Delete = 0xffff; pub const XK_Home = 0xff50; pub const XK_Left = 0xff51; pub const XK_Up = 0xff52; pub const XK_Right = 0xf...
src/xcb/keys.zig
const std = @import("std"); const zang = @import("zang"); const wav = @import("wav"); const example = @import("example_song.zig"); const TOTAL_TIME = 19 * example.AUDIO_SAMPLE_RATE; const bytes_per_sample = switch (example.AUDIO_FORMAT) { .signed8 => 1, .signed16_lsb => 2, }; var g_outputs: [example.Mai...
examples/write_wav.zig
const std = @import("std"); const pactl = @import("./pactl.zig"); const ArgsOption = enum { Volume, Muted, Status, Help, None }; const Args = struct { option: ArgsOption, id: ?pactl.SinkId, pub fn init(allocator: *std.mem.Allocator, iterator: *std.process.ArgIterator) anyerror!Args { _ = iter...
src/main.zig
const std = @import("std"); const format = @import("format.zig"); const value = @import("value.zig"); const expect = std.testing.expect; const Format = format.Format; pub const DecodeError = error{ EmptyInput, TruncatedInput, ReservedFormat, ReservedFormatInInput, InvalidMapKeyType, InvalidType...
src/decode.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const AutoHashMap = std.AutoHashMap; const StringHashMap = std.StringHashMap; // Useful stdlib functions const tokenize = std.mem.tokenize; const split = std.mem.split; const trim = std.mem.trim; const parseInt = std.fmt....
src/day19.zig
const std = @import("std"); var a: *std.mem.Allocator = undefined; const stdout = std.io.getStdOut().writer(); //prepare stdout to write in test "aoc example" { const in = \\abc \\ \\a \\b \\c \\ \\ab \\ac \\ \\a \\a \...
day-06/part-2/lelithium.zig
const std = @import("std"); const engine = @import("kiragine"); usingnamespace engine.kira.log; const check = engine.check; const kira = engine.kira; const ft2 = kira.ft2; const gl = kira.gl; const c = kira.c; const math = kira.math; const Mat4x4f = math.mat4x4.Generic(f32); const Vec3f = math.vec3.Generic(f32); co...
src/tests/font.zig
const std = @import("std"); const debug = std.debug; const io = std.io; const mem = std.mem; const testing = std.testing; /// An array of string<->string that models how to encode and decode /// from any decoding to any other encoding. pub const Char = [2][]const u8; pub const CharMap = []const Char; /// Encode from...
src/core/rom/encoding.zig
const std = @import("std"); const builtin = @import("builtin"); const data = @import("../common/data.zig"); const options = @import("../common/options.zig"); const protocol = @import("../common/protocol.zig"); const rng = @import("../common/rng.zig"); const moves = @import("data/moves.zig"); const species = @import("...
src/lib/gen1/data.zig
const std = @import("std"); const StructField = std.builtin.TypeInfo.StructField; const isSignedInt = std.meta.trait.isSignedInt; const isIntegral = std.meta.trait.isIntegral; // common definitions const ArrayList = std.ArrayList; /// Type of encoding for a Varint value. const VarintType = enum { Simple, ZigZagOptim...
src/protobuf.zig
const nk = @import("nuklear"); const std = @import("std"); const math = std.math; pub fn showcase(ctx: *nk.Context) void { const Static = struct { var progress: u8 = 0; var checkbox_label: bool = false; var checkbox_flags_label: usize = 0; var check_label: bool = false; var...
examples/examples.zig
const std = @import("std.zig"); const builtin = @import("builtin"); const testing = std.testing; const assert = std.debug.assert; const Backoff = std.SpinLock.Backoff; const c = std.c; const os = std.os; const time = std.time; const linux = os.linux; const windows = os.windows; /// A resource object which supports blo...
lib/std/reset_event.zig
const std = @import("std"); const getty = @import("getty"); const Serializer = @import("serializer.zig").Serializer; const Token = @import("common/token.zig").Token; const allocator = std.testing.allocator; test "array" { try t([_]i32{}, &[_]Token{ .{ .Seq = .{ .len = 0 } }, .{ .SeqEnd = .{} }, ...
src/tests/ser/tests.zig
const std = @import("std"); const c = @import("c.zig"); const util = @import("util.zig"); // TODO: calculate this whole error and function below at comptime const CompilationError = error{ // Success = 0 InvalidStage, CompilationError, InternalError, NullResultObject, InvalidAssembly, Vali...
src/shaderc.zig
const std = @import("std"); const string = []const u8; const input = @embedFile("../input/day08.txt"); const constraints = struct { pub const zer: [7]u1 = .{ 1, 1, 1, 0, 1, 1, 1 }; // 0 pub const one: [7]u1 = .{ 0, 0, 1, 0, 0, 1, 0 }; // 1 pub const two: [7]u1 = .{ 1, 0, 1, 1, 1, 0, 1 }; // 2 pub cons...
src/day08.zig
const std = @import("std"); const log = std.log.default; const build_options = @import("build_options"); const c = @import("c.zig"); const program_name = build_options.program_name; const WaylandState = struct { wl_display: ?*c.wl_display = null, wl_registry: ?*c.wl_registry = null, wl_shm: ?*c.wl_shm = n...
src/main.zig