code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const basic_type = @import("basic_type.zig"); const Grid = @import("Grid.zig"); const DynamicTree = @import("DynamicTree.zig"); const Rect = basic_type.Rect; const Vec2 = basic_type.Vec2; const Index = basic_type.Index; const BroadPhase = @This(); const EntityType = enum { sma...
src/physic/BroadPhase.zig
const std = @import("std"); const testing = std.testing; const allocator = std.heap.page_allocator; pub const Map = struct { const SIZE = 100; const Pos = struct { x: usize, y: usize, pub fn init(x: usize, y: usize) Pos { var self = Pos{ .x = x, ...
2020/p20/map.zig
const std = @import("std"); const zfetch = @import("zfetch"); const json = @import("json"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const alloc = &gpa.allocator; const f = try std.fs.cwd().createFile("src/lib.zig", .{}); const w = f.writer(); std.log.info("spdx",...
generate.zig
const std = @import("std"); const bench = @import("bench"); const debug = std.debug; const mem = std.mem; pub fn StringSwitchOriginal(comptime strings: []const []const u8) type { for (strings[1..]) |_, i| { if (mem.lessThan(u8, strings[i], strings[i + 1])) continue; @compileError("Inp...
string-switch.zig
const std = @import("std"); const math = std.math; const common = @import("common.zig"); const FloatInfo = @import("FloatInfo.zig"); const BiasedFp = common.BiasedFp; const Number = common.Number; /// Compute a float using an extended-precision representation. /// /// Fast conversion of a the significant digits and de...
lib/std/fmt/parse_float/convert_eisel_lemire.zig
const std = @import("std"); const Dir = std.fs.Dir; const warn = std.debug.warn; const rt = @import("../runtime.zig"); const FnDecl = rt.TypeInfo.Declaration.Data.FnDecl; const FnMeta = rt.TypeInfo.Fn; const StructMeta = rt.TypeInfo.Struct; const EnumMeta = rt.TypeInfo.Enum; const UnionMeta = rt.TypeInfo.Union; const S...
src/generators/python.zig
const std = @import("std"); const BufferedInStreamCustom = std.io.BufferedInStreamCustom; const BufferedOutStreamCustom = std.io.BufferedOutStreamCustom; const File = std.os.File; const InStreamError = File.ReadError; const OutStreamError = File.WriteError; const InStream = std.io.InStream(InStreamError); const OutStr...
streams/main.zig
const std = @import("std"); const meta = std.meta; const trait = meta.trait; const Allocator = std.mem.Allocator; const testing = std.testing; const assert = std.debug.assert; const mustache = @import("../mustache.zig"); const RenderOptions = mustache.options.RenderOptions; const TemplateOptions = mustache.options.Te...
src/rendering/rendering.zig
const std = @import("std.zig"); const root = @import("root"); const debug = std.debug; const assert = debug.assert; const testing = std.testing; const mem = std.mem; const os = std.os; const builtin = @import("builtin"); const c = std.c; const maxInt = std.math.maxInt; pub const LoggingAllocator = @import("heap/loggin...
lib/std/heap.zig
const std = @import("std"); const netx = @import("netx.zig"); pub const io_mode = .evented; const Pingu = struct { source: union(enum) { none: void, ip: netx.Ipv4Host, iface: []const u8, }, target: []const u8, socket: ?std.fs.File = none, reply_frame: @Frame(handleReplies),...
src/main.zig
const std = @import("std"); const TestContext = @import("../../src/test.zig").TestContext; // These tests should work with all platforms, but we're using linux_x64 for // now for consistency. Will be expanded eventually. const linux_x64 = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, }; pub fn a...
test/stage2/cbe.zig
const std = @import("std"); const system = std.os.system; const assert = std.debug.assert; // https://vorbrodt.blog/2019/02/27/advanced-thread-pool/ pub fn main() !void { return benchPool(NewPool); } const REPS = 10; const SPREAD = 64; const COUNT = 10_000_000; var win_heap = std.heap.HeapAllocator.init(); fn ...
t.zig
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 target is allowed, and the default is native. Other options //...
build.zig
const std = @import("std"); const mem = std.mem; const Wide = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 4352, hi: u21 = 262141, pub fn init(allocator: *mem.Allocator) !Wide { var instance = Wide{ .allocator = allocator, .array = try allocator.alloc(bool, 257790), }; m...
src/components/autogen/DerivedEastAsianWidth/Wide.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day08.txt"); //...
src/day08.zig
pub const OPC_E_NONCONFORMING_URI = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175231)); pub const OPC_E_RELATIVE_URI_REQUIRED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175230)); pub const OPC_E_RELATIONSHIP_URI_REQUIRED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175...
win32/storage/packaging/opc.zig
const std = @import("std"); pub const SinkId = struct { value: []const u8, pub fn eql(self: SinkId, other: SinkId) bool { return std.mem.eql(u8, self.value, other.value); } }; pub const Sink = struct { id: SinkId, volume: u8, muted: bool }; pub fn get_default_sink_id(buffer: []u8) error{NoDe...
src/pactl.zig
const std = @import("std"); const c = @import("internal/c.zig"); const internal = @import("internal/internal.zig"); const log = std.log.scoped(.git); const git = @import("git.zig"); pub const Blame = opaque { pub fn deinit(self: *Blame) void { log.debug("Blame.deinit called", .{}); c.git_blame_fr...
src/blame.zig
const sf = @import("../sfml.zig"); pub const Event = union(Event.Type) { const Self = @This(); pub const Type = enum(c_int) { closed, resized, lostFocus, gainedFocus, textEntered, keyPressed, keyReleased, mouseWheelScrolled, mouseButtonP...
src/sfml/window/event.zig
// DO NOT MODIFY. This is not actually a source file; it is a textual representation of generated code. // Use only for debugging purposes. // Auto-generated constructor // Access: public Method <init> : V ( // (no arguments) ) { ALOAD 0 // Method descriptor: ()V INVOKESPECIAL java/lang/Object#<init>...
localproxyservice/target/generated-sources/gizmo/io/quarkus/deployment/steps/ArcProcessor$generateResources19.zig
const std = @import("std"); const utils = @import("../utils.zig"); const Atomic = std.atomic.Atomic; const Futex = std.Thread.Futex; pub const Lock = extern struct { pub const name = "futex_lock"; state: Atomic(u32) = Atomic(u32).init(UNLOCKED), const UNLOCKED = 0; const LOCKED = 0b01; const CON...
locks/futex_lock.zig
const clap = @import("clap"); const format = @import("format"); const std = @import("std"); const ston = @import("ston"); 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 = ...
src/randomizers/tm35-rand-machines.zig
const std = @import("std"); const FloatStream = @This(); const common = @import("common.zig"); slice: []const u8, offset: usize, underscore_count: usize, pub fn init(s: []const u8) FloatStream { return .{ .slice = s, .offset = 0, .underscore_count = 0 }; } // Returns the offset from the start *excluding* any un...
lib/std/fmt/parse_float/FloatStream.zig
const nds = @import("../nds/index.zig"); const fun = @import("../../lib/fun-with-zig/src/index.zig"); const lu16 = fun.platform.lu16; pub const Stats = packed struct { hp: u8, attack: u8, defense: u8, speed: u8, sp_attack: u8, sp_defense: u8, }; pub const MoveCategory = enum(u8) { Physica...
src/pokemon/common.zig
const GBA = @import("gba").GBA; const Input = @import("gba").Input; const LCD = @import("gba").LCD; const Background = @import("gba").Background; extern const ids8Tiles: [144]c_uint; extern const ids4Pal: [8]c_uint; extern const ids4Tiles: [40]c_uint; const CharacterBlock4 = 0; const ScreenBlock4 = 2; const Characte...
examples/charBlock/charBlock.zig
const std = @import("std"); fn diffuse(xx: u64) u64 { var x = xx *% 0x6eed0e9da4d94a4f; const a = x >> 32; const b = x >> 60; x ^= a >> @intCast(u6, b); return x *% 0x6eed0e9da4d94a4f; } fn read_varint(buf: []const u8) u64 { return @as(u64, switch (@minimum(8, buf.len)) { else => unreachable, 1 =...
src/seahash/seahash.zig
usingnamespace @import("../Zig-PSP/src/psp/include/pspgu.zig"); const psp = @import("../Zig-PSP/src/psp/utils/psp.zig"); var psp_allocator: ?*std.mem.Allocator = null; const Self = @This(); init: bool = false, maxFilter: i32 = 0, minFilter: i32 = 0, repeat: bool = true, width: usize = 0, height: usize = 0, pWidth:...
src/gfx/texture.zig
//! A software version formatted according to the Semantic Version 2 specification. //! //! See: https://semver.org const std = @import("std"); const Version = @This(); major: usize, minor: usize, patch: usize, pre: ?[]const u8 = null, build: ?[]const u8 = null, pub const Range = struct { min: Version, max:...
lib/std/SemanticVersion.zig
const std = @import("std"); const daemon = @import("daemon.zig"); const util = @import("util.zig"); const read = util.read; /// Op code table for incoming messages to a service logger thread pub const LoggerOpCode = enum(u8) { Stop = 1, }; const FdList = std.ArrayList(std.os.fd_t); // When a client adds its fil...
src/service_logger.zig
const std = @import("std"); pub const json = @import("serializer_json.zig"); pub const Configuration = struct { const HashSet = std.StringHashMap(void); allocator: *std.mem.Allocator, ignoredFields: std.StringHashMap(HashSet), pub fn init(allocator: *std.mem.Allocator) Configuration { return...
src/serializer.zig
const std = @import("std"); const math = std.math; const Allocator = std.mem.Allocator; const mem = std.mem; const print = std.debug.print; const FLIR = @import("./FLIR.zig"); const ArrayList = std.ArrayList; const uv = FLIR.uv; const DomState = @This(); sdom: u16 = undefined, ancestor: ?u16 = null, parent: u16 = u...
src/MiniDOM.zig
// Besides, it is not difficult to see that ours is a birth-time // and a period of transition to a new era. Spirit has broken with // the world it has hitherto inhabited and imagined, and is of a // mind to submerge it in the past, and in the labour of its own // transformation. const std = @import("std"); const Arr...
src/vm.zig
pub const ALL_SERVICE_TYPES = @as(u32, 0); pub const HIGHLEVEL_SERVICE_TYPES = @as(u32, 1); pub const LOWLEVEL_SERVICE_TYPES = @as(u32, 2); pub const ALL_SERVICES = @as(u32, 0); pub const ONLINE_SERVICES = @as(u32, 1); pub const OFFLINE_SERVICES = @as(u32, 2); pub const MAX_LEADBYTES = @as(u32, 12); pub const MAX_DEFAU...
deps/zigwin32/win32/globalization.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const testing = std.testing; const unicode = std.unicode; const wbp = @import("../ziglyph.zig").word_break_property; const CodePoint = @import("CodePoint.zig"); const CodePointIterator = CodePoint.CodePointIterator; const emoji = @import("../zi...
src/segmenter/Word.zig
const std = @import("std"); const prot = @import("../protocols.zig"); const Context = @import("../client.zig").Context; const Object = @import("../client.zig").Object; const Positioner = @import("../positioner.zig").Positioner; const Rectangle = @import("../rectangle.zig").Rectangle; fn destroy(context: *Context, xdg_...
src/implementations/xdg_positioner.zig
const std = @import("std"); const upaya = @import("upaya"); const math = upaya.math; const editor = @import("../editor.zig"); const Color = math.Color; usingnamespace @import("imgui"); const Camera = struct { pos: math.Vec2 = .{}, zoom: f32 = 1, pub fn transMat(self: Camera) math.Mat32 { var windo...
examples/editor/windows/scene_view.zig
const std = @import("std"); usingnamespace @import("tigerbeetle.zig"); pub fn main() !void { // TODO We need to move to hex for struct ids as well, since these will usually be random. // Otherwise, we risk overflowing the JSON integer size limit. // TODO Move this file into tigerbeetle.zig as literal test...
src/format_test.zig
const std = @import("std"); const builtin = @import("builtin"); const liu = @import("liu"); // https://github.com/Pagedraw/pagedraw/blob/master/src/frontend/DraggingCanvas.cjsx // clear canvas // draw curves with cursor // create animation/start animation // undo/redo? // object tracking with binary search-ish thing ...
src/routes/painter/painter.zig
const kernel = @import("../../kernel.zig"); const TODO = kernel.TODO; const log = kernel.log.scoped(.Physical); const MemoryMap = @import("memory_map.zig"); var bitset_memory: [0x400_000 + (10 * kernel.arch.page_size)]u8 align(kernel.arch.page_size) = undefined; var bitset_byte_count: u64 = 0; pub var available_regio...
src/kernel/arch/riscv64/physical.zig
const std = @import("std"); const zua = @import("zua.zig"); const Instruction = zua.opcodes.Instruction; const Allocator = std.mem.Allocator; // This is a placeholder implementation to be filled in // as needed pub const GCObject = struct {}; pub const Value = union(Value.Type) { none: void, nil: void, bo...
src/object.zig
const std = @import("std"); const debug = std.debug; const assert = debug.assert; const testing = std.testing; pub fn main() anyerror!void { std.debug.warn("main"); } fn duplicate(comptime T: type) type { return struct { const Self = @This(); list: []const T, pub fn init(list: []T) S...
src/main.zig
const std = @import("std"); const PortIO = @import("port.zig"); // BIOS Data Area (BDA) const bda_base = 0x0400; // address IO ports for COM1-COM4 (`null` if not present) pub var ports: [4]?u16 = undefined; pub const IRQ_AVAIL = 1; // Data available pub const IRQ_EMPTY = 2; // Transmitter empty pub const IRQ_ER...
src/io/serial.zig
usingnamespace @import("std").c.builtins; pub const M3Result = [*c]const u8; pub const IM3Environment = ?*opaque {}; pub const IM3Runtime = ?*opaque {}; pub const IM3Module = ?*opaque {}; pub const IM3Function = ?*opaque {}; pub const M3ErrorInfo = extern struct { result: M3Result, runtime: IM3Runtime, mo...
src/c.zig
const std = @import("std"); 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 findpair(s: []const u8) ?usize { if (s.len < 2) return null; var i: usize = 0; while (i < s.len - 1) ...
2015/day11.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; // TODO this is hard-coded until self-hosted gains this information canonically const available_libcs = [_][]const u8{ "aarch64_be-linux-gnu", "aarch64_be-linux-mus...
src-self-hosted/print_targets.zig
const std = @import("std"); const known = @import("known-folders"); const clap = @import("clap"); const palette = @import("pal/palette.zig"); const replaceWriter = @import("pal/replace_writer.zig").replaceWriter; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const rand = std.rand;...
pal/pal.zig
pub fn main() !void { const file_name = std.fs.path.basename(@src().file); print("\n file: {}\n", .{file_name}); } // basic function that takes two arguments and returns a primitive values. // this function does not return an error, but may trigger a runtime integer // overflow error. fn add(a: i8, b: i8) i8...
05_functions.zig
const std = @import("std"); const testing = std.testing; const fmt = std.fmt; /// Takes a string such as "5d4h3h2s" and returns the number of seconds it represents. /// Available modifiers are: /// d: days /// h: hours /// m: minutes /// s: seconds pub fn seconds(human_string: []const u8) u64 { return humanStringT...
src/humantime.zig
const std = @import("std"); const clap = @import("clap"); const stderr = std.io.getStdErr().writer(); const Options = @This(); const config = @cImport(@cInclude("config.h")); benchmark: u32 = 0, filter: ?[]const u8 = null, init_search: ?[]const u8 = null, show_scores: bool = false, scrolloff: usize = 1, tty_filename...
src/Options.zig
const std = @import("std"); usingnamespace @import("util.zig"); usingnamespace @import("fdt.zig"); pub const Error = error{ Truncated, BadMagic, UnsupportedVersion, BadStructure, Internal, }; pub const Event = union(enum) { BeginNode: []const u8, EndNode, Prop: Prop, End, }; pub c...
src/traverser.zig
const std = @import("std"); const token = @import("../token.zig"); const ast = @import("../ast.zig"); const fieldNames = std.meta.fieldNames; const eq = std.mem.eq; const TokenError = token.TokenError; const Token = token.Token; const Kind = Token.Kind; const Ast = ast.Ast; const enums = std.enums; pub const Block = @i...
src/lang/token/op.zig
const std = @import("std"); const colors = @import("../term/colors.zig"); const Color = colors.Color; const Token = @import("./token.zig").Token; const Fg = colors.Fg; const eq = std.mem.eql; const meta = std.meta; const mem = std.mem; const enums = std.enums; const fieldNames = meta.fieldNames; const Self = Token; pu...
src/lang/fmt.zig
const std = @import("std"); const kernel = @import("root"); const SinglyLinkedList = std.SinglyLinkedList; pub const PrintkSink = fn ([]const u8) void; pub const SinkNode: type = SinglyLinkedList(PrintkSink).Node; var printk_sinks = SinglyLinkedList(PrintkSink){ .first = null }; pub fn register_sink(sink: *SinkNode...
kernel/logging.zig
const std = @import("std"); const mem = std.mem; const allocPrint = std.fmt.allocPrint; const Allocator = mem.Allocator; const Data = @import("Data.zig"); const ptk = @import("parser-toolkit"); pub const Stdlib = @import("Stdlib.zig"); const Inon = @This(); allocator: Allocator, functions: FuncList, context: Data, cu...
src/main.zig
const sf = @import("../sfml_import.zig"); /// Template for a 2 dimensional vector pub fn Vector2(comptime T: type) type { return extern struct { const Self = @This(); /// The CSFML vector type equivalent const CsfmlEquivalent = switch (T) { c_uint => sf.c.sfVector2u, ...
src/sfml/system/vector.zig
const std = @import("std"); const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const Arena = std.heap.ArenaAllocator; const initCodebase = @import("init_codebase.zig").initCodebase; const MockFileSystem = @import("file_system.zig").FileSystem; const analyzeSemantics...
src/error_printer.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const Allocator = mem.Allocator; const c = @import("vulkan.zig"); const maxInt = std.math.maxInt; const WIDTH = 800; const HEIGHT = 600; const MAX_FRAMES_IN_FLIGHT = 2; const enableValidationLayers = std.debug.runtime_safety; const val...
src/main.zig
const std = @import("std"); const Builder = @import("std").build.Builder; const Build = @import("std").build; const Builtin = @import("std").builtin; const Zig = @import("std").zig; const globalflags = [_][]const u8{"-std=c99"}; pub var strip = false; pub fn compileGLFWWin32(exe: *Build.LibExeObjStep, comptime engi...
examples/example_shooter_game/libbuild.zig
test "import" { _ = @import("util.zig"); } pub const ERROR = @import("error.zig"); pub extern "advapi32" stdcallcc fn CryptAcquireContextA( phProv: *HCRYPTPROV, pszContainer: ?LPCSTR, pszProvider: ?LPCSTR, dwProvType: DWORD, dwFlags: DWORD, ) BOOL; pub extern "advapi32" stdcallcc fn CryptRele...
std/os/windows/index.zig
const std = @import("std"); const allocators = @import("allocators.zig"); pub const c = @cImport({ @cDefine("Z_SOLO", {}); @cDefine("ZLIB_CONST", {}); @cInclude("zlib.h"); }); fn zlibAlloc(@"opaque": ?*anyopaque, items: c_uint, size: c_uint) callconv(.C) ?*anyopaque { var temp_alloc = @ptrCast(*allocat...
limp/zlib.zig
const std = @import("std"); const concepts = @import("../../lib.zig").concepts; const concept = "getty.ser.sbt"; pub fn @"getty.ser.sbt"(comptime sbt: anytype) void { const T = if (@TypeOf(sbt) == type) sbt else @TypeOf(sbt); const info = @typeInfo(T); comptime { if (info == .Struct and info.Str...
src/ser/concept/sbt.zig
const std = @import("std"); const mem = std.mem; const ascii = @import("../../ascii.zig"); const Context = @import("../../Context.zig"); const Self = @This(); context: *Context, pub fn new(ctx: *Context) Self { return Self{ .context = ctx }; } /// isPunct detects punctuation characters. Note some punctuation m...
src/components/aggregate/Punct.zig
const std = @import("std"); const mem = std.mem; const LowerMap = @This(); allocator: *mem.Allocator, map: std.AutoHashMap(u21, u21), pub fn init(allocator: *mem.Allocator) !LowerMap { var instance = LowerMap{ .allocator = allocator, .map = std.AutoHashMap(u21, u21).init(allocator), }; t...
src/components/autogen/UnicodeData/LowerMap.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { const allocator = std.heap.page_allocator; var file = try std.fs.cwd().openFile( "./inputs/day03.txt", .{ .read = true, }, ); try part1(allocator, file); try file.seekTo(0...
src/day03.zig
const std = @import("std"); const math = @import("std").math; const Mat2 = @import("mat2.zig").Mat2; const f_eq = @import("utils.zig").f_eq; pub const Vec2 = packed struct { x: f32, y: f32, pub fn create(x: f32, y: f32) Vec2 { return Vec2{ .x = x, .y = y }; } test "create" { const...
src/vec2.zig
const std = @import("std"); const zs = @import("zstack.zig"); const Piece = zs.Piece; /// We implement this specifically and don't use std.rand, since we want to be able to recreate /// an exact piece sequence from a single seed. The implementation is small and it is easier to /// just rely on a small one we write. /...
src/randomizer.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const assert = std.debug.assert; const leb = std.leb; const mem = std.mem; const Module = @import("../Module.zig"); const Decl = Module.Decl; const ir = @import("../ir.zig"); const Inst = ir.Inst; const Type = @import(".....
src/codegen/wasm.zig
const std = @import("std"); const gdt = @import("gdt.zig"); const idt = @import("idt.zig"); const vmem = @import("vmem.zig"); const pmem = @import("pmem.zig"); const pit = @import("pit.zig"); const cmos = @import("cmos.zig"); const serial = @import("../../debug/serial.zig"); const Task = @import("../../task.zig").Task;...
src/kernel/arch/x86/platform.zig
const std = @import("std"); const fun = @import("fun"); const debug = std.debug; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; const scan = fun.scan.scan; pub fn main() !void { const stdin = &(try io.getStdIn()).inStream().stream; const stdout = &(tr...
src/day10.zig
const implode = @import("./implode.zig"); const bs = @import("./bitstream.zig"); const hm = @import("./huffman.zig"); const lz = @import("./lz77.zig"); const bits_utils = @import("./bits.zig"); const hamlet = @embedFile("../fixtures/hamlet.txt"); const std = @import("std"); const allocator = std.testing.allocator; co...
src/implode_test.zig
const std = @import("std"); const lib = @import("lib.zig"); const meta = std.meta; const testing = std.testing; const Linker = lib.Linker; const Parser = lib.Parser; const Instruction = lib.Instruction; const HashMap = std.AutoArrayHashMapUnmanaged; const Allocator = std.mem.Allocator; const Interpreter = @This(); li...
lib/Interpreter.zig
const std = @import("std"); pub fn import_module_start(comptime module: []const u8, comptime flags_ver: []const u8, comptime count: []const u8) []const u8 { return ( \\.set push \\.set noreorder \\.section .rodata.sceResident, "a" \\__stub_modulestr_ ++ module ++ ":\n" ++ ...
src/psp/nids/pspmacros.zig
const std = @import("std"); const Module = @import("../module.zig"); const Op = @import("../op.zig"); const Wat = @import("../wat.zig"); const PostProcess = @This(); import_funcs: []const ImportFunc, jumps: InstrJumps, pub const ImportFunc = struct { module: []const u8, field: []const u8, type_idx: Modu...
src/module/post_process.zig
const std = @import("std"); const Dependency = @import("Dependency.zig"); const Lockfile = @import("Lockfile.zig"); const Self = @This(); const Allocator = std.mem.Allocator; const DepQueue = std.TailQueue(struct { from: *Node, dep: *Dependency, }); arena: std.heap.ArenaAllocator, node_pool: std.ArrayList(*No...
src/DependencyTree.zig
const std = @import("std"); const builtin = @import("builtin"); const TestEnum = enum { TestEnumValue }; const tag_name = @tagName(TestEnum.TestEnumValue); const ptr_tag_name: [*:0]const u8 = tag_name; test "@tagName() returns a string literal" { if (builtin.zig_backend == .stage1) return error.SkipZigTest; // st...
test/behavior/bugs/3779.zig
export fn foo_array() void { comptime { var target = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; const slice = target[0..3 :0]; _ = slice; } } export fn foo_ptr_array() void { comptime { var buf = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; v...
test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig
const std = @import("std"); const version = @import("version"); const zzz = @import("zzz"); const uri = @import("uri"); const api = @import("api.zig"); const utils = @import("utils.zig"); const Self = @This(); const Allocator = std.mem.Allocator; const mem = std.mem; const testing = std.testing; pub const SourceType ...
src/Dependency.zig
const std = @import("std"); const Step = std.build.Step; pub fn build(b: *std.build.Builder) !void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native....
build.zig
/// The function fiatP256AddcarryxU32 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^32 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^32⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffff] /// arg3: [0x0 ~> 0xffffffff] /// Output Bounds: /// out1: [0x0 ...
fiat-zig/src/p256_32.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const EncoderHandler = @import("../encode.zig").EncoderHandler; const HandlerResult = @import("../encode.zig").HandlerResult; const WebEncError = @import("../error.zig").WebEncError; const IoQueue = @import("../io_queue.zig").IoQueue; // https://encodi...
src/encoding/utf8.zig
pub const MARSHALINTERFACE_MIN = @as(u32, 500); pub const ASYNC_MODE_COMPATIBILITY = @as(i32, 1); pub const ASYNC_MODE_DEFAULT = @as(i32, 0); pub const STGTY_REPEAT = @as(i32, 256); pub const STG_TOEND = @as(i32, -1); pub const STG_LAYOUT_SEQUENTIAL = @as(i32, 0); pub const STG_LAYOUT_INTERLEAVED = @as(i32, 1); pub con...
win32/system/com.zig
const builtin = @import("builtin"); const is_test = builtin.is_test; const std = @import("std"); const math = std.math; const expect = std.testing.expect; pub fn floatXiYf(comptime T: type, x: anytype) T { @setRuntimeSafety(is_test); if (x == 0) return 0; // Various constants whose values follow from the...
lib/std/special/compiler_rt/floatXiYf.zig
const std = @import("../std.zig"); const Cpu = std.Target.Cpu; pub const Feature = enum { ext, hwmult16, hwmult32, hwmultf5, }; pub usingnamespace Cpu.Feature.feature_set_fns(Feature); pub const all_features = blk: { const len = @typeInfo(Feature).Enum.fields.len; std.debug.assert(len <= Cpu....
lib/std/target/msp430.zig
const std = @import("../../std.zig"); const os = std.os; const mem = std.mem; const testing = std.testing; const native_os = std.Target.current.os; /// POSIX `iovec`, or Windows `WSABUF`. The difference between the two are the ordering /// of fields, alongside the length being represented as either a ULONG or a size_...
lib/std/x/os/io.zig
const sabaton = @import("root").sabaton; const std = @import("std"); var base: ?u64 = null; const File = packed struct { size: u32, select: u16, reserved: u16, name: [56]u8, pub fn write(self: *const @This(), buffer: []const u8) void { const dma_addr = @intToPtr(*volatile u64, base.? + 16...
src/platform/drivers/fw_cfg.zig
const Register = @import("../../../mmio_register.zig").Register; pub const Uart0 = Uart(0x1001_3000); pub const Uart1 = Uart(0x1002_3000); fn Uart(base_address: usize) type { return struct { pub fn setBaudRate() void { // For now, hardcode to 115200 assuming a 16 MHz tlclk. // Val...
src/target/soc/fe310-g002/uart.zig
const std = @import("std"); const subcommands = @import("subcommands.zig"); const build_options = @import("options"); const builtin = @import("builtin"); pub const is_debug_or_test = builtin.is_test or builtin.mode == .Debug; pub const free_on_close = is_debug_or_test or tracy.enable; const log = std.log.scoped(.shar...
src/shared.zig
const std = @import("std"); const c = @import("c.zig"); const vec3 = @import("scene/vec3.zig"); const Shape = @import("scene/shape.zig").Shape; const Material = @import("scene/material.zig").Material; pub const Scene = struct { const Self = @This(); alloc: *std.mem.Allocator, shapes: std.ArrayList(Shape...
src/scene.zig
const clz = @import("count0bits.zig"); const testing = @import("std").testing; fn test__clzdi2(a: u64, expected: i64) !void { var x = @bitCast(i64, a); var result = clz.__clzdi2(x); try testing.expectEqual(expected, result); } test "clzdi2" { try test__clzdi2(0x00800000_00000000, 8); try test__clz...
lib/std/special/compiler_rt/clzdi2_test.zig
const device = @import("device.zig"); const dtb = @import("dtb.zig"); const log = @import("log.zig"); extern fn __delay(count: i32) void; /// Register offsets. const Reg = enum(u32) { DR = 0x000, RSRECR = 0x004, FR = 0x018, ILPR = 0x020, IBRD = 0x024, FBRD = 0x028, LCR_H = 0x02C, CR =...
pl011.zig
const std = @import("std"); const zangscript = @import("zangscript"); const ParsedBuiltins = @import("zangc/parse_builtins.zig").ParsedBuiltins; const parseBuiltins = @import("zangc/parse_builtins.zig").parseBuiltins; const dumpBuiltins = @import("zangc/dump_builtins.zig").dumpBuiltins; // TODO add an option called `-...
tools/zangc.zig
pub const GL_VERSION_1_1 = @as(u32, 1); pub const GL_ACCUM = @as(u32, 256); pub const GL_LOAD = @as(u32, 257); pub const GL_RETURN = @as(u32, 258); pub const GL_MULT = @as(u32, 259); pub const GL_ADD = @as(u32, 260); pub const GL_NEVER = @as(u32, 512); pub const GL_LESS = @as(u32, 513); pub const GL_EQUAL = @as(u32, 51...
win32/graphics/open_gl.zig
const std = @import("std"); const board = @import("board.zig"); const utils = @import("utils.zig"); const n = board.sum_for_all_positions(board.number_of_moves_for_pawns); fn take_some_slice(slice: []u32) void { slice[1] = 42; } pub fn main() anyerror!void { std.log.info("All your codebase are belong to us....
src/main.zig
const std = @import("std"); const testing = std.testing; pub const c = @cImport({ @cInclude("gravity_compiler.h"); @cInclude("gravity_macros.h"); @cInclude("gravity_core.h"); @cInclude("gravity_vm.h"); @cInclude("gravity_delegate.h"); }); pub const Delegate = @import("delegate.zig").Delegate; pub ...
src/gravity.zig
const std = @import("std"); const mem = std.mem; const print = std.debug.print; const ChildProcess = std.ChildProcess; pub fn dumpArgs(args: []const []const u8) void { for (args) |arg| print("{} ", .{arg}) else print("\n", .{}); } pub fn escapeHtml(allocator: *mem.Allocator, input: []const u8)...
src/doctest/render_utils.zig
const std = @import("std"); const panic = std.debug.panic; const utils = @import("lib/utils.zig"); const print = utils.print; const puts = utils.puts; const puts_fmt = utils.puts_fmt; const print_e = utils.print_e; const puts_e = utils.puts_e; const putskv_e = utils.putskv_e; const puts_fn = utils.puts_fn; const buf...
vgcodegen.zig
const std = @import("std"); const dbg = std.debug; const mem = std.mem; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.direct_allocator); defer arena.deinit(); const allocator = &arena.allocator; var program: [input.len]u32 = undefined; mem.copy(u32, program[0..input.len],...
2019/day02.zig
const std = @import("std"); const root = @import("main.zig"); const tls = root.tls; pub const TlsConfigurationParams = struct { const Self = @This(); pub const Protocol = enum { tls1_0, tls1_1, tls1_2, tls1_3, tls1, all, default, fn native(self: ...
src/tls_config.zig
const std = @import("std"); const mem = std.mem; const net = std.net; const os = std.os; const time = std.time; const IO = @import("tigerbeetle-io").IO; const ClientHandler = struct { io: *IO, sock: os.socket_t, delay_ns: u63, recv_buf: []u8, received: usize = 0, allocator: mem.Allocator, c...
examples/tcp_echo_server_delay.zig
const std = @import("std"); const tokenize = std.mem.tokenize; const split = std.mem.split; const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const parseFloat = std.fmt.parseFloat; const parseInt = std.fmt.parseInt; pub const ObjData = struct { material_libs: []...
src/obj.zig