This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const mem = std.mem; | |
| const assert = std.debug.assert; | |
| const Ast = std.zig.Ast; | |
| pub fn main() !void { | |
| var instance = std.heap.GeneralPurposeAllocator(.{}){}; | |
| defer assert(instance.deinit() == .ok); | |
| const gpa = instance.allocator(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const mem = std.mem; | |
| const assert = std.debug.assert; | |
| const Ast = std.zig.Ast; | |
| pub fn main() !void { | |
| var instance = std.heap.GeneralPurposeAllocator(.{}){}; | |
| defer assert(instance.deinit() == .ok); | |
| const gpa = instance.allocator(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Kernel | |
| const newMail = (type, content) => { | |
| console.log("new mail", type); | |
| return { type: type.id, content: content }; | |
| }; | |
| // Default actor error handling | |
| const Actor = behaviour => { | |
| const wrapper = (rt, self, mail) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <fcntl.h> | |
| #include <sys/mman.h> | |
| #include <sys/stat.h> | |
| #include <unistd.h> | |
| #include <cassert> | |
| #include <cstdint> | |
| #include <iostream> | |
| #include <map> | |
| #include <memory> | |
| #include <optional> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| // this isn't done properly | |
| pub fn main() !void { | |
| var file = try std.fs.cwd().openFile(std.mem.span(std.os.argv[1]), .{}); | |
| defer file.close(); | |
| const size = comptime @intCast(u32, std.simd.suggestVectorSize(u8) orelse 8); | |
| const page_size = std.mem.page_size; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const io = std.io; | |
| const os = std.os; | |
| const mem = std.mem; | |
| const testing = std.testing; | |
| const width = 1404; | |
| const height = 1872; | |
| pub fn main() !void {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const io = std.io; | |
| const os = std.os; | |
| const mem = std.mem; | |
| const testing = std.testing; | |
| const width = 1404; | |
| const height = 1872; | |
| pub fn main() !void {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const Instruction = struct { | |
| opcode: Opcode, | |
| src: u4, | |
| dst: u4, | |
| pub const Opcode = enum(u8) { | |
| add, | |
| sub, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const sdf = @import("sdf.zig"); | |
| const assert = std.debug.assert; | |
| const f32x4 = sdf.f32x4; | |
| pub const Instruction = packed struct(u64) { | |
| operator: Operator, | |
| data: Data, | |
| const base = @typeInfo(Operator.Opcode).Enum.fields.len - 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| pub fn PackedPtr( | |
| comptime Ptr: type, | |
| comptime Data: type, | |
| comptime tag: ?@Type(.EnumLiteral), | |
| ) type { | |
| const alignment: u16 = @typeInfo(Ptr).Pointer.alignment; | |
| const mask: usize = alignment - 1; | |
| const Int = std.meta.Int(.unsigned, @bitSizeOf(Data)); |