code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const os = std.os;
const mem = std.mem;
const net = std.net;
const testing = std.testing;
const assert = std.debug.assert;
// For testing slow and fast clients.
const delay_time = std.time.ns_per_ms * 100;
const clients_count = 40;
// 1. Connect
// 2. Write
// 3. Disconnect
const how_many_e... | poc/poll_sockets.zig |
const std = @import("std");
const stdx = @import("stdx");
const build_options = @import("build_options");
const Backend = build_options.GraphicsBackend;
const platform = @import("platform");
const vk = @import("vk");
const graphics = @import("graphics.zig");
const gpu = graphics.gpu;
const gvk = graphics.vk;
/// A Re... | graphics/src/renderer.zig |
const std = @import("std");
extern fn strncpy(dest: [*:0]u8, src: [*:0]const u8, n: usize) callconv(.C) [*:0]u8;
extern fn memset(dest: ?[*]u8, c: u8, n: usize) callconv(.C) ?[*]u8;
extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8;
extern fn memmove(dest: ?[*]u8, src: ?[... | lib/std/special/ssp.zig |
const std = @import("std");
const bog = @import("bog.zig");
const Tree = bog.Tree;
const Node = bog.Node;
const TokenIndex = bog.Token.Index;
const changeDetectionWriter = std.io.changeDetectionStream;
const autoIndentingWriter = std.io.autoIndentingStream;
const indent_delta = 4;
pub fn render(tree: *Tree, writer: a... | src/render.zig |
const std = @import("std");
const allocators = @import("allocators.zig");
pub const fs = @import("lua-fs.zig");
pub const util = @import("lua-util.zig");
pub const c = @cImport({
@cDefine("LUA_EXTRASPACE", std.fmt.comptimePrint("{}", .{@sizeOf(allocators.TempAllocator)}));
@cInclude("lua.h");
@cInclude("lua... | limp/lua.zig |
const std = @import("std");
const c = @import("c.zig");
const git = @import("../git.zig");
const log = std.log.scoped(.git);
pub inline fn wrapCall(comptime name: []const u8, args: anytype) git.GitError!void {
if (@typeInfo(@TypeOf(@field(c, name))).Fn.return_type.? == void) {
@call(.{}, @field(c, name), a... | src/internal/internal.zig |
const std = @import("std");
const user32 = std.os.windows.user32;
const w = @import("windows.zig");
const xinput = @import("xinput.zig");
const dsound = @import("dsound.zig");
const L = std.unicode.utf8ToUtf16LeStringLiteral;
// const c = @cImport({
// @cInclude("windows.h");
// @cInclude("wingdi.h");
// @c... | src/win32_handmade.zig |
const clap = @import("clap");
const format = @import("format");
const std = @import("std");
const util = @import("util");
const debug = std.debug;
const fmt = std.fmt;
const fs = std.fs;
const heap = std.heap;
const io = std.io;
const log = std.log;
const math = std.math;
const mem = std.mem;
const os = std.os;
const ... | src/other/tm35-misc.zig |
const math = @import("std").math;
fn StripComptime(comptime T: type) type {
return switch (T) {
comptime_float => f64,
comptime_int => f64,
else => T,
};
}
fn hasMethod(comptime T: type, comptime name: []const u8) bool {
return @typeInfo(T) == .Struct and @hasDecl(T, name);
}
pub ... | lib/gmath.zig |
const std = @import("std");
const arrayIt = @import("arrayIterator.zig").iterator;
const iterator = @import("iterator.zig").iterator;
const enumerateIt = @import("enumerate.zig").iterator;
const TypeId = @import("builtin").TypeId;
const mem = std.mem;
const Info = enum {
Slice,
Iterator,
Other,
};
pub fn ... | src/info.zig |
const std = @import("std");
const io = std.io;
const mem = std.mem;
const zen = std.os.zen;
const Message = zen.Message;
const Server = zen.Server;
const warn = std.debug.warn;
////
// Entry point.
//
pub fn main() void {
var stdin_file = io.getStdIn() catch unreachable;
var stdin = &stdin_file.inStream().stre... | servers/shell/main.zig |
const std = @import("std");
const fs = std.fs;
const io = std.io;
const info = std.log.info;
const print = std.debug.print;
const fmt = std.fmt;
const ArrayList = std.ArrayList;
const utils = @import("utils.zig");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const State = enum {
active,
inactive,
};
c... | day_17/src/main_p1.zig |
const std = @import("std");
const mem = std.mem;
const Numeric = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 188,
hi: u21 = 194704,
pub fn init(allocator: *mem.Allocator) !Numeric {
var instance = Numeric{
.allocator = allocator,
.array = try allocator.alloc(bool, 194517),
}... | src/components/autogen/DerivedNumericType/Numeric.zig |
const std = @import("std");
const c = @cImport({
@cInclude("binding.h");
});
pub const PropertyAttribute = struct {
pub const None = c.None;
pub const ReadOnly = c.ReadOnly;
};
// Currently, user callback functions passed into FunctionTemplate will need to have this declared as a param and then
// conver... | src/v8.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const panic = std.debug.panic;
const vk = @import("vulkan");
const InstanceDispatch = @import("instance.zig").InstanceDispatch;
pub const Device = struct {
const Self = @This();
allocator: *Allocator,
pdevice: vk.PhysicalDevice,
handle:... | src/vulkan/device.zig |
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
_ = b;
//const tests = b.addTest("src/zbullet.zig");
//const zmath = std.build.Pkg{
// .name = "zmath",
// .path = .{ .path = thisDir() ++ "/../zmath/zmath.zig" },
//};
//tests.addPackage(zmath);
//tests.setBui... | libs/common/build.zig |
const wlr = @import("../wlroots.zig");
const os = @import("std").os;
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const SerialRange = extern struct {
min_incl: u32,
max_incl: u32,
};
pub const SerialRingset = extern struct {
data: [128]SerialRange,
end: c_int,
count: c_i... | src/types/seat.zig |
const std = @import("std");
const endian: std.builtin.Endian = .Big;
const PacketType = enum(u3) {
literal = 4,
sum = 0,
product = 1,
minimum = 2,
maximum = 3,
greater_than = 5,
less_than = 6,
equal_to = 7,
};
const LengthMode = enum(u1) {
bits = 0,
packets = 1,
};
const Len... | 2021/solutions/day16/day16.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const builtin = std.builtin;
const sha256 = std.crypto.hash.sha2.Sha256;
const hashes_of_zero = @import("./zeros.zig").hashes_of_zero;
const Allocator = std.mem.Allocator;
/// Number of bytes per chunk.
const BYTES_PER_CHUNK = 32;
/// Number of bytes per s... | src/main.zig |
export fn _IO_flockfile() void {}
export fn _IO_ftrylockfile() void {}
export fn _IO_funlockfile() void {}
export fn __close() void {}
export fn __connect() void {}
export fn __errno_location() void {}
export fn __fcntl() void {}
export fn __fork() void {}
export fn __h_errno_location() void {}
export fn __libc_alloca... | libc/dummy/pthread.zig |
const std = @import("std");
const mem = std.mem;
const meta = std.meta;
const net = std.net;
const ArrayList = std.ArrayList;
usingnamespace @import("frame.zig");
usingnamespace @import("primitive_types.zig");
const sm = @import("string_map.zig");
pub const QueryParameters = struct {
const Self = @This();
c... | src/query_parameters.zig |
const std = @import("std");
const sdk = @import("sdk");
const log = @import("log.zig");
const ifaces = @import("interface.zig").ifaces;
const FontRecord = struct {
name: [:0]const u8,
tall: u32,
const HashCtx = struct {
pub fn eql(self: @This(), a: FontRecord, b: FontRecord) bool {
_ =... | src/font_manager.zig |
const std = @import("std");
const log_ = @import("Log.zig");
const errLog_ = log_.errLog;
const dbgLog_ = log_.dbgLog;
const assert = std.debug.assert;
const openssl = @import("OpenSSL.zig").openssl;
const c_allocator = std.heap.c_allocator;
const page_allocator = std.heap.page_allocator;
const ObjectPool = @import("Ob... | src/TLSCustomBIO.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const nfd = @import("nfd");
const nvg = @import("nanovg");
const gui = @import("gui");
const icons = @import("icons.zig");
const geometry = @import("gui/geometry.zig");
const Point = geometry.Point;
const Rect = geometry.... | src/EditorWidget.zig |
const DaisyChain = @This();
state: u8 = 0,
vector: u8 = 0,
// shared pins relevant for interrupt handling
pub const M1: u64 = 1<<24; // machine cycle 1
pub const IORQ: u64 = 1<<26; // IO request
pub const INT: u64 = 1<<31; // maskable interrupt requested
pub const IEIO: u64 = 1<<37; // interrupt daisy... | src/emu/DaisyChain.zig |
const std = @import("std");
const builtin = @import("builtin");
var gpa = std.heap.GeneralPurposeAllocator(.{
.safety = true,
}){};
pub const VM = opaque {
pub extern fn bz_newVM(self: *VM) *VM;
pub extern fn bz_deinitVM(self: *VM) void;
pub extern fn bz_compile(self: *VM, source: [*:0]const u8, file_... | lib/buzz_api.zig |
const Dylib = @This();
const std = @import("std");
const fs = std.fs;
const log = std.log.scoped(.dylib);
const macho = std.macho;
const mem = std.mem;
const Allocator = mem.Allocator;
const Symbol = @import("Symbol.zig");
usingnamespace @import("commands.zig");
allocator: *Allocator,
arch: ?std.Target.Cpu.Arch = n... | src/link/MachO/Dylib.zig |
const std = @import("../../../std.zig");
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
pub const SYS = extern enum(usi... | lib/std/os/bits/linux/arm64.zig |
const std = @import("std");
const builtin = std.builtin;
const is_test = builtin.is_test;
const is_gnu = std.Target.current.abi.isGnu();
const is_mingw = builtin.os.tag == .windows and is_gnu;
comptime {
const linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Weak;
const strong_... | lib/std/special/compiler_rt.zig |
const builtin = @import("builtin");
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
/// Returns the cosine of the radian value x.
///
/// Special Cases:
/// - cos(+-inf) = nan
/// - cos(nan) = nan
pub fn cos(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
return... | lib/std/math/cos.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
fn parts(alloc: std.mem.Allocator, in: []const u8, p1Days: usize) ![2]usize {
var oct: []u8 = try alloc.dupe(u8, in);
defer alloc.free(oct);
var w: usize = 0;
while (in[w] != '\n') : (w += 1) {}
var h = in.len / (w + 1);
var r = [2... | 2021/11/aoc.zig |
/// Builtin functions
pub const builtins = [_][]const u8{
"@addWithOverflow(${1:comptime T: type}, ${2:a: T}, ${3:b: T}, ${4:result: *T})",
"@alignCast(${1:comptime alignment: u29}, ${2:ptr: var})",
"@alignOf(${1:comptime T: type})",
"@as(${1:comptime T: type}, ${2:expression})",
"@asyncCall(${1:fr... | src/data/0.6.0.zig |
const Core = @This();
const std = @import("std");
const builtin = @import("builtin");
const enums = @import("enums.zig");
pub const Button = enums.Button;
pub const Key = enums.Key;
pub const Pos = struct {
x: i16,
y: i16,
};
pub const Dim = struct {
width: u16,
height: u16,
};
pub const Event = str... | src/main.zig |
const std = @import("std");
const mem = std.mem;
const IDContinue = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 48,
hi: u21 = 917999,
pub fn init(allocator: *mem.Allocator) !IDContinue {
var instance = IDContinue{
.allocator = allocator,
.array = try allocator.alloc(bool, 917952... | src/components/autogen/DerivedCoreProperties/IDContinue.zig |
const std = @import("std");
const zalgebra = @import("zalgebra");
const Vec3 = zalgebra.Vec3;
const Quat = zalgebra.Quat;
const Allocator = std.mem.Allocator;
const graphics = @import("didot-graphics");
const objects = @import("didot-objects");
const models = @import("didot-models");
const image = @import("didot-image... | examples/kart-and-cubes/example-scene.zig |
const std = @import("std");
const Chunk = @import("chunk.zig").Chunk;
fn printFunction(writer: anytype, function: *Function) !void {
if (function.name) |name| {
try writer.print("<fn {}>", .{name.chars});
} else {
try writer.print("<script>", .{});
}
}
/// A lox value.
pub const Value = un... | src/value.zig |
const std = @import("std");
const gpa = std.heap.c_allocator;
const style = @import("ansi").style;
const licenses = @import("licenses");
const zigmod = @import("../lib.zig");
const u = @import("./../util/index.zig");
const common = @import("./../common.zig");
const List = std.ArrayList(zigmod.Module);
const Map = std... | src/cmd/license.zig |
const std = @import("std");
comptime { std.testing.refAllDecls(@This()); }
// types
const MAX_STRING_SIZE = 200;
const Offset_i8 = extern struct {
x: i8,
y: i8,
};
const RGBColor = extern struct {
r: u8,
g: u8,
b: u8,
};
// ------------------------
// HARDWARE REGISTERS / RAM
pub const WIDTH: u32... | templates/zig/src/tic80.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/day11.txt");
//... | src/day11.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/curve25519_64.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/p434_64.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = true;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
const assert = std.debug.assert;
pub const main = tools.defaultMain("2021/day13.txt", run);
const Vec2 = tools.Vec2;
fn sortA... | 2021/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: u5,
imm: i64,
};
pub fn match_insn(comptime pattern:... | 2017/day18.zig |
const std = @import("std");
const za = @import("zalgebra");
const Vec2 = za.vec2;
const Vec3 = za.vec3;
const Vec4 = za.vec4;
// dross-zig
const Vector2 = @import("vector2.zig").Vector2;
// -----------------------------------------
// - Vector3 -
// -----------------------------------------
pub const Vector3 = st... | src/core/vector3.zig |
const addv = @import("addo.zig");
const std = @import("std");
const testing = std.testing;
const math = std.math;
fn test__addodi4(a: i64, b: i64) !void {
var result_ov: c_int = undefined;
var expected_ov: c_int = undefined;
var result = addv.__addodi4(a, b, &result_ov);
var expected: i64 = simple_addo... | lib/std/special/compiler_rt/addodi4_test.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const abs = std.math.absInt;
const assert = std.debug.assert;
const Point = struct {
x: i32,
y: i32,
const Self = @This();
pub fn distance(self: Self) !i32 {
return (try abs(self.x)) + (try abs(s... | zig/03_2.zig |
const std = @import("std");
const expect = std.testing.expect;
const assert = std.debug.assert;
fn RingBuffer(comptime T: type) type {
return struct {
buffer: []T,
head: usize,
tail: usize,
last_action: enum { Add, Remove },
pub fn init(buffer: []T) @This() {
re... | src/lib/ringbuffer.zig |
usingnamespace @import("root").preamble;
const log = lib.output.log.scoped(.{
.prefix = "PMM",
.filter = .info,
}).write;
const assert = std.debug.assert;
const platform = os.platform;
const lalign = lib.util.libalign;
const pmm_sizes = {
comptime var shift = 12;
comptime var sizes: []const usize = &... | subprojects/flork/src/memory/pmm.zig |
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
v1_1,
v1_2,
v1_3,
v1_4,
v1_5,
SPV_AMD_shader_fragment_mask,
SPV_AMD_gpu_shader_int16,
SPV_AMD_gpu_shader_half_float,
SPV_AMD_texture_gathe... | lib/std/target/spirv.zig |
const std = @import("std");
const util = @import("./util.zig");
const lexer = @import("./lang/lexer.zig");
const col = @import("./term/colors.zig");
const CProcess = std.ChildProcess;
const Color = col.Color;
const File = std.fs.File;
const io = std.io;
const os = std.os;
pub const IdlShell = struct {
session_id: ... | src/sh.zig |
const std = @import("std");
const debug = std.debug;
const heap = std.heap;
const io = std.io;
const math = std.math;
const mem = std.mem;
pub fn main() !void {
const stdin = &(try io.getStdIn()).inStream().stream;
const stdout = &(try io.getStdOut()).outStream().stream;
var direct_allocator = heap.Direc... | src/day5.zig |
const std = @import("std");
const z80 = @import("zig80.zig");
inline fn stderr() std.fs.File.Writer {
return std.io.getStdErr().writer();
}
const Tester = struct {
cpu: z80.CPU,
failed: bool = false,
memory: [0x10000]u8 = [_]u8 { 0 } ** 0x10000,
fn read(self: *Tester, addr: u16) u8 {
ret... | src/tests.zig |
const std = @import("std");
const util = @import("util");
const input = @embedFile("16.txt");
const TicketRule = struct {
name: []const u8,
ranges: [4]u32,
fn inRange(self: TicketRule, int: u32) bool {
return (int >= self.ranges[0] and int <= self.ranges[1]) or
(int >= self.ranges[2] a... | 2020/16.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 Reference = opaque {
pub fn deinit(self: *Reference) void {
log.debug("Reference.deinit called", .{});
c.... | src/reference.zig |
const builtin = @import("builtin");
const testing = @import("std").testing;
// TODO: I wish I could write something like `{ ...self, ._state = ty }`
pub fn setField(lhs: var, comptime field_name: []const u8, value: var) @typeOf(lhs) {
var new = lhs;
@field(new, field_name) = value;
return new;
}
test "se... | druzhba/comptimeutils.zig |
const c = @cImport({
@cInclude("cfl_input.h");
});
const widget = @import("widget.zig");
const enums = @import("enums.zig");
pub const Output = struct {
inner: ?*c.Fl_Output,
pub fn new(x: i32, y: i32, w: i32, h: i32, title: [*c]const u8) Output {
const ptr = c.Fl_Output_new(x, y, w, h, title);
... | src/output.zig |
const zt = @import("zt");
const main = @import("../main.zig");
const ig = @import("imgui");
const zg = zt.custom_components;
var rotation: f32 = 0.0;
var zoom: f32 = 1.0;
// We're just going to lazy init it when the example loads this scene.
var rt: ?zt.gl.RenderTarget = null;
fn ensure() void {
if (rt == null) {... | example/src/scenes/rendertarget.zig |
const std = @import("std");
const _compiler = @import("./compiler.zig");
const Compiler = _compiler.Compiler;
const ParserState = _compiler.ParserState;
const Scanner = @import("./scanner.zig").Scanner;
const _obj = @import("./obj.zig");
const _value = @import("./value.zig");
const Token = @import("./token.zig").Token;... | src/string_scanner.zig |
const std = @import("std");
const utils = @import("utils.zig");
const Token = @import("tokenizer.zig").Token;
const Tokenizer = @import("tokenizer.zig").Tokenizer;
const TokenType = @import("tokenizer.zig").TokenType;
const tokenizerDump = @import("tokenizer.zig").dump;
const debug = std.debug.print;
const testing = st... | libdaya/src/dif.zig |
const std = @import("std");
const debug = std.debug;
const fmt = std.fmt;
const mem = std.mem;
const math = std.math;
pub fn main() !void {
var allocator = &std.heap.DirectAllocator.init().allocator;
var result1 = try biggest_finite_area(allocator, coordinates);
debug.assert(result1 == 2342);
debug.wa... | 2018/day_06.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const BufMap = std.BufMap;
const testing = std.testing;
const input_file = "input04.txt";
const fields = [_][]const u8{
"byr",
"iyr",
"eyr",
"hgt",
"hcl",
"ecl",
"pid",
"cid",
};
fn isValid(passport: BufMap) bool {
r... | src/04.zig |
const std = @import("std");
const Dir = std.fs.Dir;
const Entry = std.fs.Dir.Entry;
const Sha3_256 = std.crypto.Sha3_256;
const base64 = std.base64.standard_encoder;
const io = std.io;
const json = std.json;
const mem = std.mem;
const path = std.fs.path;
const warn = std.debug.warn;
pub fn hashDir(allocator: *std.mem... | src/pkg/dirhash/dirhash.zig |
const std = @import("std");
const hpke = @import("main.zig");
const fmt = std.fmt;
const testing = std.testing;
const primitives = hpke.primitives;
const max_aead_tag_length = hpke.max_aead_tag_length;
const Suite = hpke.Suite;
test "hpke" {
const suite = try Suite.init(
primitives.Kem.X25519HkdfSha256.id,... | src/tests.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/arm64/entry.zig |
const gllparser = @import("../gllparser/gllparser.zig");
const Error = gllparser.Error;
const Parser = gllparser.Parser;
const ParserContext = gllparser.Context;
const Result = gllparser.Result;
const NodeName = gllparser.NodeName;
const ResultStream = gllparser.ResultStream;
const Literal = @import("../parser/literal... | src/combn/combinator/repeated.zig |
const std = @import("std");
pub const Ipv4Host = extern struct {
bytes: [4]u8,
pub fn format(
self: Ipv4Host,
comptime fmt: []const u8,
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
try writer.print("{}.{}.{}.{}", .{
self.bytes[0],
... | src/netx.zig |
const std = @import("std");
const builtin = @import("builtin");
const liu = @import("./lib.zig");
const EPSILON: f32 = 0.000001;
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
// Parser - https://github.com/RazrFalcon/ttf-parser
// Raster - https://github.com/raphlinus/font-rs
pub fn accumula... | src/liu/fonts.zig |
const std = @import("std");
const ArrayList = std.ArrayList;
const AutoHashMap = std.AutoHashMap;
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const helpers = @import("helpers.zig");
const mode = @import("builtin").mode;
const dbg = helpers.dbg;
const testing = std.testing;
/// A node in an undi... | src/graph.zig |
const std = @import("std");
const testing = std.testing;
pub fn main() void {}
inline fn swap(comptime T: type, a: *T, b: *T) void {
const tmp = a.*;
a.* = b.*;
b.* = tmp;
}
pub const PermutationError = error{ListTooLong};
/// Returns an iterator that iterates all the permutations of `list`.
/// `permut... | src/permutate.zig |
const bld = @import("std").build;
const mem = @import("std").mem;
const zig = @import("std").zig;
// build sokol into a static library
pub fn buildSokol(b: *bld.Builder, comptime prefix_path: []const u8) *bld.LibExeObjStep {
const lib = b.addStaticLibrary("sokol", null);
lib.linkLibC();
lib.setBuildMode(b.... | build.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = false;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
const assert = std.debug.assert;
pub const main = tools.defaultMain("2021/day07.txt", run);
fn fuelCost_part1(dist: u32) u32... | 2021/day07.zig |
const actorNs = @import("actor.zig");
const Actor = actorNs.Actor;
const ActorInterface = actorNs.ActorInterface;
const msgNs = @import("message.zig");
const Message = msgNs.Message;
const MessageHeader = msgNs.MessageHeader;
const messageQueueNs = @import("message_queue.zig");
const SignalContext = messageQueueNs.S... | test.zig |
const std = @import("std");
const io = std.io;
const mem = std.mem;
pub const PROTOCOL_VERSION = 196608;
pub const SSL_REQUEST_CODE = 80877103;
pub const SSL_ALLOWED = 'S';
pub const SSL_NOT_ALLOWED = 'N';
pub const Type = struct {
pub const AUTHENTICATION: u8 = 'R';
pub const ERROR: u8 = 'E';
pub const ... | src/db/pq/protocol.zig |
const std = @import("std");
// const assert = std.debug.assert;
const warn = std.debug.warn;
const main_sokol = @import("main_sokol.zig");
const system = @import("../core/system.zig");
usingnamespace @import("../main/util.zig");
const MainState = struct {
sm: *system.SystemManager,
allocator: *std.mem.Allocato... | code/main/main.zig |
const std = @import("std");
const os = @import("root").os;
const CoreID = os.platform.CoreID;
/// Maximum number of supported CPUs
const max_cpus = comptime os.config.kernel.max_cpus;
/// CPUs data
var core_datas: [max_cpus]CoreData = [1]CoreData{undefined} ** max_cpus;
/// Count of CPUs that have not finished boot... | src/platform/smp.zig |
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const vma_config = @import("vma_config.zig");
fn getConfigArgs(comptime config: vma_config.Config) []const []const u8 {
comptime {
@setEvalBranchQuota(100000);
var args: []const []const u8 ... | build.zig |
const std = @import("std");
const assert = std.debug.assert;
const c_allocator = std.heap.c_allocator;
const page_allocator = std.heap.page_allocator;
const Allocator = std.mem.Allocator;
const ObjectPool = @import("ObjectPool.zig").ObjectPool;
pub fn LinkedBuffers(comptime buffer_size: u32, comptime sub_pool_size: u3... | src/LinkedBuffers.zig |
const std = @import("std");
const Arena = std.heap.ArenaAllocator;
const Allocator = std.mem.Allocator;
const eql = std.meta.eql;
const panic = std.debug.panic;
const assert = std.debug.assert;
const initCodebase = @import("init_codebase.zig").initCodebase;
const MockFileSystem = @import("file_system.zig").FileSystem;... | src/wasm_printer.zig |
const build_options = @import("build_options");
const std = @import("std");
const os = std.os;
const common = @import("common.zig");
const simdjzon = @import("simdjzon.zig");
const dom = simdjzon.dom;
const ondemand = simdjzon.ondemand;
pub const step_size = if (build_options.step_128) 128 else 64;
pub const read_buf_... | src/main.zig |
const std = @import("std");
const io = std.io;
const mem = std.mem;
const debug = std.debug;
const assert = debug.assert;
const testing = std.testing;
const ArrayListSentineled = std.ArrayListSentineled;
const ArrayList = std.ArrayList;
const maxInt = std.math.maxInt;
const Token = union(enum) {
Word: []const u8,
... | test/standalone/brace_expansion/main.zig |
const std = @import("std.zig");
const builtin = std.builtin;
const assert = std.debug.assert;
const testing = std.testing;
const os = std.os;
const math = std.math;
const is_windows = std.Target.current.os.tag == .windows;
pub const epoch = @import("time/epoch.zig");
/// Spurious wakeups are possible and no precision... | lib/std/time.zig |
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
const maxInt = std.math.maxInt;
/// Returns sqrt(x * x + y * y), avoiding unncessary overflow and underflow.
///
/// Special Cases:
/// - hypot(+-inf, y) = +inf
/// - hypot(x, +-inf) = +inf
/// - hypot(nan, y) = nan
/... | lib/std/math/hypot.zig |
const std = @import("std");
const uri = @import("uri");
const Engine = @import("Engine.zig");
const Dependency = @import("Dependency.zig");
const Project = @import("Project.zig");
const api = @import("api.zig");
const cache = @import("cache.zig");
const utils = @import("utils.zig");
const local = @import("local.zig");
... | src/url.zig |
const std = @import("std");
const info = std.log.info;
const dbg = std.log.debug;
const emerg = std.log.emerg;
pub const SystemSegmentAndGateDescriptorType = packed enum(u4) {
available_task_state_segment_16bit = 1,
busy_task_state_segment_16bit = 3,
call_gate_16bit = 4,
task_gate = 5,
interrupt_... | kernel/descriptor.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
pub const CurveId = enum {
sect163k1, sect163r1, sect163r2, ... | src/x509.zig |
const std = @import("std");
const builtin = @import("builtin");
const debug = std.debug.print;
const daya = @import("daya");
const argparse = @import("argparse.zig");
pub const APP_NAME = "daya";
pub const APP_VERSION = blk: {
if (builtin.mode != .Debug) {
break :blk @embedFile("../VERSION");
} else {... | compiler/src/main.zig |
const std = @import("std");
const Image = @import("image.zig").Image;
const Allocator = std.mem.Allocator;
pub const PngError = error {
InvalidHeader,
InvalidFilter,
UnsupportedFormat
};
const ChunkStream = std.io.FixedBufferStream([]u8);
// PNG files are made of chunks which have this structure:
const C... | didot-image/png.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/day05.txt");
c... | src/day05.zig |
pub const USB_PRINTER_INTERFACE_CLASSIC = @as(u32, 1);
pub const USB_PRINTER_INTERFACE_IPP = @as(u32, 2);
pub const USB_PRINTER_INTERFACE_DUAL = @as(u32, 3);
pub const USBPRINT_IOCTL_INDEX = @as(u32, 0);
pub const IOCTL_USBPRINT_GET_LPT_STATUS = @as(u32, 2228272);
pub const IOCTL_USBPRINT_GET_1284_ID = @as(u32, 2228276... | win32/graphics/printing.zig |
const std = @import("std");
const vk = @import("vulkan");
const c = @import("c.zig");
const resources = @import("resources");
const GraphicsContext = @import("graphics_context.zig").GraphicsContext;
const Swapchain = @import("swapchain.zig").Swapchain;
const Allocator = std.mem.Allocator;
const app_name = "vulkan-zig ... | examples/triangle.zig |
const base = @import("../base.zig");
const gen = @import("../gen.zig");
const cal_gr = @import("gregorian.zig");
const COMMON = [_:null]?base.Segment{
.{ .offset = 28 * 0 + 35 * 0, .month = 1, .day_start = 1, .day_end = 28 },
.{ .offset = 28 * 1 + 35 * 0, .month = 2, .day_start = 1, .day_end = 35 },
.{ .of... | src/cal/symmetry454.zig |
const std = @import("std");
const os = std.os;
const wayland = @import("wayland");
const wl = wayland.client.wl;
const xdg = wayland.client.xdg;
const c = @cImport(@cInclude("linux/input-event-codes.h"));
const Context = struct {
shm: ?*wl.Shm = null,
compositor: ?*wl.Compositor = null,
wm_base: ?*xdg.Wm... | hello.zig |
const std = @import("std");
const math = std.math;
const qnan128 = @bitCast(f128, @as(u128, 0x7fff800000000000) << 64);
const __addtf3 = @import("addXf3.zig").__addtf3;
fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
const x = __addtf3(a, b);
const rep = @bitCast(u128, x);
... | lib/compiler_rt/addXf3_test.zig |
const std = @import("std");
const Context = struct {
id: u64,
frame_buffer: []align(16) u8,
allocator: *std.mem.Allocator,
func: fn () callconv(.Async) void,
frame: ?anyframe = null,
done: bool = false,
const Self = @This();
fn init(id: u64, func: fn () callconv(.Async) vo... | src/test_async.zig |
usingnamespace @import("root").preamble;
const interrupts = @import("interrupts.zig");
const idt = @import("idt.zig");
const gdt = @import("gdt.zig");
const serial = @import("serial.zig");
const ports = @import("ports.zig");
const regs = @import("regs.zig");
const apic = @import("apic.zig");
const pci = os.platform.pc... | subprojects/flork/src/platform/x86_64/x86_64.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const data = @embedFile("../inputs/day15.txt");
pub fn main() anyerror!void {
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa_impl.deinit();
const gpa = gpa_impl.allocator();
return m... | src/day15.zig |
const std = @import("std");
const builtin = @import("builtin");
const warn = std.debug.print;
const Allocator = std.mem.Allocator;
const Buffers = @import("./simple_buffer.zig");
pub fn sliceAddNull(allocator: *Allocator, str: []const u8) []const u8 {
return std.cstr.addNullByte(allocator, str) catch unreachable;... | src/util.zig |
const std = @import("std");
const getty = @import("getty");
const ArrayVisitor = @import("de/impl/visitor/array.zig").Visitor;
const ArrayListVisitor = @import("de/impl/visitor/array_list.zig").Visitor;
const BoolVisitor = @import("de/impl/visitor/bool.zig");
const EnumVisitor = @import("de/impl/visitor/enum.zig").V... | src/de.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const HashMap = std.HashMap;
/// Core enumeration types.
const Result = packed enum(i32) {
ok,
not_found,
bad_argument,
serialization_failure,
parse_failure,
bad_expression,
invalid_memory_access,
empty,
cas_mismatch,
... | extensions/zig_demo/module.zig |
const std = @import("std");
const assert = std.debug.assert;
/// A First In, First Out ring buffer holding at most `size` elements.
pub fn RingBuffer(comptime T: type, comptime size: usize) type {
return struct {
const Self = @This();
buffer: [size]T = undefined,
/// The index of the slot... | src/ring_buffer.zig |