code
stringlengths
38
801k
repo_path
stringlengths
6
263
test "range destructuring" { expectOutput( \\const start:end:step = 1:2:3 \\return start+end+step , "6"); } test "continue" { expectOutput( \\let i = 0 \\while (i < 1) \\ i += 1 \\ continue , "()"); expectOutput( \\for (let i in 0:1) ...
tests/behavior.zig
allocator: Allocator, source: []const u8, filename: []const u8, const std = @import("std"); const Allocator = std.mem.Allocator; const zigstr = @import("zigstr"); const term = @import("term.zig"); const parse = @import("parse/!mod.zig"); const Self = @This(); /// Print a code lens at the given location pub fn prin...
fexc/src/CodeLens.zig
const std = @import("std"); const sample_utils = @import("sample_utils.zig"); const c = @import("c.zig").c; const glfw = @import("glfw"); // #include "utils/SystemUtils.h" // #include "utils/WGPUHelpers.h" // WGPUSwapChain swapchain; // WGPURenderPipeline pipeline; // WGPUTextureFormat swapChainFormat; pub fn main(...
gpu/src/dawn/hello_triangle.zig
const std = @import("std"); const mem = std.mem; const stdout = std.io.getStdOut(); const print = stdout.writer().print; const pdump = @import("src/pdump.zig").pdump; const Hasher = @import("src/swap.zig").Hasher; // const Sha256 = std.crypto.hash.sha2.Sha256; // We will simulate this by having 512 bytes of data, wi...
collide.zig
const std = @import("std"); const Scanner = struct { const Self = @This(); source_code: []const u8, start: usize, current: usize, line: usize, }; var scanner: Scanner = undefined; pub const TokenTag = enum { left_paren, right_paren, left_brace, right_brace, comma, dot, ...
src/scanner.zig
const sg = @import("sokol").gfx; const sapp = @import("sokol").app; const sgapp = @import("sokol").app_gfx_glue; const stm = @import("sokol").time; const saudio = @import("sokol").audio; const assert = @import("std").debug.assert; const math = @import("std").math; // debugging and config options const Audi...
src/pacman.zig
const std = @import("std"); const vk = @import("../../vk.zig"); const RGResource = @import("render_graph_resource.zig").RGResource; const RenderGraph = @import("render_graph.zig").RenderGraph; const SyncPoint = @import("resources/sync_point.zig").SyncPoint; const ResourceList = std.ArrayList(*RGResource); const PassL...
src/renderer/render_graph/render_graph_pass.zig
const std = @import("std"); const zCord = @import("zCord"); const analBuddy = @import("analysis-buddy"); const format = @import("format.zig"); const util = @import("util.zig"); const WorkContext = @This(); allocator: *std.mem.Allocator, zcord_client: zCord.Client, github_auth_token: ?[]const u8, prng: std.rand.Defau...
src/WorkContext.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const mem = std.mem; const trait = std.meta.trait; const asn1 = @import("asn1.zig"); // zig fmt: off // http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8 // @TODO add backing integer, values pub const CurveId = enum { ...
src/x509.zig
usingnamespace @import("raylib-zig.zig"); pub extern fn InitWindow(width: c_int, height: c_int, title: [*c]const u8) void; pub extern fn WindowShouldClose() bool; pub extern fn CloseWindow() void; pub extern fn IsWindowReady() bool; pub extern fn IsWindowMinimized() bool; pub extern fn IsWindowResized() bool; pub exte...
raylib-zig/raylib-wa.zig
const sf = @import("../sfml.zig"); pub const Text = struct { const Self = @This(); // Constructor/destructor /// Inits an empty text pub fn init() !Self { var text = sf.c.sfText_create(); if (text == null) return sf.Error.nullptrUnknownReason; return Self{ .ptr = ...
src/sfml/graphics/text.zig
const std = @import("std"); usingnamespace std.os.windows; pub const WNDPROC = ?extern fn (HWND, UINT, WPARAM, LPARAM) LRESULT; pub const HWND = HANDLE; pub const LPARAM = i64; pub const WPARAM = u64; pub const LRESULT = i64; pub const WNDCLASS = extern struct { style: UINT, wndProc: WNDPROC, cbClsExtra: ...
window.zig
const std = @import("std"); const sling = @import("sling.zig"); const Font = @This(); // I'm sorry about the code youre about to read // please take solace in the fact that is only run once // on load. I will rewrite more zig-like later, and support more // formats. pub const Information = struct { name: []const ...
src/font.zig
const bu = @import("./bits.zig"); // bits utilities const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; // Input bitstream. pub const istream_t = struct { src: [*]const u8, // Source bytes. end: [*]const u8, // Past-the-end byte of src. bitpos: usize, // Position of the next ...
src/bitstream.zig
const std = @import("std"); const Arena = std.heap.ArenaAllocator; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const yeti = @import("yeti"); const initCodebase = yeti.initCodebase; const tokenize = yeti.tokenize; const parse = yeti.parse; const analyzeSemanti...
src/tests/test_binary_op.zig
const std = @import("../std.zig"); const testing = std.testing; const math = std.math; /// Jan 01, 1970 AD pub const posix = 0; /// Jan 01, 1980 AD pub const dos = 315532800; /// Jan 01, 2001 AD pub const ios = 978307200; /// Nov 17, 1858 AD pub const openvms = -3506716800; /// Jan 01, 1900 AD pub const zos = -2208988...
lib/std/time/epoch.zig
const builtin = @import("builtin"); const std = @import("std"); const math = std.math; const assert = std.debug.assert; const normalize = @import("divdf3.zig").normalize; pub fn __fmodh(x: f16, y: f16) callconv(.C) f16 { // TODO: more efficient implementation return @floatCast(f16, fmodf(x, y)); } pub fn fmod...
lib/std/special/compiler_rt/fmod.zig
const std = @import("std"); const Condition = @import("./Condition.zig").Condition; pub fn ArrayBlockingQueue(comptime T: type) type { return struct { const Self = @This(); const Fifo = std.fifo.LinearFifo(T, .Dynamic); capacity: i32 = 0, count: i32 = 0, q...
ArrayBlockingQueue.zig
const std = @import("std"); const math = std.math; const assert = std.debug.assert; const warn = std.debug.warn; pub fn Vec3(comptime T: type) type { return struct { const Self = @This(); pub x: T, pub y: T, pub z: T, pub fn init(x: T, y: T, z: T) Self { return...
src/vec3.zig
const std = @import("std"); const testing = std.testing; const style = @import("ansi-term/src/style.zig"); const Style = style.Style; const FontStyle = style.FontStyle; const Color = style.Color; const ansi_format = @import("ansi-term/src/format.zig"); const LsColors = @import("main.zig").LsColors; const PathComponen...
src/styled_path.zig
const __floatuntitf = @import("floatuntitf.zig").__floatuntitf; const testing = @import("std").testing; fn test__floatuntitf(a: u128, expected: f128) !void { const x = __floatuntitf(a); try testing.expect(x == expected); } test "floatuntitf" { try test__floatuntitf(0, 0.0); try test__floatuntitf(1, 1...
lib/std/special/compiler_rt/floatuntitf_test.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day09.txt"); const Input = struct { heightmap: [100][100]u8 = undefined, dim_x: usize = undefined, dim_y: usize = undefined, pub fn init(input_text: []const u8, allocator: std.mem.Allocator) !@This() { ...
src/day09.zig
const std = @import("std"); const BitSet = std.StaticBitSet(max_size * max_size); const max_size = 100; test "example" { const map = try HeightMap.new(@embedFile("9_example.txt")); try std.testing.expectEqual(@as(usize, 1134), map.threeLargestBasinProduct()); } pub fn main() !void { const map = try Heigh...
shritesh+zig/9b.zig
const std = @import("std"); const Builder = @import("std").build.Builder; pub fn build(b: *Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const version = std.builtin.Version{ .major = 0, .minor = 1, .patch = 0, }; // Fo...
build.zig
const std = @import("std"); const builtin = @import("builtin"); const warn = std.debug.print; const log = std.log; const CAllocator = std.heap.c_allocator; const stdout = std.io.getStdOut(); var LogAllocator = std.heap.loggingAllocator(CAllocator, stdout.outStream()); var GPAllocator = std.heap.GeneralPurposeAllocator(...
src/main.zig
// SPDX-License-Identifier: MIT // This file is part of the Termelot project under the MIT license. const termelot = @import("termelot.zig"); const Position = termelot.Position; const Rune = termelot.Rune; const Size = termelot.Size; /// An Event can be a KeyEvent, MouseEvent, or a new terminal size. /// You can swi...
src/event.zig
const std = @import("std"); const Allocator = mem.Allocator; const mem = std.mem; const ast = std.zig.ast; const Visib = @import("visib.zig").Visib; const event = std.event; const Value = @import("value.zig").Value; const Token = std.zig.Token; const errmsg = @import("errmsg.zig"); const Scope = @import("scope.zig").Sc...
tests/examplefiles/example.zig
const zang = @import("zang"); const common = @import("common.zig"); const c = @import("common/c.zig"); pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb; pub const AUDIO_SAMPLE_RATE = 48000; pub const AUDIO_BUFFER_SIZE = 1024; pub const DESCRIPTION = \\example_stereo \\ \\A wind-like noise effect s...
examples/example_stereo.zig
pub const MDM_COMPRESSION = @as(u32, 1); pub const MDM_ERROR_CONTROL = @as(u32, 2); pub const MDM_FORCED_EC = @as(u32, 4); pub const MDM_CELLULAR = @as(u32, 8); pub const MDM_FLOWCONTROL_HARD = @as(u32, 16); pub const MDM_FLOWCONTROL_SOFT = @as(u32, 32); pub const MDM_CCITT_OVERRIDE = @as(u32, 64); pub const MDM_SPEED_...
win32/devices/communication.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) void { // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const mode = b.standardReleaseOptions(); const target = b.standardTargetOptions(.{}); cons...
build.zig
const std = @import("std"); const path = std.fs.path; const Builder = std.build.Builder; const Step = std.build.Step; /// Utility functionality to help with compiling shaders from build.zig. /// Invokes glslc (or another shader compiler passed to `init`) for each shader /// added via `addShader`. pub const ShaderCompi...
generator/build_integration.zig
const std = @import("std"); const warn = @import("std").debug.warn; const process = std.process; // const operators = @import("Operators"); // comptime { // const operator_info = @typeInfo(operators); // inline for (operator_info.decls) |declaration| { // @compileError("Found '" ++ @typeName(declarati...
Zig/Main.zig
const bld = @import("std").build; const mem = @import("std").mem; const zig = @import("std").zig; fn macosAddSdkDirs(b: *bld.Builder, step: *bld.LibExeObjStep) !void { const sdk_dir = try zig.system.getSDKPath(b.allocator); const framework_dir = try mem.concat(b.allocator, u8, &[_][]const u8 { sdk_dir, "/Syste...
build.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"); /// Unique identity of any object (commit, tree, blob, tag). pub const Oid = extern struct { id: [20]u8, /// Minimum length (in...
src/oid.zig
const std = @import("std"); const cast = std.meta.cast; const mode = std.builtin.mode; // Checked arithmetic is disabled in non-debug modes to avoid side channels /// The function addcarryxU28 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^28 /// out2 = ⌊(arg1 + arg2 + arg3)...
fiat-zig/src/p448_solinas_32.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); } const maxpackets = 32; const Result = struct { qe: u64, s0: u32, progress: u32, targetsize: u32, }; fn dfs(p...
2015/day24.bfs.zig
const std = @import("std"); const gk = @import("../gamekit.zig"); const rk = @import("renderkit"); const fons = @import("fontstash"); pub const FontBook = struct { stash: *fons.Context, texture: ?gk.gfx.Texture, tex_filter: rk.TextureFilter, width: i32 = 0, height: i32 = 0, tex_dirty: bool = fa...
gamekit/graphics/fontbook.zig
const std = @import("std"); const SDL = @import("sdl2"); const Renderer = @import("renderer.zig").Renderer; pub const Window = struct { sdlWindow: SDL.Window = undefined, sdlRenderer: SDL.Renderer = undefined, renderer: *Renderer = undefined, outputTexture: SDL.Texture = undefined, outputTextureR...
src/window.zig
const std = @import("std.zig"); const assert = std.debug.assert; const testing = std.testing; const EnumField = std.builtin.Type.EnumField; /// Returns a struct with a field matching each unique named enum element. /// If the enum is extern and has multiple names for the same value, only /// the first name is used. ...
lib/std/enums.zig
const std = @import("std"); const process = std.process; const elf = std.elf; const fs = std.fs; const io = std.io; const mem = std.mem; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const HashMap = std.HashMap; const AppError = error{ SymsSectionNotFound, StrtabSectionNotFound, Une...
tools/mkimplib.zig
const std = @import("std"); pub const Ripemd160 = struct { bytes: [160 / 8]u8, pub fn hash(str: []const u8) Ripemd160 { var res: Ripemd160 = undefined; var temp: [5]u32 = .{ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 }; var ptr = str.ptr; { // compress string ...
lib/std/crypto/ripemd160.zig
const std = @import("std"); const io = std.io; pub const ogg_stream_marker = "OggS"; // From 'header_type_flag' of https://xiph.org/ogg/doc/framing.html // Potentially useful for the below // "TODO: validate header type flag potentially" //const fresh_packet = 0x00; //const first_page_of_logical_bitstream = 0x02; //...
src/ogg.zig
const std = @import("std"); const fmt = std.fmt; const io = std.io; const mem = std.mem; const process = std.process; var gpa_allocator = std.heap.GeneralPurposeAllocator(.{}){}; var is_zus_paid_in_full: bool = false; var is_second_clif: bool = false; fn usage() !void { const msg = \\Usage: pit <gross_inc...
src/main.zig
const std = @import("std"); /// Because the lexer has already validated that strings don't contain /// any invalid characters, this function can be implemented without /// the possibility of failure. Any failures are a bug in the lexer. /// /// dest_buf must be at least as big as source to ensure it is large enough //...
src/parse_literal.zig
const zfltk = @import("zfltk"); const app = zfltk.app; const widget = zfltk.widget; const window = zfltk.window; const menu = zfltk.menu; const enums = zfltk.enums; const text = zfltk.text; const dialog = zfltk.dialog; pub const Message = enum(usize) { // Can't begin with 0 New = 1, Open, Save, Qui...
examples/editormsgs.zig
//-------------------------------------------------------------------------------- // Section: Types (3) //-------------------------------------------------------------------------------- pub const HARDWARE_COUNTER_TYPE = enum(i32) { PMCCounter = 0, MaxHardwareCounterType = 1, }; pub const PMCCounter = HARDWAR...
win32/system/performance/hardware_counter_profiling.zig
const std = @import("std"); const windows = @import("windows.zig"); const assert = std.debug.assert; const dwrite = @import("dwrite.zig"); const dxgi = @import("dxgi.zig"); const UINT = windows.UINT; const IUnknown = windows.IUnknown; const HRESULT = windows.HRESULT; const GUID = windows.GUID; const WINAPI = windows.WI...
modules/platform/vendored/zwin32/src/d2d1.zig
const std = @import("std"); const builtin = @import("builtin"); const stdx = @import("../../stdx/lib.zig"); pub const pkg = std.build.Pkg{ .name = "sdl", .source = .{ .path = srcPath() ++ "/sdl.zig" }, .dependencies = &.{ stdx.pkg }, }; pub fn addPackage(step: *std.build.LibExeObjStep) void { step.ad...
lib/sdl/lib.zig
const std = @import("std"); const mem = std.mem; const Math = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 43, hi: u21 = 126705, pub fn init(allocator: *mem.Allocator) !Math { var instance = Math{ .allocator = allocator, .array = try allocator.alloc(bool, 126663), }; mem...
src/components/autogen/DerivedCoreProperties/Math.zig
const std = @import("std"); const engine = @import("kiragine"); usingnamespace engine.kira.log; const windowWidth = 1024; const windowHeight = 768; const title = "Packer"; const targetfps = 60; var texture: engine.Texture = undefined; const rect: engine.Rectangle = .{ .x = 500, .y = 380, .width = 32 * 3, .height = 3...
examples/packer.zig
const Version = @import("std").builtin.Version; pub const Word = u32; pub const IdResultType = struct { id: Word, pub fn toRef(self: IdResultType) IdRef { return .{ .id = self.id }; } }; pub const IdResult = struct { id: Word, pub fn toRef(self: IdResult) IdRef { return .{ .id = se...
src/codegen/spirv/spec.zig
const std = @import("std"); const print = std.debug.print; const data = @embedFile("../data/day02.txt"); const Direction = enum(u2) { up, down, forward }; fn day01() !void { var depth : i32 = 0; var position : i32 = 0; var iterator = std.mem.tokenize(data, "\r\n "); var nextCommand : ?Direction...
src/day02.zig
const kernel = @import("kernel.zig"); const log = kernel.log.scoped(.ELF); const FileHeader = extern struct { // e_ident magic: u8 = magic, elf_id: [3]u8 = elf_signature.*, bit_count: u8 = @enumToInt(Bits.b64), endianness: u8 = @enumToInt(Endianness.little), header_version: u8 = 1, ...
src/kernel/elf.zig
const std = @import("std"); const mem = std.mem; const sort = std.sort.sort; const unicode = std.unicode; const CccMap = @import("../DerivedCombiningClass/CccMap.zig"); const HangulMap = @import("../HangulSyllableType/HangulMap.zig"); /// Decomposed is the result of a code point full decomposition. It can be one of: ...
src/components/autogen/UnicodeData/DecomposeMap.zig
pub fn toLower(cp: u21) u21 { return switch (cp) { 0x41 => 0x61, 0x42 => 0x62, 0x43 => 0x63, 0x44 => 0x64, 0x45 => 0x65, 0x46 => 0x66, 0x47 => 0x67, 0x48 => 0x68, 0x49 => 0x69, 0x4A => 0x6A, 0x4B => 0x6B, 0x4C => 0x6C, ...
src/components/autogen/LowerMap.zig
pub const MAPI_OLE = @as(u32, 1); pub const MAPI_OLE_STATIC = @as(u32, 2); pub const MAPI_ORIG = @as(u32, 0); pub const MAPI_TO = @as(u32, 1); pub const MAPI_CC = @as(u32, 2); pub const MAPI_BCC = @as(u32, 3); pub const MAPI_UNREAD = @as(u32, 1); pub const MAPI_RECEIPT_REQUESTED = @as(u32, 2); pub const MAPI_SENT = @as...
win32/system/mapi.zig
const std = @import("std"); const upaya = @import("upaya_cli.zig"); const Texture = @import("texture.zig").Texture; const Point = @import("math/point.zig").Point; /// Image is a CPU side array of color data with some helper methods that can be used to prep data /// before creating a Texture pub const Image = struct { ...
src/image.zig
const std = @import("std"); const analysis = @import("zls/analysis.zig"); const DocumentStore = @import("zls/DocumentStore.zig"); const URI = @import("zls/uri.zig"); const builtins = @import("zls/data/master.zig"); const ast = @import("zls/ast.zig"); const Node = std.zig.Ast.Node; pub fn getFieldAccessType( stor...
src/main.zig
const std = @import("std"); const helper = @import("helper.zig"); const Allocator = std.mem.Allocator; const StringHashMap = std.StringHashMap; const HashMap = std.AutoHashMap; const input = @embedFile("../inputs/day12.txt"); pub fn run(alloc: Allocator, stdout_: anytype) !void { const graph = try CaveGraph.init(...
src/day12.zig
const std = @import("std"); const panic = std.debug.panic; const allocator = std.heap.page_allocator; const utils = @import("utils.zig"); const puts_e = utils.puts_e; const putskv_e = utils.putskv_e; pub const NodeKind = enum { INT, STR, LIST, }; pub const Node = struct { kind: NodeKind, int: ?i...
lib/types.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); var arena ...
2017/day13.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: u2, imm: i32, }; pub fn match_insn(comptime pattern:...
2016/day12.zig
const std = @import("std"); pub const GameOffscreenBuffer = struct { memory: *?[:0]c_uint, width: i32, height: i32, pitch: usize, }; pub const GameSoundOutputBuffer = struct { samples: *[]i16, samplesPerSecond: u32, sampleCount: i32, }; pub const GameButtonState = struct { halfTransit...
src/handmade.zig
const std = @import("std"); const zen = std.os.zen; const Message = zen.Message; const Terminal = zen.Server.Terminal; // Color codes. const Color = enum(u4) { Black = 0, Blue = 1, Green = 2, Cyan = 3, Red = 4, Magenta = 5, Brown = 6, L...
servers/terminal/main.zig
const std = @import("std"); const math = std.math; const meta = std.meta; const fs = std.fs; const os = std.os; const assert = std.debug.assert; const trait = meta.trait; pub const TextAttributes = struct { pub const Color = enum { black, red, green, yellow, blue, ...
src/main.zig
const GameState = @import("game.zig").GameState; const @"u16_2" = @import("game.zig").u16_2; pub const DiscoverSingleEvent = struct { location: u16_2, }; pub const DiscoverManyEvent = struct { location: u16_2, children: []u16_2, }; pub const DiscoverNumberEvent = struct { location: u16_2, childre...
src/minesweeper/event.zig
const std = @import("std"); pub const ByteEnum = enum(u8) { @"🫂" = 200, @"💖" = 50, @"✨" = 10, @"🥺" = 5, @",,,," = 4, @",,," = 3, @",," = 2, @"," = 1, }; /// This is just a namespace for the bottom encoder pub const BottomEncoder = struct { pub const max_expansion_per_byte = 40; ...
src/encoder.zig
const std = @import("std"); usingnamespace (@import("../machine.zig")); usingnamespace (@import("../util.zig")); // QuickRef: https://www.felixcloutier.com/x86/pop const reg = Operand.register; const regRm = Operand.registerRm; const memSib = Operand.memorySibDef; test "pop" { const m16 = Machine.init(.x86_16);...
src/x86/tests/pop.zig
const std = @import("std"); const types = @import("types.zig"); const URI = @import("uri.zig"); const analysis = @import("analysis.zig"); const offsets = @import("offsets.zig"); const log = std.log.scoped(.doc_store); const BuildAssociatedConfig = @import("build_associated_config.zig"); const DocumentStore = @This(); ...
src/document_store.zig
const std = @import("std"); const math = std.math; const expect = std.testing.expect; const trig = @import("trig.zig"); const rem_pio2 = @import("rem_pio2.zig").rem_pio2; const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f; pub fn __sinh(x: f16) callconv(.C) f16 { // TODO: more efficient implementation retu...
lib/std/special/compiler_rt/sin.zig
const std = @import("std"); const Endian = std.builtin.Endian; const assert = std.debug.assert; const link = @import("../../link.zig"); const Module = @import("../../Module.zig"); const ErrorMsg = Module.ErrorMsg; const Liveness = @import("../../Liveness.zig"); const DebugInfoOutput = @import("../../codegen.zig").Debu...
src/arch/sparc64/Emit.zig
const Object = @This(); const Atom = @import("Atom.zig"); const types = @import("types.zig"); const std = @import("std"); const Wasm = @import("../Wasm.zig"); const Symbol = @import("Symbol.zig"); const Allocator = std.mem.Allocator; const leb = std.leb; const meta = std.meta; const log = std.log.scoped(.link); ///...
src/link/Wasm/Object.zig
const std = @import("std"); const mem = std.mem; // Bytes of changeable prefix. This doesn't need to be large, as we // aren't really using it as a key (it will almost always just be // '1'). const prefix_length = 4; // We can use a Sha hasher by appending the prefix to the init. // For Siphash, the prefix will be ...
src/swap.zig
const std = @import("std"); const Feature = @import("enums.zig").Feature; const ErrorType = @import("enums.zig").ErrorType; const ErrorFilter = @import("enums.zig").ErrorFilter; const Limits = @import("data.zig").Limits; const LoggingType = @import("enums.zig").LoggingType; const ErrorCallback = @import("structs.zig")...
gpu/src/Device.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const Source = @import("Source.zig"); const Compilation = @import("Compilation.zig"); const Tree = @import("Tree.zig"); const Diagnostics = @This(); pub const Message = struct { tag: Tag, loc: Source.Location = .{}, extra: E...
src/Diagnostics.zig
const builtin = @import("builtin"); const std = @import("std"); const maxInt = std.math.maxInt; const FLT_MANT_DIG = 24; pub fn __floatundisf(arg: u64) callconv(.C) f32 { @setRuntimeSafety(builtin.is_test); if (arg == 0) return 0; var a = arg; const N: usize = @TypeOf(a).bit_count; // Number of ...
lib/std/special/compiler_rt/floatundisf.zig
const std = @import("std"); const assert = std.debug.assert; const config = @import("config.zig"); const cli = @import("cli.zig"); const IO = @import("io.zig").IO; const MessageBus = @import("message_bus.zig").MessageBusClient; const StateMachine = @import("state_machine.zig").StateMachine; const Operation = StateMac...
src/benchmark.zig
const std = @import("std"); const testing = std.testing; const f128math = @import("f128math"); const math = f128math; const inf_f32 = math.inf_f32; const nan_f32 = math.qnan_f32; const inf_f64 = math.inf_f64; const nan_f64 = math.qnan_f64; const inf_f128 = math.inf_f128; const nan_f128 = math.qnan_f128; const test_ut...
tests/exp.zig
extern fn wl_display_connect(name: ?[*:0]const u8) ?*Display; pub fn connect(name: ?[*:0]const u8) error{ConnectFailed}!*Display { return wl_display_connect(name) orelse return error.ConnectFailed; } extern fn wl_display_connect_to_fd(fd: c_int) ?*Display; pub fn connectToFd(fd: os.fd_t) error{ConnectFailed}!*Disp...
src/client_display_functions.zig
const std = @import("std"); const misc = @import("misc.zig"); const NChooseK = misc.NChooseK; const NChooseKBig = misc.NChooseKBig; // TODO: benchmark this against previous version from 78b055 pub fn Combinations(comptime Element: type, comptime Set: type) type { return struct { nck: Nck, initial_...
src/combinations.zig
const c = @import("c.zig"); const assert = @import("std").debug.assert; // we wrap the c module for 3 reasons: // 1. to avoid accidentally calling the non-thread-safe functions // 2. patch up some of the types to remove nullability // 3. some functions have been augmented by zig_llvm.cpp to be more powerful, // suc...
src-self-hosted/llvm.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; // Define three structs each with a method named `returnSomething` then // in handleReturnType we pass a Type and then use a switch statement // on @typeOf(s.returnSomething).ReturnType. Then in each arm of the switch // we match...
return-type/return-type.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 Ast = ast.Ast; const Kind = Token.Kind; const @"Type" = @import("./type.zig").@"Type"...
src/lang/token/block.zig
const std = @import("std"); pub usingnamespace(@import("types.zig")); const x86 = @import("machine.zig"); const Operand = x86.operand.Operand; const OperandType = x86.operand.OperandType; const ModRm = x86.operand.ModRm; const ModRmResult = x86.operand.ModRmResult; const Register = x86.register.Register; const Machi...
src/x86/avx.zig
const clap = @import("clap"); const std = @import("std"); const debug = std.debug; const io = std.io; const mem = std.mem; const time = std.time; const fs = std.fs; const allocator = std.heap.c_allocator; var timer: ?time.Timer = null; pub fn main() !void { timer = try time.Timer.start(); const params = comp...
src/main.zig
const std = @import("std"); usingnamespace @import("ini.zig"); fn expectNull(record: ?Record) void { std.testing.expectEqual(@as(?Record, null), record); } fn expectSection(heading: []const u8, record: ?Record) void { std.testing.expectEqualStrings(heading, record.?.section); } fn expectKeyValue(key: []cons...
src/test.zig
const std = @import("std"); const build_options = @import("build_options"); const dcommon = @import("../common/dcommon.zig"); const arch = @import("arch.zig"); const hw = @import("../hw.zig"); usingnamespace @import("paging.zig"); fn entryAssert(cond: bool, comptime msg: []const u8) callconv(.Inline) void { if (!...
dainkrnl/src/riscv64/entry.zig
const std = @import("std"); const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; const rl = @import("raylib/src/build.zig"); var ran_git = false; const srcdir = getSrcDir(); fn getSrcDir() []const u8 { return std.fs.path.dirname(@src().file) orelse "."; } pub fn link(exe: *LibExeObjS...
lib.zig
const Vec2 = @import("vec2.zig").Vec2; const Color = @import("color.zig").Color; const std = @import("std"); const imgui = @import("imgui"); const math = std.math; // 3 row, 2 col 2D matrix // // m[0] m[2] m[4] // m[1] m[3] m[5] // // 0: scaleX 2: sin 4: transX // 1: cos 3: scaleY 5: transY // pu...
src/math/mat32.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const assert = std.debug.assert; const Compilation = @import("Compilation.zig"); const Error = Compilation.Error; const Source = @import("Source.zig"); const Tokenizer = @import("Tokenizer.zig"); const RawToken = Tokenizer.Token; const Pa...
src/Preprocessor.zig
const high_bit = 1 << @typeInfo(usize).Int.bits - 1; /// The operation completed successfully. pub const success: usize = 0; /// The image failed to load. pub const load_error: usize = high_bit | 1; /// A parameter was incorrect. pub const invalid_parameter: usize = high_bit | 2; /// The operation is not supported. p...
lib/std/os/uefi/status.zig
usingnamespace @import("math3d.zig"); usingnamespace @import("tetris.zig"); const std = @import("std"); const panic = std.debug.panic; const assert = std.debug.assert; const bufPrint = std.fmt.bufPrint; const c = @import("c.zig"); const debug_gl = @import("debug_gl.zig"); const AllShaders = @import("all_shaders.zig")....
src/main.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); } const Operation = enum { NONE, AND, OR, NOT, LSHIFT, RSHIFT, }; const Wire = [2]u8; const Input = u...
2015/day7.zig
const std = @import("std"); const assert = std.debug.assert; const log = std.log.scoped(.parse); const mem = std.mem; const testing = std.testing; const Allocator = mem.Allocator; const Tokenizer = @import("Tokenizer.zig"); const Token = Tokenizer.Token; const TokenIndex = Tokenizer.TokenIndex; const TokenIterator = T...
src/parse.zig
const std = @import("std"); const log = std.log.scoped(.SPU_2_Interpreter); const spu = @import("../spu-mk2.zig"); const FlagRegister = spu.FlagRegister; const Instruction = spu.Instruction; const ExecutionCondition = spu.ExecutionCondition; pub fn Interpreter(comptime Bus: type) type { return struct { ip:...
src/codegen/spu-mk2/interpreter.zig
const std = @import("std"); /// Resolves a unix-like path and removes all "." and ".." from it. Will not escape the root and can be used to sanitize inputs. pub fn resolvePath(buffer: []u8, src_path: []const u8) error{BufferTooSmall}![]u8 { if (buffer.len == 0) return error.BufferTooSmall; if (src_pat...
src/resolvePath.zig
const std = @import("std"); const math = std.math; pub fn GridSize(comptime width_: usize, comptime height_: usize) type { return struct { const GS = @This(); pub const width = width_; pub const height = height_; pub const len = width * height; pub const widthf = @intToFlo...
lib/gridsize.zig
const std = @import("std"); const alphabet = @import("alphabet.zig"); pub fn KmerInfo(comptime A: type, comptime NumLettersPerKmer: comptime_int) type { return struct { pub const NumLettersPerKmer = NumLettersPerKmer; pub const Alphabet = A; pub const LetterToBitMapType = @typeInfo(@typeInf...
src/bio/kmer.zig
const std = @import("std"); const utils = @import("../utils.zig"); pub const CompressionMethod = enum(u16) { none = 0, shrunk, reduced1, reduced2, reduced3, reduced4, imploded, deflated = 8, enhanced_deflated, dcl_imploded, bzip2 = 12, lzma = 14, ibm_terse = 18, ...
src/formats/zip.zig
const std = @import("std"); const print = std.debug.print; usingnamespace @import("value.zig"); pub const OpCode = enum(u8) { OP_CONSTANT, OP_NIL, OP_TRUE, OP_FALSE, OP_ADD, OP_SUBTRACT, OP_MULTIPLY, OP_DIVIDE, OP_NOT, OP_NEGATE, OP_PRINT, OP_JUMP, OP_JUMP_IF_FALSE,...
zvm/src/chunk.zig