code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const sdl = @import("sdl"); const gk = @import("gamekit"); const gfx = gk.gfx; const math = gk.math; pub const renderer: gk.renderkit.Renderer = .opengl; var rng = std.rand.DefaultPrng.init(0x12345678); const total_textures: usize = 8; const max_sprites_per_batch: usize = 5000; const tota...
examples/batcher.zig
const std = @import("std"); const print = std.debug.print; const mem = std.mem; const spi = @import("bus/spi.zig"); const MAX_PAYLOAD_SIZE = 256; const SPI_BUFFER_SIZE = 128; const MAX_WAIT = 250; const SLEEP = std.time.ns_per_ms * 10; //Registers const UBX_SYNCH_1: u8 = 0xB5; const UBX_SYNCH_2: u8 = 0x62; //The ...
src/gnss.zig
const libssz = @import("./main.zig"); const serialize = libssz.serialize; const deserialize = libssz.deserialize; const chunkCount = libssz.chunkCount; const hashTreeRoot = libssz.hashTreeRoot; const std = @import("std"); const ArrayList = std.ArrayList; const expect = std.testing.expect; const sha256 = std.crypto.hash...
src/tests.zig
const Dump = @import("json").Dump; const std = @import("std"); const Allocator = std.mem.Allocator; const event = std.event; const io = std.io; const json = std.json; const mem = std.mem; const warn = std.debug.warn; pub const json_rpc_version = "2.0"; const content_length = "Content-Length"; const default_message_si...
src/lsp/jsonrpc2/jsonrpc2.zig
pub usingnamespace @import("std").c.builtins; pub const max_align_t = struct_unnamed_1; pub const enum_channel = extern enum(c_int) { EBUR128_UNUSED = 0, EBUR128_LEFT = 1, EBUR128_Mp030 = 1, EBUR128_RIGHT = 2, EBUR128_Mm030 = 2, EBUR128_CENTER = 3, EBUR128_Mp000 = 3, EBUR128_LEFT_SURROUN...
src/c.zig
const x86_64 = @import("../index.zig"); const std = @import("std"); const Portu8 = x86_64.structures.port.Portu8; const writeU8 = x86_64.instructions.port.writeU8; const DATA_READY: u8 = 1; const OUTPUT_READY: u8 = 1 << 5; pub const COMPort = enum { COM1, COM2, COM3, COM4, fn toPort(com_port: CO...
src/additional/serial_port.zig
const std = @import("std"); const zfetch = @import("zfetch"); const lib = @import("main.zig"); const model = lib.model; const parser = lib.parser; pub const Client = struct { const Self = @This(); allocator: std.mem.Allocator, headers: zfetch.Headers, pub fn init(allocator: std.mem.Allocator) !Clien...
src/client.zig
const std = @import("std"); const mem = std.mem; const fmt = std.fmt; const testing = std.testing; use @import("ip"); test "IpV6Address.segments()" { testing.expectEqual([8]u16{ 0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff }, IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).segments()); } test "IpV6Address.octets(...
test/ipv6.zig
const clz = @import("count0bits.zig"); const std = @import("std"); const math = std.math; const builtin = @import("builtin"); // mulv - multiplication oVerflow // * @panic, if result can not be represented // * assume usize shows available register size for usage // - mulvXi_genericFast for generic performance impleme...
src/crt/mulv.zig
const clap = @import("clap"); const format = @import("format"); const std = @import("std"); const util = @import("util"); const ascii = std.ascii; const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; co...
src/other/tm35-generate-site.zig
pub const PspAudioFormats = extern enum(c_int) { Stereo = 0, Mono = 16, _, }; pub const PspAudioInputParams = extern struct { unknown1: c_int, gain: c_int, unknown2: c_int, unknown3: c_int, unknown4: c_int, unknown5: c_int, }; // Allocate and initialize a hardware output channel. //...
src/psp/sdk/pspaudio.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 random...
benchmarks/std-hash-map/random-distinct.zig
const std = @import("std"); const stdx = @import("stdx"); const graphics = @import("graphics"); const Color = graphics.Color; const ui = @import("../ui.zig"); const log = stdx.log.scoped(.text); const NullId = std.math.maxInt(u32); pub const Text = struct { props: struct { text: ?[]const u8, font...
ui/src/widgets/text.zig
const expect = std.testing.expect; const expectEqualSlices = std.testing.expectEqualSlices; const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const FixedHeader = @import("../packet.zig").Packet.FixedHeader; const QoS = @import("../../qos.zig").QoS; pub const ReturnCode =...
src/mqtt4/packet/suback.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const input = @embedFile("../inputs/day11_sample.txt"); // const input = @embedFile("../inputs/day11.txt"); fn printGrid(grid: anytype) void { for (grid) |row, y| { for (row) |s...
src/day11.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; const StringTable = @import("./strtab.zig").StringTable; pub const Map = struct { const Caves = std.ArrayList(usize); slack: bool, caves: StringTable, neighbors: std.AutoHashMap(usize, *Caves), seen: ...
2021/p12/map.zig
const math = @import("../math/math.zig"); pub const MovementDirection = enum { up, left, right }; pub const PlayerListener = struct { onPositionChanged: fn(listener: *PlayerListener, position: math.Vec3)void, pub fn notifyPositionChanged(self: *PlayerListener, position: math.Vec3)void { self.onPosition...
src/game/player.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const TailQueue = std.TailQueue(IntType); const Node = TailQueue.Node; const input = @embedFile("../inputs/day03.txt"); const IntType = u16; const int_size = @bitSizeOf(IntType); var real_length: i32 = 0; pub fn run(alloc: Allocator, stdout_: anytype)...
src/day03.zig
const sf = @import("../sfml.zig"); pub const Time = struct { const Self = @This(); // Constructors /// Converts a time from a csfml object /// For inner workings pub fn fromCSFML(time: sf.c.sfTime) Self { return Self{ .us = time.microseconds }; } /// Converts a time to a csfml o...
src/sfml/system/time.zig
const std = @import("std"); const printf = std.debug.print; const fs = std.fs; const os = std.os; const net = std.net; const fmt = std.fmt; const math = std.math; const Address = std.net.Address; const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const dev = @import("./src/dev.zig"); const router =...
main.zig
const std = @import("std"); const fmt = std.fmt; const hash_map = std.hash_map; const heap = std.heap; const mem = std.mem; const testing = std.testing; const Metric = @import("metric.zig").Metric; pub const Counter = @import("Counter.zig"); pub const Gauge = @import("Gauge.zig").Gauge; pub const Histogram = @import("...
src/main.zig
const struct__iobuf = extern struct { _ptr: [*c]u8, _cnt: c_int, _base: [*c]u8, _flag: c_int, _file: c_int, _charbuf: c_int, _bufsiz: c_int, _tmpfname: [*c]u8, }; const FILE = struct__iobuf; pub const ImGuiID = c_uint; pub const ImS8 = i8; pub const ImGuiTableColumnIdx = ImS8; // cimgui....
src/deps/imgui/c.zig
const std = @import("std"); const main = @import("main.zig"); const httpclient = @import("httpclient.zig"); const testing = std.testing; test "integration: passing a well-formed .pi-file against healthy endpoint shall generate a successful result" { var args = [_][]const u8{ "testdata/integrationtests/stan...
src/integration_test.zig
const builtin = @import("builtin"); const mem = @import("std").mem; const zen = if (builtin.os == builtin.Os.zen) @import("std").os.zen else @import("../kernel/x86.zig"); // VRAM buffer address in physical memory. pub const VRAM_ADDR = 0xB8000; pub const VRAM_SIZE = 0x8000; // Screen size. pub const VGA_WIDTH...
lib/tty.zig
const builtin = @import("builtin"); const std = @import("std.zig"); const os = std.os; const mem = std.mem; const base64 = std.base64; const crypto = std.crypto; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const math = std.math; const is_darwin = std.Target.current.os.tag.isDarwin(); pub con...
lib/std/fs.zig
const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const Allocator = std.mem.Allocator; const Module = @import("../Module.zig"); const fs = std.fs; const codegen = @import("../codegen/c.zig"); const link = @import("../link.zig"); const File = link.File; const C = @This(); pub const base_...
src-self-hosted/link/C.zig
const std = @import("../../std.zig"); const math = std.math; const mem = std.mem; const BlockVec = [4]u32; /// A single AES block. pub const Block = struct { pub const block_length: usize = 16; /// Internal representation of a block. repr: BlockVec align(16), /// Convert a byte sequence into an int...
lib/std/crypto/aes/soft.zig
const std = @import("std"); const json = std.json; // JSON Types pub const String = []const u8; pub const Integer = i64; pub const Float = f64; pub const Bool = bool; pub const Array = json.Array; pub const Object = json.ObjectMap; // pub const Any = @TypeOf(var); // Basic structures pub const DocumentUri = String...
src/types.zig
const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const Allocator = mem.Allocator; // const ArrayList = std.ArrayList; const ByteList = std.ArrayListAlignedUnmanaged([]u8, null); const GlobalAlloc = std.heap.GeneralPurposeAllocator(.{}); // general purpose global allocator for small a...
src/liu/allocators.zig
const std = @import("std"); const freetype = @import("freetype"); const OutlinePrinter = struct { library: freetype.Library, face: freetype.Face, output_file: std.fs.File, path_stream: std.io.FixedBufferStream([]u8), xMin: isize, yMin: isize, width: isize, height: isize, const Sel...
freetype/examples/glyph-to-svg.zig
const print = @import("std").debug.print; // The grue is a nod to Zork. const TripError = error{ Unreachable, EatenByAGrue }; // Let's start with the Places on the map. Each has a name and a // distance or difficulty of travel (as judged by the hermit). // // Note that we declare the places as mutable (var) because w...
exercises/058_quiz7.zig
pub const HP = struct { val: f64, off: f64, }; pub const lookup_table = []HP{ HP{.val=1.000000e+308, .off= -1.097906362944045488e+291 }, HP{.val=1.000000e+307, .off= 1.396894023974354241e+290 }, HP{.val=1.000000e+306, .off= -1.721606459673645508e+289 }, HP{.val=1.000000e+305, .off= 6.0746447...
std/fmt/errol/lookup.zig
const std = @import("std"); const assert = std.debug.assert; const os = std.os.windows; const window_name = "generative art experiment 6"; const window_width = 2 * 1024; const window_height = 2 * 1024; const State = struct { image: []f32, y: u32 = 0, }; fn update(state: *State) void { var row: u32 = 0; ...
src/main.zig
const fmath = @import("index.zig"); pub fn fmod(comptime T: type, x: T, y: T) -> T { switch (T) { f32 => @inlineCall(fmod32, x, y), f64 => @inlineCall(fmod64, x, y), else => @compileError("fmod not implemented for " ++ @typeName(T)), } } fn fmod32(x: f32, y: f32) -> f32 { var ux = ...
src/fmod.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const debug = std.debug; const parse = @import("parse.zig"); const compile = @import("compile.zig"); const exec = @import("exec.zig"); const Parser = parse.Parser; const Expr = parse.Expr; const Compiler = compile.Compi...
src/regex.zig
const cpu = @import("cpu.zig"); const debug = @import("debug.zig"); const Cpu = cpu.Cpu; pub const Instruction = fn (cpu: *Cpu, halfword: u16) void; pub const INST_TABLE = [64]Instruction{ // 000000 - 001111 cpu.mov, cpu.add, cpu.sub, cpu.cmp, cpu.shl, cpu.shr, cpu.jmp, cpu.sar, cpu.m...
src/cpu/ops.zig
const std = @import("std"); const assert = std.debug.assert; const allocator = std.heap.page_allocator; pub const IntBuf = struct { data: []i64, pw: usize, pr: usize, pub fn init(size: usize) IntBuf { var self = IntBuf{ .data = undefined, .pw = 0, .pr = 0, ...
2019/p15/computer.zig
pub const D3D11_16BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 65535); pub const D3D11_32BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 4294967295); pub const D3D11_8BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 255); pub const D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT = @as(u32, 9); pub const D3D11_CLIP_OR_CULL_DISTANCE_COUNT = @as(u32, 8); pub ...
win32/graphics/direct3d11.zig
const std = @import("std"); const arm_cmse = @import("../drivers/arm_cmse.zig"); const arm_m = @import("../drivers/arm_m.zig"); const an505 = @import("../drivers/an505.zig"); extern var __nsc_start: usize; extern var __nsc_end: usize; export fn main() void { // Enable SecureFault, UsageFault, BusFault, and MemMa...
src/secure/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const nitori = @import("nitori"); const communication = nitori.communication; const Channel = communication.Channel; const EventChannel = communication.EventChannel; const ChunkIterMut = nitori.chunks.ChunkIterMut; const Timer = nitori.timer.Timer; //; ...
src/system.zig
const std = @import("std"); usingnamespace @import("shared.zig"); var tag_collection: std.StringHashMap(void) = undefined; var allocator: *std.mem.Allocator = undefined; var string_arena: *std.mem.Allocator = undefined; pub fn main() !u8 { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.dei...
tools/adder.zig
const sf = struct { pub usingnamespace @import("../sfml.zig"); pub usingnamespace sf.system; pub usingnamespace sf.graphics; }; const RenderTexture = @This(); // Constructor/destructor /// Inits a render texture with a size (use createWithDepthBuffer if you want a depth buffer) pub fn create(size: sf.Ve...
src/sfml/graphics/RenderTexture.zig
usingnamespace @import("root").preamble; pub fn Bitset(num_bits: usize) type { const num_bytes = libalign.alignUp(usize, 8, num_bits) / 8; return struct { pub fn set(self: *@This(), idx: usize) void { data[idx / 8] |= (@as(u8, 1) << @intCast(u3, idx % 8)); } pub fn unset(s...
lib/util/bitset.zig
const std = @import("std"); const testing = std.testing; pub const Tokenizer = struct { arena: std.heap.ArenaAllocator, index: usize, bytes: []const u8, error_text: []const u8, state: State, pub fn init(allocator: *std.mem.Allocator, bytes: []const u8) Tokenizer { return Tokenizer{ ...
src-self-hosted/dep_tokenizer.zig
const std = @import("std"); const builtin = @import("builtin"); const zinput = @import("zinput"); const known_folders = @import("known-folders"); fn print(comptime fmt: []const u8, args: anytype) void { const stdout = std.io.getStdOut().writer(); stdout.print(fmt, args) catch @panic("Could not write to stdout"...
src/setup.zig
const std = @import("std"); /// A discontiguous list made of blocks of contiguous elements. /// /// Each block takes a single allocation from the underlying allocator /// and is doubly-linked to the blocks next to it. /// /// When the current block is full, an attempt will be made to expand it /// in place before crea...
src/block_list.zig
const std = @import("std"); const print = std.debug.print; const data = @embedFile("../data/day17.txt"); pub fn main() !void { var timer = try std.time.Timer.start(); print("🎁 Max Height: {}\n", .{try highestY(data)}); print("Day 17 - part 01 took {:15}ns\n", .{timer.lap()}); timer.reset(); print("🎁 Tota...
src/day17.zig
const std = @import("std"); const assert = std.debug.assert; const wren = @import("./wren.zig"); const Vm = @import("./vm.zig").Vm; const Configuration = @import("./vm.zig").Configuration; const ErrorType = @import("./vm.zig").ErrorType; const WrenError = @import("./error.zig").WrenError; const EmptyUserData = struct...
src/zapata/call.zig
usingnamespace @import("psptypes.zig"); pub const SceKernelLMOption = extern struct { size: SceSize, mpidtext: SceUID, mpiddata: SceUID, flags: c_uint, position: u8, access: u8, creserved: [2]u8, }; pub const SceKernelSMOption = extern struct { size: SceSize, mpidstack: SceUID, ...
src/psp/sdk/pspmodulemgr.zig
const std = @import("std"); const mem = std.mem; const fmt = std.fmt; const unicode = std.unicode; const testing = std.testing; const nfd_check = @import("../ziglyph.zig").derived_normalization_props; iter: usize, entries: std.ArrayList(Entry), implicits: std.ArrayList(Implicit), const AllKeysFile = @This(); pub c...
src/collator/AllKeysFile.zig
const std = @import("std"); const stdx = @import("stdx"); const ds = stdx.ds; const log = std.log.scoped(.tasks); const server = @import("server.zig"); const TaskResult = @import("work_queue.zig").TaskResult; /// Task that invokes a function with allocated args. pub fn ClosureTask(comptime func: anytype) type { co...
runtime/tasks.zig
const std = @import("std"); const DocumentStore = @import("document_store.zig"); const analysis = @import("analysis.zig"); const types = @import("types.zig"); const offsets = @import("offsets.zig"); const log = std.log.scoped(.references); const ast = std.zig.ast; fn tokenReference( handle: *DocumentStore.Handle,...
src/references.zig
const std = @import("std"); const ascii = std.ascii; const fmt = std.fmt; const heap = std.heap; const io = std.io; const log = std.log; const mem = std.mem; const process = std.process; const niceware = @import("niceware.zig"); const usage = \\Usage: niceware <command> [argument] \\ \\Commands: \\ fr...
src/main.zig
const std = @import("std"); const warn = std.debug.warn; const Ram = @import("ram.zig").Ram; const Opcode = @import("opcode.zig").Opcode; const OpcodeEnum = @import("enum.zig").OpcodeEnum; const AddressingModeEnum = @import("enum.zig").AddressingModeEnum; const IrqTypeEnum = @import("enum.zig").IrqTypeEnum; pub const ...
src/cpu.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); } fn abs(a: i32) u32 { return if (a > 0) @intCast(u32, a) else @intCast(u32, -a); } const...
2017/day3.zig
const sf = @import("sfml"); pub fn main() !void { inline for ([3]type{ sf.Vector2f, sf.Vector2i, sf.Vector2u }) |T| { var vecf = T{ .x = 0, .y = 0 }; var c = vecf.toCSFML(); vecf = T.fromCSFML(c); _ = vecf.add(vecf); _ = vecf.substract(vecf); _ = vecf.scale(1); ...
src/sfml/doc_generation.zig
const wlr = @import("../wlroots.zig"); const std = @import("std"); const os = std.os; const wayland = @import("wayland"); const wl = wayland.server.wl; const pixman = @import("pixman"); pub const SceneNode = extern struct { pub const Type = enum(c_int) { root, tree, surface, rect...
src/types/scene.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const warn = std.debug.warn; const Allocator = std.mem.Allocator; pub const max_num_lit = 286; pub const max_bits_limit = 16; const max_i32 = math.maxInt(i32); pub var fixed_literal_encoding = &Huffman.generateFixedLiteralEncoding();...
src/compress/flate/huffman.zig
const std = @import("std"); const zlib = std.compress.zlib; const Allocator = std.mem.Allocator; const ArrayListUnmanaged = std.ArrayListUnmanaged; const File = std.fs.File; const Reader = File.Reader; pub const AsepriteImportError = error{ InvalidFile, InvalidFrameHeader, }; pub const ChunkType = enum(u16)...
tatl.zig
const std = @import("std"); const c = @cImport({ @cInclude("bitfield-workaround.h"); @cInclude("aws/common/allocator.h"); @cInclude("aws/common/error.h"); @cInclude("aws/common/string.h"); @cInclude("aws/auth/auth.h"); @cInclude("aws/auth/credentials.h"); @cInclude("aws/auth/signable.h"); ...
src/awshttp.zig
const std = @import("std"); const pkmn = @import("pkmn"); pub fn main() !void { // Set up required to be able to parse command line arguments var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); const args = try std.process.a...
src/examples/zig/example.zig
const std = @import("std"); const os = std.os; const linux = std.os.linux; const LinearFifo = std.fifo.LinearFifo; const LinearFifoBufferType = std.fifo.LinearFifoBufferType; const FdBuffer = LinearFifo(i32, LinearFifoBufferType{ .Static = MAX_FDS }); pub const MAX_FDS = 28; pub fn recvMsg(fd: i32, buffer: []u8, fds:...
src/wl/txrx.zig
const std = @import("std"); const prot = @import("../protocols.zig"); const compositor = @import("../compositor.zig"); const Context = @import("../client.zig").Context; const Object = @import("../client.zig").Object; const Window = @import("../window.zig").Window; const XdgConfiguration = @import("../window.zig").XdgCo...
src/implementations/xdg_toplevel.zig
pub const layout: []const u8 = \\layout(push_constant) uniform PushConstants { \\ layout(offset = 16) vec3 eye; \\ layout(offset = 32) vec3 up; \\ layout(offset = 48) vec3 forward; \\} pushConstants; \\layout (location = 0) in vec2 inUV; \\layout (location = 0) out vec4 outColor; \\ ;...
src/sdf/shader_templates.zig
usingnamespace @import("std").builtin; /// Deprecated pub const arch = Target.current.cpu.arch; /// Deprecated pub const endian = Target.current.cpu.arch.endian(); /// Zig version. When writing code that supports multiple versions of Zig, prefer /// feature detection (i.e. with `@hasDecl` or `@hasField`) over version ...
zig/zig-cache/o/751a3ea851d83239eddb7cfe69e8766e/builtin.zig
const std = @import("std"); //const concepts = @import("concepts.zig"); //TODO: maybe remove because we don't need that //const hasFn = std.meta.trait.hasFn; /// A helper metafunction to identify if some generic type satisfies the interface / trait /// for a picking strategy. /// This is a crutch, because I cannot ge...
src/game.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); } const Arg = union(enum) { reg: u5, imm: i64, }; pub fn match_insn(comptime pattern:...
2017/day23.zig
const std = @import("std"); const expect = std.testing.expect; fn Node(comptime T: type) type { return struct { value: T, parent: ?*Node(T) = null, left: ?*Node(T) = null, right: ?*Node(T) = null, }; } /// References: Introduction to algorithms / <NAME>...[et al.]. -3rd ed. fn ...
search_trees/binary_search_tree.zig
const std = @import("std"); const builtin = @import("builtin"); pub const Node = struct { next: ?*Node, }; /// Multi producer single consumer unbounded atomic queue. /// Consumer is responsible for managing memory for nodes. pub fn MPSCUnboundedQueue(comptime T: type, comptime member_name: []const u8) type { ...
src/lib/atomic_queue.zig
const std = @import("std"); usingnamespace @import("kiragine").kira.log; const engine = @import("kiragine"); fn draw() !void { engine.clearScreen(0.1, 0.1, 0.1, 1.0); // Push the pixel batch, it can't be mixed with any other try engine.pushBatch2D(engine.Renderer2DBatchTag.pixels); // Draw pi...
examples/custombatch.zig
const std = @import("std"); const bitjuggle = @import("bitjuggle"); const PrivilegeLevel = @import("types.zig").PrivilegeLevel; const IntegerRegister = @import("types.zig").IntegerRegister; const ExceptionCode = @import("types.zig").ExceptionCode; const ContextStatus = @import("types.zig").ContextStatus; const VectorMo...
lib/csr.zig
const std = @import("std"); const log = std.log; const cuda = @import("cudaz"); const cu = cuda.cu; const ARRAY_SIZE = 100; pub fn main() anyerror!void { var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; const alloc = general_purpose_allocator.allocator(); const args = try std.proce...
CS344/src/lesson2.zig
const c = @import("c.zig"); const nk = @import("../nuklear.zig"); const std = @import("std"); const mem = std.mem; const testing = std.testing; const Str = @This(); c: c.struct_nk_str, pub fn init(allocator: *mem.Allocator, size: usize) Str { var res: Str = undefined; c.nk_str_init(&res.c, &nk.allocator(all...
src/Str.zig
const std = @import("std"); const assert = std.debug.assert; const os = std.os; const linux = os.linux; const IO_Uring = linux.IO_Uring; const io_uring_cqe = linux.io_uring_cqe; const io_uring_sqe = linux.io_uring_sqe; const log = std.log.scoped(.io); const config = @import("../config.zig"); const FIFO = @import("../f...
src/io/linux.zig
const std = @import("../std.zig"); const builtin = @import("builtin"); const mem = std.mem; const debug = std.debug; const testing = std.testing; const warn = debug.warn; const meta = @import("../meta.zig"); //This is necessary if we want to return generic functions directly because of how the // the type erasure wor...
lib/std/meta/trait.zig
const std = @import("std.zig"); const builtin = @import("builtin"); const os = std.os; const assert = std.debug.assert; const windows = os.windows; const testing = std.testing; const SpinLock = std.SpinLock; const ResetEvent = std.ResetEvent; /// Lock may be held only once. If the same thread tries to acquire /// the ...
lib/std/mutex.zig
const std = @import("std"); const fs = std.fs; const io = std.io; const mem = std.mem; const Allocator = mem.Allocator; const Target = std.Target; const assert = std.debug.assert; const introspect = @import("introspect.zig"); // TODO this is hard-coded until self-hosted gains this information canonically const availa...
src-self-hosted/print_targets.zig
const Dwarf = @This(); const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const fs = std.fs; const leb128 = std.leb; const log = std.log.scoped(.dwarf); const mem = std.mem; const link = @import("../link.zig"); const trace = @import("../tracy.zig").trace; const Allocator...
src/link/Dwarf.zig
const std = @import("../../../std.zig"); const linux = std.os.linux; const socklen_t = linux.socklen_t; const iovec = linux.iovec; const iovec_const = linux.iovec_const; const uid_t = linux.uid_t; const gid_t = linux.gid_t; const pid_t = linux.pid_t; pub const SYS = extern enum(usize) { pub const Linux = 4000; ...
lib/std/os/bits/linux/mips.zig
const builtin = @import("builtin"); const std = @import("std"); // fmodq - floating modulo large, returns the remainder of division for f128 types // Logic and flow heavily inspired by MUSL fmodl for 113 mantissa digits pub fn fmodq(a: f128, b: f128) callconv(.C) f128 { @setRuntimeSafety(builtin.is_test); var ...
lib/std/special/compiler_rt/floatfmodq.zig
const std = @import("std"); const math = std.math; const meta = std.meta; const Optimized = std.builtin.FloatMode.Optimized; // PRIVATE UTILITIES: // helper function for constants to work with both vectors and scalars inline fn splat(comptime t: type, val: anytype) t { @setFloatMode(Optimized); comptime if (...
src/fn_deriv.zig
pub const COMPOSITIONOBJECT_READ = @as(i32, 1); pub const COMPOSITIONOBJECT_WRITE = @as(i32, 2); pub const DCOMPOSITION_MAX_WAITFORCOMPOSITORCLOCK_OBJECTS = @as(u32, 32); pub const COMPOSITION_STATS_MAX_TARGETS = @as(u32, 256); //-------------------------------------------------------------------------------- // Secti...
win32/graphics/direct_composition.zig
const std = @import("std"); const testing = std.testing; pub const Map = struct { pub const Navigation = enum { Direction, Waypoint, }; // +----------------> // | y-- X // | N // | ^ // | W < X > E // | x-- v x++ // | S ...
2020/p12/map.zig
const std = @import("std"); const allocator = std.heap.c_allocator; const c = @import("c_imports.zig").c; const Config = @import("config.zig").Config; const EditorHighlight = @import("defines.zig").EditorHighlight; const TAB_STOP = @import("defines.zig").TAB_STOP; const SyntaxFlags = @import("syntax.zig").SyntaxFl...
.save/texteditor/buffer.zig
const std = @import("std"); const builtin = std.builtin; const debug = std.debug; const heap = std.heap; const mem = std.mem; const process = std.process; const testing = std.testing; /// An example of what methods should be implemented on an arg iterator. pub const ExampleArgIterator = struct { const Error = err...
zig-clap/clap/args.zig
const std = @import("std"); const time = std.time; const Timer = time.Timer; const smaz = @import("main.zig"); const examples = @import("examples.zig").examples; const KiB = 1024; const MiB = 1024 * KiB; inline fn compress() !usize { const iterations = 10000; var i: usize = 0; while (i < iterations) : (i...
src/benchmark.zig
const std = @import("std"); const Blake3 = std.crypto.Blake3; const b64 = std.base64.standard_encoder; const fnv = std.hash.Fnv1a_64; const TagMap = std.AutoHashMap([]const u8, std.SegmentedList([]const u8, 2)); const TagType = enum { topic, author, medium, license, isbn, doi, language }; // required tags for a succ...
src/main.zig
pub const uart_mmio_32 = @import("uart_mmio_32.zig"); pub const status_uart_mmio_32 = @import("status_uart_mmio_32.zig"); const sabaton = @import("root").sabaton; const fmt = @import("std").fmt; pub const putchar = sabaton.platform.io.putchar; const Printer = struct { pub fn writeAll(self: *const Printer, str: ...
src/io/io.zig
const std = @import("std"); const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; const builtin = @import("builtin"); const CrossTarget = std.zig.CrossTarget; const panic = std.debug.panic; const stdout = std.io.getStdOut().outStream(); pub fn build(b: *Builder) !void { const teensy = ...
build.zig
const std = @import("std"); const assert = std.debug.assert; const math = std.math; const mem = std.mem; const bs = @import("./bitstream.zig"); const bits_utils = @import("./bits.zig"); const UINT8_MAX = math.maxInt(u8); const UINT16_MAX = math.maxInt(u16); const CHAR_BIT = 8; const MIN_CODE_SIZE = 9; const MAX_COD...
src/shrink.zig
const std = @import("std"); const c = @import("c.zig"); const utils = @import("utils.zig"); pub const Vector = extern struct { x: c_long, y: c_long, }; pub const Matrix = extern struct { xx: c_long, xy: c_long, yx: c_long, yy: c_long, }; pub const BBox = extern struct { xMin: c_long, yM...
freetype/src/types.zig
const std = @import("std"); const string = []const u8; const range = @import("range").range; const input = @embedFile("../input/day13.txt"); const Point = struct { x: u32, y: u32, }; const Fold = struct { axis: Axis, cardinal: u32, const Axis = enum { x, y }; }; const Grid = [][]u1; pub fn mai...
src/day13.zig
const std = @import("std"); const io = std.io; const File = std.fs.File; const ArrayList = std.ArrayList; const Bf = struct { const TAPE_LEN = 30000; stdin: File, stdout: File, pc: usize, tape: [TAPE_LEN]u8, ptr: usize, // undefined behaviour if ptr is outside the bounds of tape stack: ...
bf.zig
const std = @import("std"); const mem = std.mem; const assert = std.debug.assert; const target = 2020; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{ .safety = true, .enable_memory_limit = true }){}; const allocator = &gpa.allocator; defer { const bytesUsed = gpa.total_request...
src/day01.zig
const std = @import("std"); const tools = @import("tools"); const Planet = struct { parent: []const u8, childs: u32 = 0, }; const Hash = std.StringHashMap(Planet); pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { var table = Hash.init(allocator); defer table.deinit(); ...
2019/day06.zig
const std = @import("std"); const debug = std.debug; const fmt = std.fmt; const mem = std.mem; pub fn main() !void { var result = try solitary_rect(input_03); debug.assert(result == 412); debug.warn("03-2: {}\n", result); } fn solitary_rect(input: []const []const u8) !usize { var allocator = std.heap....
2018/day_03_2.zig
const std = @import("std"); const builtin = std.builtin; const math = std.math; const mem = std.mem; const meta = std.meta; const testing = std.testing; const debug = std.debug; const TypeInfo = builtin.TypeInfo; const sort = std.sort.sort; const RecursiveField = @import("recursive_field.zig").RecursiveField; /// ...
src/dyn_rec_field_value.zig
const std = @import("std"); const os = std.os; const io = std.io; const mem = std.mem; const warn = std.debug.warn; const assert = std.debug.assert; const math = std.math; const proto = @import("protocol.zig"); const builtin = @import("builtin"); const json = @import("./zson/src/main.zig"); pub const ReadError = os.Fi...
src/rpc.zig
const std = @import("std.zig"); const mem = std.mem; const builtin = std.builtin; /// TODO Nearly all the functions in this namespace would be /// better off if https://github.com/ziglang/zig/issues/425 /// was solved. pub const Target = union(enum) { Native: void, Cross: Cross, pub const Os = enum { ...
lib/std/target.zig
const std = @import("../index.zig"); const os = std.os; const expect = std.testing.expect; const io = std.io; const mem = std.mem; const a = std.debug.global_allocator; const builtin = @import("builtin"); const AtomicRmwOp = builtin.AtomicRmwOp; const AtomicOrder = builtin.AtomicOrder; test "makePath, put some files...
std/os/test.zig