code stringlengths 38 801k | repo_path stringlengths 6 263 |
|---|---|
const std = @import("std");
const builtin = @import("builtin");
const os = std.os;
const io = std.io;
const mem = std.mem;
const Allocator = mem.Allocator;
const ArrayList = std.ArrayList;
const Buffer = std.Buffer;
const arg = @import("arg.zig");
const c = @import("c.zig");
const introspect = @import("introspect.zig... | src-self-hosted/main.zig |
const std = @import("std");
const debug = std.debug;
const fmt = std.fmt;
const width = 1000;
const height = 1000;
const Claim = struct {
data: [4]usize,
cursor: usize,
};
fn displayFabric(fabric: []const usize) void {
for (fabric) |i, idx| {
if ((idx % width) == 0) {
std.debug.warn(... | src/aoc3.zig |
const combn = @import("../combn/combn.zig");
const Result = combn.Result;
const Parser = combn.Parser;
const Error = combn.Error;
const Context = combn.Context;
const ParserPosKey = combn.ParserPosKey;
const ParserPath = combn.ParserPath;
const ParserNodeName = combn.ParserNodeName;
const String = @import("String.zig"... | src/dsl/identifier.zig |
const std = @import("std");
const Builder = std.build.Builder;
const packages = @import("deps.zig");
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const lib_tests = b.addTest("src/main.zig");
lib_tests.setBuildMode(mode);
if (@hasDecl(packages, "use_submodules")) { // su... | build.zig |
const std = @import("std");
const mem = std.mem;
const CaseIgnorable = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 39,
hi: u21 = 917999,
pub fn init(allocator: *mem.Allocator) !CaseIgnorable {
var instance = CaseIgnorable{
.allocator = allocator,
.array = try allocator.alloc(boo... | src/components/autogen/DerivedCoreProperties/CaseIgnorable.zig |
const std = @import("std");
const assert = std.debug.assert;
const testing = std.testing;
const Allocator = std.mem.Allocator;
const array_map = @This();
pub fn AutoArrayMap(comptime K: type, comptime V: type) type {
return ArrayMap(K, V, std.hash_map.AutoContext(K), true);
}
pub fn ArrayMap(
comptime K: typ... | src/array_map.zig |
const std = @import("std");
usingnamespace @import("code_runner.zig");
usingnamespace @import("common.zig");
usingnamespace @import("types.zig");
pub const NativeFunctionWrapper = struct {
const Self = @This();
invokeFn: fn (self: *Self, codeRunner: *CodeRunner, callFuncType: *const Type) anyerror!v... | src/native_function.zig |
const os = @import("root").os;
const std = @import("std");
/// Mutex is lock that should be used for synchronizing operations
/// that may take too long and/or can't be run in interrupt disabled context
/// (e.g. you need to use it if you allocate memory in locked section)
pub const Mutex = struct {
/// Thread that ... | src/thread/mutex.zig |
const std = @import("std");
const logger = std.log.scoped(.day03);
const real_data = @embedFile("../data/day03.txt");
pub fn main() !void {
const digits = comptime digitsSize(real_data);
logger.info("Part one: {}", .{partOne(digits, real_data)});
}
fn partOne(comptime digits: usize, data: []const u8) !u64 {... | src/day03.zig |
const builtin = @import("builtin");
const math = @import("std").math;
comptime {
// These are implicitly defined when compiling tests.
if (!builtin.is_test) {
@export("ceil", ceil, builtin.GlobalLinkage.Strong);
@export("ceilf", ceilf, builtin.GlobalLinkage.Strong);
@export("floor", fl... | src/math.zig |
const MMIORegion = @import("root").mmio.MMIORegion;
// Thus a peripheral advertised here at bus address 0x7Ennnnnn is
// available at physical address 0x3Fnnnnnn.
//
pub const MMIO = MMIORegion(0x3F000000, u32);
pub const GPIO = struct {
pub const Region = MMIO.Subregion(0x200000);
pub const GPPUD = Region.Re... | kernel/arch/arm64/platform/BCM2837.zig |
const std = @import("std");
/// Represents a DNS type.
/// Keep in mind this enum does not declare all possible DNS types.
pub const ResourceType = enum(u16) {
A = 1,
NS = 2,
MD = 3,
MF = 4,
CNAME = 5,
SOA = 6,
MB = 7,
MG = 8,
MR = 9,
NULL = 10,
WKS = 11,
PTR = 12,
H... | src/pkg2/types.zig |
const std = @import("std");
pub const paging = @import("../paging.zig");
const dcommon = @import("../common/dcommon.zig");
const hw = @import("../hw.zig");
pub var TTBR0_IDENTITY: *PageTable = undefined;
pub var K_DIRECTORY: *PageTable = undefined;
pub const PAGING = paging.configuration(.{
.vaddress_mask = 0x000... | dainkrnl/src/arm64/paging.zig |
const std = @import("std");
const webgpu = @import("./webgpu.zig");
pub const AdapterProperties = struct {
vendor_id: u32,
device_id: u32,
name: [:0]const u8,
driver_descripton: [:0]const u8,
adapter_type: webgpu.AdapterType,
backend_type: webgpu.BackendType,
};
pub const BufferBinding = struc... | src/structs.zig |
const std = @import("std");
const clap = @import("clap");
const Event = @import("../remote.zig").Event;
const BorkConfig = @import("../main.zig").BorkConfig;
const parseTime = @import("./utils.zig").parseTime;
fn connect(alloc: std.mem.Allocator, port: u16) std.net.Stream {
return std.net.tcpConnectToHost(alloc, "... | src/remote/client.zig |
const ffs = @import("count0bits.zig");
const testing = @import("std").testing;
fn test__ffssi2(a: u32, expected: i32) !void {
var x = @bitCast(i32, a);
var result = ffs.__ffssi2(x);
try testing.expectEqual(expected, result);
}
test "ffssi2" {
try test__ffssi2(0x00000001, 1);
try test__ffssi2(0x000... | lib/std/special/compiler_rt/ffssi2_test.zig |
const std = @import("std");
const print = std.debug.print;
usingnamespace @import("common.zig");
usingnamespace @import("value.zig");
usingnamespace @import("chunk.zig");
usingnamespace @import("compiler.zig");
usingnamespace @import("scanner.zig");
usingnamespace @import("parser.zig");
pub const InterpretResult = en... | vm/src/vm.zig |
const std = @import("std");
const mem = std.mem;
const PatternSyntax = @This();
allocator: *mem.Allocator,
array: []bool,
lo: u21 = 33,
hi: u21 = 65094,
pub fn init(allocator: *mem.Allocator) !PatternSyntax {
var instance = PatternSyntax{
.allocator = allocator,
.array = try allocator.alloc(bool... | src/components/autogen/PropList/PatternSyntax.zig |
const builtin = @import("builtin");
const is_test = builtin.is_test;
comptime {
const linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Weak;
const strong_linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Strong;
@export("__letf2", @import("com... | std/special/compiler_rt/index.zig |
const std = @import("std");
// this can be used when pushing to an ImpulseQueue. it's all you need if you
// don't care about matching note-on and note-off events (which is only
// important for polyphony)
pub const IdGenerator = struct {
next_id: usize,
pub fn init() IdGenerator {
return IdGenerator ... | src/zang/notes.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const nvg = @import("nanovg");
const gui = @import("gui");
const geometry = gui.geometry;
const Point = geometry.Point;
const Pointi = Point(i32);
const Pointu = Point(u32);
const Rect = geometry.Rect;
const Recti = Rect(... | src/Document.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
const required_fields = enum {
byr, // (Birth Year)
iyr, // (Issue Year)
eyr, // (Expiration Year)
hgt, // (Heigh... | 2020/day04.zig |
const actorNs = @import("actor.zig");
const ActorInterface = actorNs.ActorInterface;
const messageNs = @import("message.zig");
const MessageHeader = messageNs.MessageHeader;
const messageQueueNs = @import("message_queue.zig");
const MessageQueue = messageQueueNs.MessageQueue;
const SignalContext = messageQueueNs.Sig... | actor_dispatcher.zig |
// SPDX-License-Identifier: MIT
// This file is part of the `termcon` project under the MIT license.
//! This module handles provides functions to interface with the terminal
//! screen.
const view = @import("../../view.zig");
const root = @import("../windows.zig");
const std = @import("std");
const windows = std.o... | src/backend/windows/screen.zig |
const builtin = @import("builtin");
const std = @import("std");
const wasmtime = @import("wasmtime");
const fs = std.fs;
const ga = std.heap.c_allocator;
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
pub fn main() !void {
const wasm_path = if (builtin.os.tag == .windows) "examples\\memory.w... | examples/memory.zig |
const std = @import("std");
const testing = std.testing;
const Allocator = std.mem.Allocator;
// ustar tar implementation
pub const Header = extern struct {
name: [100]u8,
mode: [8]u8,
uid: [8]u8,
gid: [8]u8,
size: [11:0]u8,
mtime: [12]u8,
checksum: [8]u8,
typeflag: FileType,
linkn... | src/tar.zig |
const std = @import("std");
const linux = @cImport({
@cInclude("linux/input.h");
@cInclude("linux/input-event-codes.h");
});
fn code_lookup(code: u16) ?[]const u8 {
return switch (code) {
0x00 => "X", // ABS_X
0x01 => "Y", // ABS_Y
0x2f => "SLOT", // MT slot being modified
... | src/multitouch.zig |
const std = @import("../std.zig");
const math = std.math;
const testing = std.testing;
const maxInt = std.math.maxInt;
/// Returns the base-10 logarithm of x.
///
/// Special Cases:
/// - log10(+inf) = +inf
/// - log10(0) = -inf
/// - log10(x) = nan if x < 0
/// - log10(nan) = nan
pub fn log10(x: anyty... | lib/std/math/log10.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const testing = std.testing;
const mem = std.mem;
const Loop = std.event.Loop;
/// Thread-safe async/await lock.
/// Functions which are waiting for the lock are suspended, and
/// are resumed when the lock is relea... | lib/std/event/rwlock.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const mem = std.mem;
test "continue in for loop" {
const array = [_]i32{ 1, 2, 3, 4, 5 };
var sum: i32 = 0;
for (array) |x| {
sum += x;
if (x < 3) {
continue;
}
... | test/behavior/for.zig |
const aoc = @import("../aoc.zig");
const std = @import("std");
const SCREEN_WIDTH = 50;
const SCREEN_HEIGHT = 6;
const ScreenRowType = std.meta.Int(.unsigned, SCREEN_WIDTH);
const ScreenColumnType = std.meta.Int(.unsigned, SCREEN_HEIGHT);
const Screen = std.bit_set.StaticBitSet(SCREEN_WIDTH * SCREEN_HEIGHT);
pub fn ... | src/main/zig/2016/day08.zig |
const assertOrPanic = @import("std").debug.assertOrPanic;
test "optional type" {
const x: ?bool = true;
if (x) |y| {
if (y) {
// OK
} else {
unreachable;
}
} else {
unreachable;
}
const next_x: ?i32 = null;
const z = next_x orelse 1234;... | test/stage1/behavior/null.zig |
const std = @import("std");
const flags_ = @import("../flags.zig");
const CreateFlags = flags_.CreateFlags;
const FieldFlagsDef = flags_.FieldFlagsDef;
pub fn cpuCycled(self: anytype) void {
self.apu.runCycle();
self.ppu.runCycle();
self.ppu.runCycle();
self.ppu.runCycle();
self.mem.cart.cpuCycled... | src/cpu/common.zig |
const Self = @This();
// The status area we are currently using.
area: *sys.flash.FlashArea = undefined,
// We have a buffer for the last page and one for the other pages.
buf_last: LastPage = undefined,
buf_hash: HashPage = undefined,
// The last page we've written to. 0 is the "ultimate" page, and '1'
// is the ... | src/status/paged.zig |
const std = @import("std");
const input = @import("input.zig");
pub fn run(stdout: anytype) anyerror!void {
{
var input_ = try input.readFile("inputs/day11");
defer input_.deinit();
const result = try part1(&input_);
try stdout.print("11a: {}\n", .{ result });
std.debug.as... | src/day11.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 Indexer = opaque {
pub const Options = struct {
/// permissions to use creating packfile or 0 for defaults
... | src/indexer.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = false;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
const Vec2 = @Vector(2, i16);
const PortalContext = struct {
pub fn hash(self: @This()... | 2019/day20.zig |
const std = @import("std");
const time = std.time;
const c = @cImport({
@cInclude("sys/ioctl.h");
});
// 状態
const STATE = enum { DEAD = 0, LIVE = 1 };
const stdout = std.io.getStdOut();
fn Grid() type {
return struct {
const Self = @This();
height: usize,
width: usize,
grid... | src/main.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const maxInt = std.math.maxInt;
const iovec = std.os.iovec;
const iovec_const = std.os.iovec_const;
extern "c" fn _errnop() *c_int;
pub const _errno = _errnop;
pub extern "c" fn find_directory(which: c_int, volume: i32, createIt: bool, path_ptr: ... | lib/std/c/haiku.zig |
pub const sabaton = @import("../../sabaton.zig");
pub const io = sabaton.io_impl.status_uart_mmio_32;
pub const panic = sabaton.panic;
pub const display = @import("display.zig");
pub const smp = @import("smp.zig");
pub const timer = @import("timer.zig");
const led = @import("led.zig");
// We know the page size is 0x... | src/platform/pine_aarch64/main.zig |
const std = @import("std");
const builtin = @import("builtin");
const ptx = @import("kernel_utils.zig");
pub export fn atomicHistogram(d_data: []u32, d_bins: []u32) callconv(ptx.Kernel) void {
const gid = ptx.getIdX();
if (gid >= d_data.len) return;
const bin = d_data[gid];
ptx.atomicAdd(&d_bins[bin],... | CS344/src/hw5_kernel.zig |
const std = @import("std");
const zap = @import("zap");
const hyperia = @import("hyperia.zig");
const testing = std.testing;
pub fn Channel(comptime T: type) type {
return struct {
const Self = @This();
const Node = struct {
next: ?*Node = null,
runnable: zap.Pool.Runnable... | oneshot.zig |
const c = @import("c.zig");
pub const StaticGeometry = struct {
rect_2d_vertex_buffer: c.GLuint,
rect_2d_tex_coord_buffer: c.GLuint,
triangle_2d_vertex_buffer: c.GLuint,
triangle_2d_tex_coord_buffer: c.GLuint,
pub fn create() StaticGeometry {
var sg: StaticGeometry = undefined;
c... | benchmarks/tetris/tetris/src/static_geometry.zig |
const std = @import("std");
const utils = @import("utils.zig");
const testing = std.testing;
/// Token represents the offset inside a file where a token exists
pub const Token = union(enum) {
/// open_brace is the start of the opening brace in a block
open_brace: usize,
/// close_brace is the end_keyword o... | src/parser.zig |
pub const IOCTL_NDIS_RESERVED5 = @as(u32, 1507380);
pub const IOCTL_NDIS_RESERVED6 = @as(u32, 1540152);
pub const NDIS_OBJECT_TYPE_DEFAULT = @as(u32, 128);
pub const NDIS_OBJECT_TYPE_MINIPORT_INIT_PARAMETERS = @as(u32, 129);
pub const NDIS_OBJECT_TYPE_SG_DMA_DESCRIPTION = @as(u32, 131);
pub const NDIS_OBJECT_TYPE_MINIP... | win32/network_management/ndis.zig |
const builtin = @import("builtin");
const std = @import("std");
const audio_experiments = @import("samples/audio_experiments/build.zig");
const audio_playback_test = @import("samples/audio_playback_test/build.zig");
const bindless = @import("samples/bindless/build.zig");
const bullet_physics_test = @import("samples/bu... | build.zig |
const std = @import("std");
// const math = std.math;
const math = @import("lib.zig");
const expect = std.testing.expect;
/// Returns e raised to the power of x (e^x).
///
/// Special Cases:
/// - exp(+inf) = +inf
/// - exp(nan) = nan
pub fn exp(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
return switch ... | src/exp.zig |
const std = @import("std");
const meta = std.meta;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
pub const ColorRGB = struct {
r: u8,
g: u8,
b: u8,
const Self = @This();
pub fn eql(self: Self, other: Self) bool {
return meta.eql(self, other);
}
};
pu... | src/style.zig |
const std = @import("std");
const android = @import("build_android.zig");
pub fn build(b: *std.build.Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
// DESKTOP STEPS
{
// BUILD DESKTOP
const exe = b.addExecutable("main", "src/main.z... | build.zig |
const std = @import("std");
const zt = @import("zt");
const sling = @import("../sling.zig");
const ig = @import("imgui");
const selector = @import("fileSelector.zig");
var demoOpen: bool = false;
var saveShortcut: bool = false;
var loadShortcut: bool = false;
var saveAsShortcut: bool = false;
pub fn update() void {
... | src/editor/menu.zig |
const std = @import("std");
const io = std.io;
pub const allocator = std.testing.allocator;
pub const expect = std.testing.expect;
pub const expectError = std.testing.expectError;
pub const expectEqual = std.testing.expectEqual;
pub const expectEqualSlices = std.testing.expectEqualSlices;
pub const expectEqualStrings ... | src/testing.zig |
const std = @import("std");
const coder = @import("coder.zig");
const testing = std.testing;
const ParseError = coder.ParseError;
const WireType = enum(u3) {
Varint = 0,
_64bit = 1,
LengthDelimited = 2,
StartGroup = 3,
EndGroup = 4,
_32bit = 5,
};
pub const FieldMeta = struct {
wire_type:... | src/types.zig |
const builtin = @import("builtin");
const std = @import("std");
const c = @import("c.zig");
const debug = std.debug;
const math = std.math;
const mem = std.mem;
// Custom functions provided to nuklear
export fn zig_assert(ok: c_int) void {
debug.assert(ok != 0);
}
export fn zig_memset(ptr: [*]u8, c0: u8, len: u... | src/gui/nuklear.zig |
const std = @import("std");
const mem = std.mem;
const Allocator = mem.Allocator;
const tk = @import("./token.zig");
const Token = tk.Token;
const TokenType = tk.TokenType;
pub const SourceLocation = struct {
start: usize,
line: usize,
column: usize,
offset: usize,
};
// TODO: iterate over utf8 graphe... | src/scanner.zig |
const u = @import("../util.zig");
/// See https://github.com/WebAssembly/tool-conventions/blob/main/Linking.md
/// Custom section after data
version: u32 = 2,
subsections: []Sub = &[_]Sub{},
pub const Sub = struct {
//TODO: initFuncs, symbolTable, ...
type: u8,
len: u32,
data: u.Bin,
};
/// Custom se... | src/IR/Linking.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const root = @import("root");
const mem = std.mem;
const assert = std.debug.assert;
pub fn AutoIndentingStream(comptime DownStream: type) type {
return struct {
const Self = @This();
pub const Error = DownStream.Error;
d... | lib/std/io/auto_indenting_stream.zig |
const std = @import("std");
const mecha = @import("../mecha.zig");
const math = std.math;
const unicode = std.unicode;
// Constructs a parser that only succeeds if the string starts with `c`.
pub fn char(comptime c: u21) mecha.Parser(void) {
comptime {
var array: [4]u8 = undefined;
const len = uni... | src/utf8.zig |
/// Error set
pub const Error = error{ CheckFailed, Unknown, Duplicate, FailedToAdd };
const std = @import("std");
const gl = @import("gl.zig");
usingnamespace @import("log.zig");
// TODO: Localized cross-platform(win32-posix) timer
/// If expresion is true return(CheckFailed) error
pub fn check(expression: bool,... | src/kiragine/kira/utils.zig |
const std = @import("std");
const testing = std.testing;
const Allocator = std.mem.Allocator;
const io = std.io;
const dns = @import("./dns.zig");
const Packet = dns.Packet;
test "convert domain string to dns name" {
const domain = "www.google.com";
var name_buffer: [3][]const u8 = undefined;
var name = t... | src/pkg2/test.zig |
const midi = @import("../midi.zig");
const std = @import("std");
const io = std.io;
const mem = std.mem;
const testing = std.testing;
const decode = midi.decode;
const encode = midi.encode;
const file = midi.file;
test "midi.decode/encode.message" {
try testMessage("\x80\x00\x00" ++
"\x7F\x7F" ++
... | midi/test.zig |
const std = @import("std");
const dcommon = @import("common/dcommon.zig");
const uefi = std.os.uefi;
const build_options = @import("build_options");
const dtblib = @import("dtb");
const ddtb = @import("common/ddtb.zig");
const arch = @import("arch.zig");
usingnamespace @import("util.zig");
var boot_services: *uefi.ta... | dainboot/src/dainboot.zig |
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const CrossTarget = std.zig.CrossTarget;
const Mode = std.builtin.Mode;
const builtin = @import("builtin");
pub fn build(b: *Builder) void {
const exe = b.addExecutable("pacman", "src/pacman.zig");
con... | build.zig |
const std = @import("std");
const types = @import("./types.zig");
/// Only check for the field's existence.
const Exists = struct {
exists: bool,
};
fn Default(comptime T: type, comptime default_value: T) type {
return struct {
pub const value_type = T;
pub const default = default_value;
... | src/requests.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
const seglist = @import("segmented_list.zig");
const Matcher = struct {
const Rule = union(enum) {
str: []const u8,
opt: []const []const usize,
};
rules: std.AutoHashMap(usize, Rule),
values: [][]const u8,
alloc: std.m... | 2020/19/aoc.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectEqualSlices = std.testing.expectEqualSlices;
// Import structs.
const Context = @import("Context.zig");
const GraphemeIterator = @import("ziglyph.zig").GraphemeIterator;
const Letter = @import("compo... | src/readme_tests.zig |
const std = @import("std");
const Builder = std.build.Builder;
const builtin = @import("builtin");
pub fn build(b: *Builder) void {
const build_mode = b.standardReleaseOptions();
// use a different cache folder for macos arm builds
b.cache_root = if (std.builtin.os.tag == .macos and std.builtin.arch == st... | build.zig |
const std = @import("std");
fn isHashMap(comptime T: type) bool {
if (!@hasDecl(T, "KV")) return false;
if (!@hasField(T.KV, "key")) return false;
if (!@hasField(T.KV, "value")) return false;
const Key = std.meta.fields(T.KV)[std.meta.fieldIndex(T.KV, "key") orelse unreachable].field_type;
const ... | tres.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
const RunFn = fn (input: []const u8, allocator: std.mem.Allocator) tools.RunError![2][]const u8;
// it.runFn = @import(name); -> marche pas. doit être un string litteral
const alldays = [_]struct { runFn: RunFn, input: []co... | 2019/alldays.zig |
const std = @import("std");
const chart = @import("chart.zig");
const process = std.process;
const unicode = std.unicode;
const ArrayList = std.ArrayList;
const Allocator = std.mem.Allocator;
const eql = std.mem.eql;
const max = std.math.max;
const ArgError = error
{
MultipleInputFiles,
MissingDelim
};
/// Wh... | src-zig/main.zig |
const std = @import("std");
const assert = std.debug.assert;
pub fn main() !void {
var input_file = try std.fs.cwd().openFile("input/08.txt", .{});
defer input_file.close();
var buffered_reader = std.io.bufferedReader(input_file.reader());
const count = try deduceNumbers(buffered_reader.reader());
... | src/08.zig |
const Server = @This();
const lsp = @import("lsp");
const std = @import("std");
const tres = @import("tres");
arena: std.heap.ArenaAllocator,
parser: std.json.Parser,
read_buf: std.ArrayList(u8),
write_buf: std.ArrayList(u8),
const SampleDirection = enum {
client_to_server,
server_to_client,
};
const Sampl... | tests/tests.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const print = std.debug.print;
const data = @embedFile("../inputs/day03.txt");
const BIT_COUNT = 12;
pub fn main() anyerror!void {
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa_impl.deinit();
const gpa = gpa_impl.all... | src/day03.zig |
const std = @import("std");
const Random = std.rand.Random;
const math = std.math;
const Sfc64 = @This();
random: Random,
a: u64 = undefined,
b: u64 = undefined,
c: u64 = undefined,
counter: u64 = undefined,
const Rotation = 24;
const RightShift = 11;
const LeftShift = 3;
pub fn init(init_s: u64) Sfc64 {
var x... | lib/std/rand/Sfc64.zig |
const warn = @import("std").debug.warn;
const x86 = @import("src/x86.zig");
pub fn main() anyerror!void {
const machine64 = x86.Machine.init(.x64);
{
const op1 = x86.Operand.register(.RAX);
const op2 = x86.Operand.register(.R15);
const instr = try machine64.build2(.MOV, op1, op2);
... | example.zig |
const std = @import("std");
const ray = @import("ray.zig");
const image = @import("image.zig");
const scene = @import("scene.zig");
const camera = @import("camera.zig");
const config = @import("config.zig");
const vector = @import("vector.zig");
const Vec3 = config.Vec3;
pub const Tracer = struct {
scene: *scene.... | src/tracer.zig |
const SDL = @import("sdl2");
const std = @import("std");
const z80 = @import("zig80");
const Audio = @import("Audio.zig");
const Inputs = @import("Inputs.zig");
const ROM = @import("ROM.zig");
const Timer = @import("Timer.zig");
const Video = @import("Video.zig");
const Machine = @This();
const CYCLES_PER_FRAME = 51... | src/Machine.zig |
const std = @import("std");
const assert = std.debug.assert;
const ascii = std.ascii;
const main = @import("main.zig");
const strings = @import("strings.zig");
const nodes = @import("nodes.zig");
const scanners = @import("scanners.zig");
const inlines = @import("inlines.zig");
const Options = @import("options.zig").Op... | src/parser.zig |
const std = @import("std");
const getty = @import("../../../lib.zig");
const ArrayVisitor = @import("array.zig").Visitor;
const BoolVisitor = @import("bool.zig");
const EnumVisitor = @import("enum.zig").Visitor;
const FloatVisitor = @import("float.zig").Visitor;
const IntVisitor = @import("int.zig").Visitor;
const Opt... | src/de/impl/visitor/pointer.zig |
const std = @import("std");
const options = @import("build_options");
const datetime = @import("datetime");
const clap = @import("clap");
const zfetch = @import("zfetch");
const folders = @import("known-folders");
const Channel = @import("utils/channel.zig").Channel;
const senseUserTZ = @import("utils/sense_tz.zig").s... | src/main.zig |
const std = @import("std");
const testing = std.testing;
const zupnp = @import("zupnp");
const SUT = struct {
const not_found = "NotFound";
const forbidden = "Forbidden";
const dest = "/endpoint";
const Endpoint = struct {
pub fn get(request: *const zupnp.web.ServerGetRequest) zupnp.web.Server... | test/web/test_misc_responses.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 utils = @import("utils.zig");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const History = struct {
allo: *std.mem.Allocator,
prev: usize,
hist: []?... | day_15/src/main.zig |
const std = @import("std");
const ascii = std.ascii;
const assert = std.debug.assert;
const Options = @import("options.zig").Options;
const nodes = @import("nodes.zig");
const strings = @import("strings.zig");
const scanners = @import("scanners.zig");
pub fn print(writer: anytype, allocator: *std.mem.Allocator, optio... | src/html.zig |
const std = @import("std");
const helper = @import("helper.zig");
const Allocator = std.mem.Allocator;
const HashMap = std.AutoHashMap;
const input = @embedFile("../inputs/day20.txt");
pub fn run(alloc: Allocator, stdout_: anytype) !void {
var lines = helper.getlines(input);
const algo = getEnhancementAlgorit... | src/day20.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
const BigInt = u50;
fn pgcd(val1: BigInt, val2: BigInt) BigInt {
var a = if (val1 > val2) val1 else val2;
var b = if (val1 > val2) val2 else val1;
while (b != 0) {
const r = a % b;
a = b;
b... | 2020/day13.zig |
const std = @import("std");
const builtin = @import("builtin");
const sdl = @import("sdl2");
const Save = @import("Save.zig");
const TimeStats = @import("TimeStats.zig");
const Context = @import("Context.zig");
const Texture = @import("Texture.zig");
const Popup = @import("Popup.zig");
const Instance = @This();
const... | src/Instance.zig |
const T = 0x00000000;
const B = 0x11000000;
const W = 0xFFFFFFFF;
const P = 0xFFad03fc;
pub const pixels = [32*32]u32 { // Now he is safe here :)
P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,
P,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,P,
P,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,... | src/guy.zig |
const std = @import("std");
const tls = @import("tls");
const RecordingRandom = struct {
base: std.rand.Random,
recorded: std.ArrayList(u8),
pub fn random(self: *RecordingRandom) std.rand.Random {
return std.rand.Random.init(self, fill);
}
fn fill(self: *RecordingRandom, buf: []u8) void {... | bench/record_handshake.zig |
pub var mi_max_align_size = 16;
pub var mi_secure = 0;
pub var mi_debug = 0;
pub var mi_padding = 1;
pub var mi_encode_freelist = 1;
pub var mi_intptr_shift = 3;
pub var mi_intptr_size = 1 << mi_intptr_shift;
pub var mi_intptr_bits = mi_intptr_size * 8;
pub const KiB = @as(usize, 1024);
pub const MiB = KiB * K... | src/mimalloc_types.zig |
pub fn main() !void {
try renderer.render(.{
.Shader = SimpleBlendShader,
//.Shader = CheckerShader,
//.Shader = BandingShader,
//.Shader = CliffordAttractorShader,
//.Shader = JuliaSetShader,
//.Shader = SimplexNoiseShader,
//.Shader = GeometryShader,
... | main.zig |
const std = @import("std");
const info = std.log.info;
const warn = std.log.warn;
const bus = @import("bus.zig");
const mi = @import("mi.zig");
const InterruptSource = mi.InterruptSource;
const AIReg = enum(u64) {
AIDRAMAddr = 0x00,
AILen = 0x04,
AIControl = 0x08,
AIStatus = 0x0C,
AIDA... | src/core/ai.zig |
const std = @import("std");
const wasm3 = @import("wasm3");
const kib = 1024;
const mib = 1024 * kib;
const gib = 1024 * mib;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var a = &gpa.allocator;
var args = try std.process.argsAlloc(a);
defer st... | example/test.zig |
const std = @import("std");
const aoc = @import("aoc-lib.zig");
const Operator = enum { plus, times };
const Bracket = enum { open, close };
const TokenType = enum { operand, operator, bracket };
const Token = union(TokenType) {
operand: usize,
operator: Operator,
bracket: Bracket,
};
pub fn RPN(alloc: st... | 2020/18/aoc.zig |
const std = @import("std");
// Spec is the base configuration for the container.
pub const Spec = struct {
// Process configures the container process.
process: Process,
// Root configures the container's root filesystem.
root: Root,
// Hostname configures the container's hostname.
hostname: ?[... | src/runtime_spec.zig |
const string = []const u8;
const std = @import("std");
const Level = enum {
err, warn, info, success
};
pub fn print(comptime fmt: string, args: anytype) void {
const stderr = std.io.getStdErr().writer();
const held = std.debug.getStderrMutex().acquire();
defer held.release();
nosuspend stderr.pr... | src/prettyprint.zig |
const std = @import("../std.zig");
const assert = std.debug.assert;
const mem = std.mem;
const ast = std.zig.ast;
const Token = std.zig.Token;
const indent_delta = 4;
pub const Error = error{
/// Ran out of memory allocating call stack frames to complete rendering.
OutOfMemory,
};
/// Returns whether anythin... | lib/std/zig/render.zig |
const std = @import("std");
pub const Server = struct {
server_addr: std.net.Address,
allocator: *std.mem.Allocator,
stream_server: std.net.StreamServer,
pages: *const Pages,
contexts: ContextsBag,
shutdownServer: std.atomic.Int(bool) = std.atomic.Int(bool).init(false),
page_cnt: std.atomic... | src/http_server.zig |
pub const PR_SET_PDEATHSIG = 1;
pub const PR_GET_PDEATHSIG = 2;
pub const PR_GET_DUMPABLE = 3;
pub const PR_SET_DUMPABLE = 4;
pub const PR_GET_UNALIGN = 5;
pub const PR_SET_UNALIGN = 6;
pub const PR_UNALIGN_NOPRINT = 1;
pub const PR_UNALIGN_SIGBUS = 2;
pub const PR_GET_KEEPCAPS = 7;
pub const PR_SET_KEEPCAPS = 8;
... | lib/std/os/bits/linux/prctl.zig |
const image = @import("image.zig");
const Rectangle = image.Rectangle;
const std = @import("std");
const testing = std.testing;
fn in(f: Rectangle, g: Rectangle) bool {
if (!f.in(g)) {
return false;
}
var y = f.min.y;
while (y < f.max.y) {
var x = f.min.x;
while (x < f.max.x) {
... | src/image/image_test.zig |
const std = @import("std");
const c = @import("c/c.zig");
const utils = @import("utils.zig");
usingnamespace @import("types.zig");
pub const Event = union(enum) {
const Self = @This();
key: KeyEvent,
mouse: MouseEvent,
window_buffer_size: Coords,
menu: u32,
focus: bool,
pu... | src/events.zig |
const std = @import("std");
const glfw = @import("glfz");
const zgpu = @import("zgpu");
pub fn main() !void {
try glfw.init();
defer glfw.deinit();
const win = try glfw.Window.init(800, 600, "zgpu triangle", .{
.client_api = .none,
});
defer win.deinit();
// TODO: support not-X11
... | examples/triangle/main.zig |