code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const mem = std.mem;
const ast = @import("ast.zig");
pub const Node = struct {
value: NodeValue,
start_line: u32 = 0,
content: std.ArrayList(u8),
open: bool = true,
last_line_blank: bool = false,
pub fn deinit(self: *Node, allocator: *mem.Allocator) void {
... | src/nodes.zig |
const builtin = @import("builtin");
const std = @import("std");
const Builder = std.build.Builder;
const upaya_build = @import("src/build.zig");
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
// use a different cache folder for macos arm builds
b.cache_root = if (std.builti... | build.zig |
const assert = @import("std").debug.assert;
test "nullable type" {
const x : ?bool = true;
if (x) |y| {
if (y) {
// OK
} else {
unreachable;
}
} else {
unreachable;
}
const next_x : ?i32 = null;
const z = next_x ?? 1234;
assert(z =... | test/cases/null.zig |
const std = @import("std");
pub const cache = ".zigmod/deps";
pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
@setEvalBranchQuota(1_000_000);
for (packages) |pkg| {
exe.addPackage(pkg);
}
if (c_include_dirs.len > 0 or c_source_files.len > 0) {
exe.linkLibC();
}
for (c_inc... | deps.zig |
const std = @import("std");
const mode = @import("builtin").mode; // Checked arithmetic is disabled in non-debug modes to avoid side channels
inline fn cast(comptime DestType: type, target: anytype) DestType {
if (@typeInfo(@TypeOf(target)) == .Int) {
const dest = @typeInfo(DestType).Int;
const so... | fiat-zig/src/poly1305_32.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const c = @import("c.zig");
const odbc = @import("types.zig");
const HandleType = odbc.HandleType;
const SqlReturn = odbc.SqlReturn;
const odbc_error = @import("error.zig");
const ReturnError = odbc_error.ReturnError;
const OdbcError = odbc_error.OdbcEr... | src/environment.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 addcarryxU44 is an addition with carry.
/// Postconditions:
/// out1 = (arg1 + arg2 + arg3) mod 2^44
/// out2 = β(arg1 + arg2 + arg3)... | fiat-zig/src/poly1305_64.zig |
const std = @import("std");
const builtin = @import("builtin");
const c = @cImport({
@cInclude("epoxy/gl.h");
@cInclude("GLFW/glfw3.h");
});
const shader = @import("shader.zig");
const SCREEN_WIDTH: u32 = 800;
const SCREEN_HEIGHT: u32 = 600;
fn handleKey(win: ?*c.GLFWwindow, key: c_int, scancode: c_int, acti... | src/triangle.zig |
//--------------------------------------------------------------------------------
// Section: Types (19)
//--------------------------------------------------------------------------------
const CLSID_CInitiateWinSAT_Value = @import("../zig.zig").Guid.initString("489331dc-f5e0-4528-9fda-45331bf4a571");
pub const CLSID... | win32/system/assessment_tool.zig |
const std = @import("std");
const assert = std.debug.assert;
const log = std.log.scoped(.reloc);
const macho = std.macho;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const reloc = @import("../reloc.zig");
const Allocator = mem.Allocator;
const Relocation = reloc.Relocation;
const Symbol = @impor... | src/link/MachO/reloc/x86_64.zig |
const midi = @import("../midi.zig");
const std = @import("std");
const debug = std.debug;
const io = std.io;
const math = std.math;
const mem = std.mem;
const decode = @This();
fn statusByte(b: u8) ?u7 {
if (@truncate(u1, b >> 7) != 0)
return @truncate(u7, b);
return null;
}
fn readDataByte(reader:... | midi/decode.zig |
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
pub fn Dense(comptime T: type) type {
return DenseCustomSlot(T, u16, u16);
}
pub fn DenseCustomSlot(comptime T: type, comptime slot_index_type: type, comptime slot_salt_type: type) type {
// Both slot index and sa... | slotmap.zig |
const std = @import("std");
pub const Highscores = struct {
const Self = @This();
pub const Entry = struct {
id: usize,
score: isize,
};
allocator: std.mem.Allocator,
entries: []Entry,
pub fn init(allocator: std.mem.Allocator, num_entries: usize) !Self {
std.debug.asse... | src/highscores.zig |
const std = @import("std");
const log = std.log.scoped(.curl);
const c = @cImport({
@cInclude("curl.h");
});
pub usingnamespace c;
pub var inited = false;
pub fn initDefault() c.CURLcode {
return init(c.CURL_GLOBAL_DEFAULT);
}
pub fn init(flags: c_long) c.CURLcode {
defer inited = true;
return c.cu... | lib/curl/curl.zig |
usingnamespace @import("exports.zig");
const CParser = c.yaml_parser_t;
const CEvent = c.yaml_event_t;
const CEventType = c.yaml_event_e;
const CError = c.yaml_error_type_t;
/// A simple abstraction around libyaml's parser. This is for private use only.
/// Most of the resource ownership rules from libyaml still appl... | src/backends/c/parser.zig |
const std = @import("std");
const c = @import("../../c_global.zig").c_imp;
// dross-zig
const Vector2 = @import("../../core/vector2.zig").Vector2;
const tx = @import("../texture.zig");
const Texture = tx.Texture;
// -----------------------------------------------------------------------------
// --------------... | src/renderer/font/glyph.zig |
const std = @import("std");
const print = std.debug.print;
pub fn main() void {
const reader0 = std.io.fixedBufferStream("1234").reader();
var buf0: [4]u8 = undefined;
var foo = reader0.readUntilDelimiter(&buf0, '\n') catch "error";
print("0->{s}<-\n", .{ foo });
foo = reader0.readUntilDelimiter(&... | zig/issue_9594.zig |
const std = @import("std");
const math = std.math;
const max = math.max;
const min = math.min;
const abs = math.fabs;
const hypot = math.hypot;
const ln = math.ln;
const exp = math.exp;
const floor = math.floor;
const ceil = math.ceil;
const pi: f64 = math.pi;
const tau: f64 = 6.28318530717958647;
const sdf2 = @impo... | lib/sdf3.zig |
const std = @import("std");
const builtin = @import("builtin");
const Allocator = std.mem.Allocator;
const x11 = @import("x11.zig");
const wayland = @import("wayland.zig");
const windows = @import("windows.zig");
const xlib = @import("xlib.zig");
pub const PlatformType = enum {
Xlib,
X11,
Wayland,
Win... | didot-zwl/zwl/src/zwl.zig |
const std = @import("std");
const getty = @import("../../../lib.zig");
pub fn Visitor(comptime Array: type) type {
return struct {
allocator: ?std.mem.Allocator = null,
const Self = @This();
const impl = @"impl Visitor"(Array);
pub usingnamespace getty.de.Visitor(
Self... | src/de/impl/visitor/array.zig |
const std = @import("std");
const meta = std.meta;
const testing = std.testing;
const assert = std.debug.assert;
const jsonrpc = @import("jsonrpc.zig");
const kisa = @import("kisa");
const Keys = @import("main.zig").Keys;
const RpcKind = enum { jsonrpc };
const rpcImplementation = RpcKind.jsonrpc;
pub fn Request(comp... | src/rpc.zig |
const std = @import("std");
const expect = std.testing.expect;
pub const TokenList = std.SegmentedList(CToken, 32);
pub const CToken = struct {
id: Id,
bytes: []const u8,
num_lit_suffix: NumLitSuffix = .None,
pub const Id = enum {
CharLit,
StrLit,
NumLitInt,
NumLitFloa... | src-self-hosted/c_tokenizer.zig |
const std = @import("std");
const testing = std.testing;
const TypeId = @import("builtin").TypeId;
const TypeInfo = @import("builtin").TypeInfo;
pub fn DivPair(comptime T: type) type {
return struct {
quotient: T,
modulus: T,
};
}
pub fn signFlag(comptime T: type, val: T) u1 {
if (@typeId(... | src/divInteger.zig |
const nyancore_options = @import("nyancore_options");
const c = @import("../c.zig");
const std = @import("std");
const vk = @import("../vk.zig");
const builtin = @import("builtin");
const Allocator = std.mem.Allocator;
const Application = @import("../application/application.zig").Application;
const printError = @impor... | src/vulkan_wrapper/vulkan_context.zig |
const std = @import("std");
const Random = std.rand.Random;
const expect = std.testing.expect;
const parseInt = std.fmt.parseInt;
const Day = enum {
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
};
const Month = enum {
January = 1,
February,
March,
April,
... | src/main.zig |
const clap = @import("clap");
const std = @import("std");
const ston = @import("ston");
const util = @import("util");
const common = @import("common.zig");
const format = @import("format.zig");
const gen3 = @import("gen3.zig");
const gen4 = @import("gen4.zig");
const gen5 = @import("gen5.zig");
const rom = @import("ro... | src/core/tm35-load.zig |
const std = @import("std");
const parseUnsigned = std.fmt.parseUnsigned;
/// Represents text and background color defined in one of the
/// several color palletes supported by terminal emulators.
pub const Color = union(enum) {
/// Default foreground / background color. Note that many terminal
/// emulators al... | src/style.zig |
const std = @import("std");
const testing = std.testing;
const stringtime = @import("stringtime");
const Lexer = stringtime.Lexer;
const Parser = stringtime.Parser;
test "Lex single character token" {
const TestInput = [_]struct {
input: []const u8,
expected: Lexer.Token,
}{
.{ .input =... | tests/parser_tests.zig |
const std = @import("std");
const clap = @import("clap");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
const stderr = std.io.getStdErr().writer();
const params = comptime [_]clap.Param(clap.Help){
clap.parseParam("-h, --help Display this help and exit.") catch unreachabl... | src/main.zig |
const std = @import("std");
const assert = std.debug.assert;
const Camera = @import("Camera.zig");
const Light = @import("Light.zig");
const Material = @import("Material.zig");
const Mesh = @import("Mesh.zig");
const Renderer = @import("Renderer.zig");
const zp = @import("../../zplay.zig");
const drawcall = zp.graphics... | src/graphics/3d/PhongRenderer.zig |
const std = @import("std");
const raylibFlags = &[_][]const u8{
"-std=gnu99",
"-DPLATFORM_DESKTOP",
"-DGL_SILENCE_DEPRECATION",
"-fno-sanitize=undefined", // https://github.com/raysan5/raylib/issues/1891
};
fn addRayLib(exe: *std.build.LibExeObjStep) void {
exe.addIncludeDir("raylib/include");
... | build.zig |
const builtin = @import("builtin");
const std = @import("std");
const expect = std.testing.expect;
const expectEqualSlices = std.testing.expectEqualSlices;
const expectEqual = std.testing.expectEqual;
const mem = std.mem;
// comptime array passed as slice argument
comptime {
const S = struct {
fn indexOfSc... | test/behavior/slice.zig |
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
const maxInt = std.math.maxInt;
const minInt = std.math.minInt;
/// Returns the binary exponent of x as an integer.
///
/// Special Cases:
/// - ilogb(+-inf) = maxInt(i32)
/// - ilogb(0) = maxInt(i32)
/// - ilogb(nan) ... | lib/std/math/ilogb.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
const DeterministicDie = struct {
current: u8 = 0,
rolls: u16 = 0,
fn roll(self: *DeterministicDie) [1]u8 {
self.current = if (self.current == 100) 1 else self.current + 1;
self.rolls += 1;
return [_]u8{ self.current };... | src/main/zig/2021/day21.zig |
const sabaton = @import("root").sabaton;
const std = @import("std");
var data: []u8 = undefined;
const BE = sabaton.util.BigEndian;
const Header = packed struct {
magic: BE(u32),
totalsize: BE(u32),
off_dt_struct: BE(u32),
off_dt_strings: BE(u32),
off_mem_rsvmap: BE(u32),
version: BE(u32),
last_comp_ve... | src/lib/dtb.zig |
const std = @import("std");
const c = @import("c.zig");
var xfb: *anyopaque = undefined;
var rmode: *c.GXRModeObj = undefined;
export fn main(argc: c_int, argv: [*]const [*:0]const u8) noreturn {
_ = argc;
_ = argv;
// Initialise the video system
c.VIDEO_Init();
// This function initialises the ... | src/main.zig |
const std = @import("std");
const expect = std.testing.expect;
const test_allocator = std.testing.allocator;
const Allocator = std.mem.Allocator;
const Display = struct {
const Self = @This();
allocator: Allocator,
inputs: [][][]const u8,
outputs: [][][]const u8,
pub fn load(allocator: Allocator, ... | day08/src/main.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
pub const main = tools.defaultMain("2021/day05.txt", run);
const Tile = @Vector(2, u2); // [0] only axis aligned, [1] all
const Map = tools.Map(Tile, 1000, 1000, false);
const Vec2 = tools.Vec2;
fn rasterize(map: *Map, a: Ve... | 2021/day05.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectError = std.testing.expectError;
const expectEqual = std.testing.expectEqual;
const mem = std.mem;
test "error values" {
const a = @errorToInt(error.err1);
const b = @errorToInt(error.err2);
try expect(a != b);
}
test "redefinition... | test/behavior/error.zig |
const std = @import("std");
const wayland = @import("wayland.zig");
pub const Object = opaque {};
pub const Message = extern struct {
name: [*:0]const u8,
signature: [*:0]const u8,
types: ?[*]const ?*const Interface,
};
pub const Interface = extern struct {
name: [*:0]const u8,
version: c_int,
... | src/common_core.zig |
const std = @import("std");
const interop = @import("../interop.zig");
const iup = @import("../iup.zig");
const Impl = @import("../impl.zig").Impl;
const CallbackHandler = @import("../callback_handler.zig").CallbackHandler;
const debug = std.debug;
const trait = std.meta.trait;
const Element = iup.Element;
const H... | src/elements/image_rgba.zig |
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const mem = std.mem;
const config = @import("config.zig");
const Client = @import("test/cluster.zig").Client;
const Cluster = @import("test/cluster.zig").Cluster;
const Header = @import("vsr.zig").Header;
const Replica = ... | src/simulator.zig |
const cuckoo = @import("./lib/zig-cuckoofilter.zig");
const redis = @import("./redismodule.zig");
pub const CUCKOO_FILTER_ENCODING_VERSION = 2;
pub var Type8: ?*redis.RedisModuleType = null;
pub var Type16: ?*redis.RedisModuleType = null;
pub var Type32: ?*redis.RedisModuleType = null;
// `s` is the prng state. It's ... | src/t_cuckoofilter.zig |
const std = @import("std");
const testing = std.testing;
const mem = std.mem;
const assert = std.debug.assert;
const kisa = @import("kisa");
/// Text buffer implementation.
const tbi = @import("text_buffer_array.zig");
/// How Server sees a Client.
pub const Client = struct {
id: Workspace.Id,
active_display_s... | src/state.zig |
const Emit = @This();
const std = @import("std");
const math = std.math;
const Mir = @import("Mir.zig");
const bits = @import("bits.zig");
const link = @import("../../link.zig");
const Module = @import("../../Module.zig");
const ErrorMsg = Module.ErrorMsg;
const assert = std.debug.assert;
const DW = std.dwarf;
const l... | src/arch/aarch64/Emit.zig |
const c = @cImport({
@cInclude("epoxy/gl.h");
});
const gl = @import("zgl.zig");
pub const Boolean = c.GLboolean;
pub const Byte = c.GLbyte;
pub const UByte = c.GLubyte;
pub const Char = c.GLchar;
pub const Short = c.GLshort;
pub const UShort = c.GLushort;
pub const Int = c.GLint;
pub const UInt = c.GLuint;
pub c... | types.zig |
const std = @import("std");
const root = @import("main.zig");
const math = std.math;
const expectEqual = std.testing.expectEqual;
const expect = std.testing.expect;
const panic = std.debug.panic;
pub const Vec2 = GenericVector(2, f32);
pub const Vec2_f64 = GenericVector(2, f64);
pub const Vec2_i32 = GenericVector(2, i... | src/generic_vector.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const windows = std.os.windows;
const WNDPROC = fn (windows.HWND, windows.UINT, windows.WPARAM, windows.LPARAM) callconv(windows.WINAPI) windows.LRESULT;
extern "user32" fn MessageBoxW(
hWnd: ?HWND,
lpText: LPCWSTR,
lpCaption: LPCWSTR,
... | src/platform/windows.zig |
const std = @import("std");
const debug = std.debug;
const math = std.math;
const mem = std.mem;
const TypeId = @import("builtin").TypeId;
pub fn main() void {
debug.warn("state {}, rules {}\n", input_initial_state.len, input_rules.len);
debug.warn("state {}, rules {}\n", test_initial_state.len, test_rules.len... | 2018/day_12.zig |
const std = @import("std");
const fs = std.fs;
// {{{ helpers
fn read_from_file(allocator: std.mem.Allocator, filename: []const u8, nlines: u32) ![]u32 {
var file = try fs.cwd().openFile(filename, .{ .read = true });
defer file.close();
var reader = std.io.bufferedReader(file.reader());
var in_strea... | day1/main.zig |
const std = @import("../std.zig");
const debug = std.debug;
const mem = std.mem;
const random = std.crypto.random;
const testing = std.testing;
const Endian = std.builtin.Endian;
const Order = std.math.Order;
/// Compares two arrays in constant time (for a given length) and returns whether they are equal.
/// This fu... | lib/std/crypto/utils.zig |
pub const wide_eastasian = [_][2]u21{
[2]u21{
0x1100,
0x115f,
}, // Hangul Choseong Kiyeok ..Hangul Choseong Filler
[2]u21{
0x231a,
0x231b,
}, // Watch ..Hourglass
[2]u21{
0x2329,
0x232a,
}, // Left-pointing Angle Brac..Right-poi... | src/table_wide.zig |
const std = @import("std");
const ParseIntError = std.fmt.ParseIntError;
const Vec = struct { x: isize, y: isize };
const Dir = struct { c: u8, a: isize };
const dirs = [4]Dir{
Dir{ .c = 'N', .a = 0 },
Dir{ .c = 'E', .a = 90 },
Dir{ .c = 'S', .a = 180 },
Dir{ .c = 'W', .a = 270 },
};
fn turn(dir: *Dir... | 2020/zig/src/12.zig |
const Request = @This();
const std = @import("std");
const uri = @import("uri.zig");
/// Parsed URL from the client's request.
uri: uri.Uri,
/// Parses a request, validates it and then returns a `Request` instance
pub fn parse(reader: anytype, buffer: []u8) Parser(@TypeOf(reader)).Error!Request {
var parser = Par... | src/Request.zig |
const std = @import("std");
const parseFloat = std.fmt.parseFloat;
const parseInt = std.fmt.parseInt;
pub const MaterialData = struct {
materials: std.StringHashMap(Material),
fn deinit(self: *@This()) void {
self.materials.deinit();
}
};
// NOTE: I'm not sure which material statements are optio... | src/mtl.zig |
const std = @import("std");
const util = @import("util.zig");
const uv_util = @import("uv_util.zig");
const c = @import("uv_c.zig").c;
pub const log = util.log;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const alloc = &gpa.allocator;
const DEFAULT_PORT = 3000;
const DEFAULT_BACKLOG = 128;
pub fn main() !void... | src/uv_examples/uvserver.zig |
const c = @cImport({
@cInclude("cfl.h");
@cInclude("cfl_image.h");
});
const widget = @import("widget.zig");
const enums = @import("enums.zig");
const std = @import("std");
const Scheme = enum {
Base,
Gtk,
Plastic,
Gleam,
};
// fltk initizialization of optional functionalities
pub fn init() !v... | src/app.zig |
const std = @import("std");
pub const BuildOptions = struct {
shape_use_32bit_indices: bool = false,
};
pub const BuildOptionsStep = struct {
options: BuildOptions,
step: *std.build.OptionsStep,
pub fn init(b: *std.build.Builder, options: BuildOptions) BuildOptionsStep {
const bos = .{
... | libs/zmesh/build.zig |
const std = @import("std");
const builtin = @import("builtin");
const hzzp = @import("hzzp");
const wz = @import("wz");
const Heartbeat = @import("Client/Heartbeat.zig");
const https = @import("https.zig");
const discord = @import("discord.zig");
const json = @import("json.zig");
const util = @import("util.zig");
co... | src/Client.zig |
const Board = @This();
const std = @import("std");
const assert = std.debug.assert;
const attacks = @import("../bitboards/attacks.zig");
const bitboard = @import("../utils/bitboard.zig");
const console = @import("../utils/console.zig");
const masks = @import("../bitboards/masks.zig");
const Color = @import("enums.zi... | src/types/Board.zig |
const std = @import("std");
const input = @embedFile("data/input04");
usingnamespace @import("util.zig");
pub fn main() !void {
var numValid1: usize = 0;
var numValid2: usize = 0;
var reader = std.mem.split(input, "\n\n");
while (reader.next()) |passport| {
numValid1 += @boolToInt(isValidPassp... | src/day04.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 reverseCircular(list: []u8, index: usize, len: usize) void {
var i: u32 = 0;
cons... | 2017/day14.zig |
const std = @import("std");
const mem = std.mem;
const token = @import("./lang/token.zig");
const builtin = @import("builtin");
const Cmd = @import("./cli.zig").Cmd;
const match = @import("./cli.zig").match;
const process = std.process;
const fs = std.fs;
const ChildProcess = std.ChildProcess;
pub const io_mode = .even... | src/main.zig |
const std = @import("std");
const assert = std.debug.assert;
const log_ = @import("Log.zig");
const errLog_ = log_.errLog;
const dbgLog_ = log_.dbgLog;
const TCPServer = @import("TCPServer.zig");
const c_allocator = std.heap.c_allocator;
const page_allocator = std.heap.page_allocator;
const ObjectPool = @import("Object... | src/TLS.zig |
const std = @import("std");
const sqlite = @import("sqlite");
const manage_main = @import("main.zig");
const libpcre = @import("libpcre");
const Context = manage_main.Context;
const log = std.log.scoped(.als);
const VERSION = "0.0.1";
const HELPTEXT =
\\ als: list file tags
\\
\\ usage:
\\ als path
... | src/ls_main.zig |
pub const PROP_ID_SECURE_MIN = @as(u32, 26608);
pub const PROP_ID_SECURE_MAX = @as(u32, 26623);
pub const MAPI_DIM = @as(u32, 1);
pub const MAPI_P1 = @as(u32, 268435456);
pub const MAPI_SUBMITTED = @as(u32, 2147483648);
pub const MAPI_SHORTTERM = @as(u32, 128);
pub const MAPI_NOTRECIP = @as(u32, 64);
pub const MAPI_THI... | deps/zigwin32/win32/system/address_book.zig |
const std = @import("std");
const builtin = @import("builtin");
const Target = std.Target;
const fs = std.fs;
const Allocator = std.mem.Allocator;
const Batch = std.event.Batch;
const build_options = @import("build_options");
const is_darwin = Target.current.isDarwin();
const is_windows = Target.current.os.tag == .win... | src/libc_installation.zig |
const std = @import("../std.zig");
const mem = std.mem;
const math = std.math;
const debug = std.debug;
const assert = std.debug.assert;
const testing = std.testing;
const htest = @import("test.zig");
const Vector = std.meta.Vector;
pub const State = struct {
pub const BLOCKBYTES = 48;
pub const RATE = 16;
... | lib/std/crypto/gimli.zig |
const std = @import("std.zig");
const debug = std.debug;
const assert = debug.assert;
const testing = std.testing;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const trait = meta.trait;
const autoHash = std.hash.autoHash;
const Wyhash = std.hash.Wyhash;
const Allocator = mem.Allocator;
const hash_... | lib/std/array_hash_map.zig |
const std = @import("std");
const assert = std.debug.assert;
const builtin = std.builtin;
const crypto = std.crypto;
const debug = std.debug;
const Ghash = std.crypto.onetimeauth.Ghash;
const mem = std.mem;
const modes = crypto.core.modes;
pub const Aes128Gcm = AesGcm(crypto.core.aes.Aes128);
pub const Aes256Gcm = Ae... | lib/std/crypto/aes_gcm.zig |
const std = @import("std");
const builtin = @import("builtin");
const ThreadPool = @This();
mutex: std.Thread.Mutex = .{},
is_running: bool = true,
allocator: std.mem.Allocator,
workers: []Worker,
run_queue: RunQueue = .{},
idle_queue: IdleQueue = .{},
const IdleQueue = std.SinglyLinkedList(std.Thread.ResetEvent);
co... | src/ThreadPool.zig |
const std = @import("std");
const fmt = std.fmt;
const fs = std.fs;
const heap = std.heap;
const json = std.json;
const mem = std.mem;
const meta = std.meta;
const os = std.os;
const path = std.fs.path;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const Allocator = mem.Allocator;
cons... | src/dataset_attributes.zig |
const std = @import("std");
const testing = std.testing;
const c = @import("c.zig").c;
pub usingnamespace @import("consts.zig");
pub const Error = @import("errors.zig").Error;
const getError = @import("errors.zig").getError;
pub const action = @import("action.zig");
pub const gamepad_axis = @import("gamepad_axis.zig... | glfw/src/main.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/day10.txt");
//... | src/day10.zig |
const std = @import("std");
const io = std.io;
const Allocator = std.mem.Allocator;
const expect = std.testing.expect;
const test_allocator = std.testing.allocator;
pub fn main() anyerror!void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var allocator = &gpa.allocator;
... | day08/src/main.zig |
// x86 I/O Port Access ========================================================
pub fn out8(port: u16, val: u8) void {
asm volatile ("outb %[val], %[port]" : :
[val] "{al}" (val), [port] "N{dx}" (port));
}
pub fn out16(port: u16, val: u16) void {
asm volatile ("outw %[val], %[port]" : :
[val]... | kernel/platform/util.zig |
const std = @import("std");
const math = std.math;
const init_jk = [_]i32{ 3, 4, 4, 6 }; // initial value for jk
///
/// Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
///
/// integer array, contains the (24*i)-th to (24*i+23)-th
/// bit of 2/pi after binary point. The co... | lib/compiler_rt/rem_pio2_large.zig |
const std = @import("std");
const zzz = @import("zzz");
pub const Config = struct {
allocator: *std.mem.Allocator,
raw: []u8,
bind: []const u8,
port: u16,
vhosts: std.StringHashMap(VHost),
// Only used in evented mode.
client_timeout_seconds: u32 = 10,
max_concurrent_clients: usize = ... | src/config.zig |
const std = @import("std");
test "examples" {
const examples = .{
.{ .input = @embedFile("12_example_1.txt"), .answer = 10 },
.{ .input = @embedFile("12_example_2.txt"), .answer = 19 },
.{ .input = @embedFile("12_example_3.txt"), .answer = 226 },
};
inline for (examples) |example| ... | shritesh+zig/12a.zig |
const std = @import("std");
const assert = std.debug.assert;
const c = @import("c.zig");
pub fn register_function(
env: c.napi_env,
exports: c.napi_value,
comptime name: [:0]const u8,
function: fn (env: c.napi_env, info: c.napi_callback_info) callconv(.C) c.napi_value,
) !void {
var napi_function:... | src/translate.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const meta = std.meta;
const trait = std.meta.trait;
const mustache = @import("../mustache.zig");
const Element = mustache.Element;
const RenderOptions = mustache.options.RenderOptions;
const Delimiters = mustache.Delimiters;
const context = @import("co... | src/rendering/invoker.zig |
const std = @import("std");
const str = []const u8;
const builtin = @import("builtin");
const util = @import("../`util.zig");
const compile = @import("./compile.zig");
const help = @import("./help.zig");
const json = std.json;
const Dir = std.fs.Dir;
const fmt = std.fmt;
const process = std.process;
const ChildProcess... | lib/idpm/src/main.zig |
const builtin = @import("builtin");
const std = @import("../index.zig");
const math = std.math;
const assert = std.debug.assert;
pub fn tan(x: var) @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
f32 => tan32(x),
f64 => tan64(x),
else => @compileError("tan not implemented for " ... | std/math/tan.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
const Allocator = std.mem.Allocator;
const BOARD_SIZE = 5;
const Board = struct {
numbers: std.AutoHashMap(u8, aoc.Coord),
markings: std.AutoHashMap(aoc.Coord, void),
fn init(allocator: Allocator) Board {
return .{
.numbers... | src/main/zig/2021/day04.zig |
const std = @import("std");
const concepts = @import("../../lib.zig").concepts;
const concept = "getty.de.dbt";
pub fn @"getty.de.dbt"(comptime dbt: anytype) void {
const T = if (@TypeOf(dbt) == type) dbt else @TypeOf(dbt);
const info = @typeInfo(T);
comptime {
if (info == .Struct and info.Struc... | src/de/concept/dbt.zig |
const std = @import("std");
const input = @import("input.zig");
pub fn run(allocator: std.mem.Allocator, stdout: anytype) anyerror!void {
{
var input_ = try input.readFile("inputs/day21");
defer input_.deinit();
const result = try part1(&input_);
try stdout.print("21a: {}\n", .{ r... | src/day21.zig |
const m = @import("bits.zig");
const std = @import("std");
const c = @cImport({
@cInclude("lib/zig_ssl_config.h");
@cInclude("mbedtls/entropy.h");
@cInclude("mbedtls/ctr_drbg.h");
@cInclude("mbedtls/net_sockets.h");
@cInclude("mbedtls/ssl.h");
@cInclude("mbedtls/x509.h");
@cInclude("mbedtls/... | src/main.zig |
const std = @import("std");
const testing = std.testing;
pub const YieldResultTag = enum {
result,
end,
};
pub fn YieldResult(comptime T: type) type {
return union(YieldResultTag) {
result: T,
end,
};
}
pub const GeneratorYieldErrorset = error {
EndOfIteration,
};... | src/itertools.zig |
const xcb = @import("../xcb.zig");
pub const id = xcb.Extension{ .name = "Present", .global_id = 0 };
pub const Event = extern enum(c_uint) {
@"ConfigureNotify" = 0,
@"CompleteNotify" = 1,
@"IdleNotify" = 2,
@"RedirectNotify" = 3,
};
pub const EventMask = extern enum(c_uint) {
@"NoEvent" = 0,
... | src/auto/present.zig |
const std = @import("std");
const mem = std.mem;
const net = std.net;
const os = std.os;
const IO = @import("tigerbeetle-io").IO;
fn IoOpContext(comptime ResultType: type) type {
return struct {
frame: anyframe = undefined,
result: ResultType = undefined,
};
}
const ClientHandler = struct {
... | examples/async_tcp_echo_server.zig |
const std = @import("std");
const debug = std.debug;
const allocator = std.heap.page_allocator;
const Shader = @import("Shader.zig").Shader;
const Mesh = @import("Mesh.zig").Mesh;
const assimp = @import("AssImpInterface.zig");
const Camera = @import("Camera.zig").Camera;
const mat4x4 = @import("../math/Mat4x4.zig");
... | src/presentation/Presentation.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");
/// This type bundles all functionality that does not act on an instance of an object
pub const Handle = struct {
/// De-initialize ... | src/handle.zig |
pub const PspUmdInfo = extern struct {
size: c_uint,
typec: c_uint,
};
pub const PspUmdTypes = extern enum(c_int) {
Game = 16,
Video = 32,
Audio = 64,
};
pub const PspUmdState = extern enum(c_int) {
NotPresent = 1,
Present = 2,
Changed = 4,
Initing = 8,
Inited = 16,
Ready =... | src/psp/sdk/pspumd.zig |
const std = @import("std");
const Hash = std.crypto.hash.Md5;
const HashVal = [Hash.digest_length]u8;
const Header = packed struct {
magic : u64 = 0xBF00, // same magic for all bin files, mostly just as format version or for future changes that could potentally keep backwards compatibility if needed
type_hash... | src/bin_file.zig |
const std = @import("std");
const _ast = @import("ast.zig");
const Node = _ast.Node;
const Tag = _ast.Node.Tag;
const NodeList = _ast.NodeList;
const RefList = _ast.RefList;
const lexer = @import("lexer.zig");
const Lexer = lexer.Lexer;
const Token = lexer.Token;
const TokenId = lexer.TokenId;
pub const Error = err... | src/scanner.zig |
const std = @import("std");
const builtin = @import("builtin");
var sqlite3: ?*std.build.LibExeObjStep = null;
fn linkSqlite(b: *std.build.LibExeObjStep) void {
b.linkLibC();
if (sqlite3) |lib| {
b.linkLibrary(lib);
} else {
b.linkSystemLibrary("sqlite3");
}
}
fn getTarget(original_t... | build.zig |
pub const WINTRUST_MAX_HEADER_BYTES_TO_MAP_DEFAULT = @as(u32, 10485760);
pub const WINTRUST_MAX_HASH_BYTES_TO_MAP_DEFAULT = @as(u32, 1048576);
pub const WSS_VERIFY_SEALING = @as(u32, 4);
pub const WSS_INPUT_FLAG_MASK = @as(u32, 7);
pub const WSS_OUT_SEALING_STATUS_VERIFIED = @as(u32, 2147483648);
pub const WSS_OUT_HAS_... | win32/security/win_trust.zig |
//--------------------------------------------------------------------------------
// Section: Types (1)
//--------------------------------------------------------------------------------
const IID_ICoreFrameworkInputViewInterop_Value = Guid.initString("0e3da342-b11c-484b-9c1c-be0d61c2f6c5");
pub const IID_ICoreFramew... | win32/system/win_rt/core_input_view.zig |
const std = @import("std");
const builtin = std.builtin;
const math = std.math;
const mem = std.mem;
const os = std.os;
const testing = std.testing;
const assert = std.debug.assert;
pub const page_size = std.mem.page_size;
/// Maps a chunk of memory from the OS
pub fn alloc(allocation_size: usize) error{OutOfMemory... | page_alloc.zig |
const std = @import("std");
const Date = @import("date.zig");
const config = @import("config.zig");
const util = @import("util.zig");
const Styles = @import("cli.zig").Styles;
content: []const u8,
due: ?Date,
completed: bool,
index: ?usize = null,
const Self = @This();
/// The higher the number, the less "urgent" th... | src/task.zig |