Skip to content

Instantly share code, notes, and snippets.

@jacobly0
jacobly0 / new.txt
Last active July 14, 2024 05:46
zig1.wasm comparison
type: 806
import: 927
function: 3996
table: 5
memory: 4
global: 9
export: 19
element: 51
code: 2742519
data: 421551
@jacobly0
jacobly0 / build.zig
Created April 5, 2024 07:06
Dependency example
const std = @import("std");
pub fn build(b: *std.Build) void {
const github_dep = b.dependency("github", .{});
const exe = b.addExecutable(.{
.name = "name",
});
exe.root_module.addIncludePath(github_dep.path("include"));
}
@jacobly0
jacobly0 / example.c
Created March 13, 2024 09:42
wait4 maxrss without parent memory
const std = @import("std");
const assert = std.debug.assert;
const expect = std.testing.expect;
pub fn main() !void {
var args = std.process.args();
_ = args.next().?;
if (args.next()) |_| {
// child process
@jacobly0
jacobly0 / build.zig
Last active February 28, 2024 17:11
zmesh build changes
const std = @import("std");
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const shape_use_32bit_indices = b.option(bool, "shape_use_32bit_indices", "Enable par shapes 32-bit indices") orelse true;
const shared = b.option(bool, "shared", "Build as shared library") orelse false;
const zmesh_options = b.addOptions();
diff --git a/ATSAMD51J19A.zig b/ATSAMD51J19A.zig
index c8646ea..e9079a4 100644
--- a/ATSAMD51J19A.zig
+++ b/ATSAMD51J19A.zig
@@ -625,14 +625,14 @@ pub const types = struct {
}),
reserved12: [1]u8,
/// Scaler n
- SCALER: mmio.Mmio(packed struct(u8) {
+ SCALER: [2]mmio.Mmio(packed struct(u8) {
@@ -222,7 +239,7 @@ srl_Open:
compare_hl_zero ; check if device is null
ld a,SRL_ERROR_INVALID_DEVICE
jq z,.exit
- ld (xsrl_device.dev),hl
+ lea hl,xsrl_device.dev
ld hl,(iy+12) ; hl = size
ld de,128 ; check if buffer is large enough
@jacobly0
jacobly0 / srldrvce.diff
Last active October 30, 2023 11:36
unnamed structs
diff --git a/src/srldrvce/srldrvce.asm b/src/srldrvce/srldrvce.asm
index 48c9dd13..c81577cd 100644
--- a/src/srldrvce/srldrvce.asm
+++ b/src/srldrvce/srldrvce.asm
@@ -36,6 +36,15 @@ end macro
; memory structures
;-------------------------------------------------------------------------------
macro struct? name*, parameters&
+ local anon
+ anon = 0
@jacobly0
jacobly0 / river.debug
Last active October 11, 2023 23:37
river.err
river: /lib64/libxkbcommon.so.0: no version information available (required by /lib64/libwlroots.so.11)
info: initializing server
info(wlroots): [libseat] [libseat/backend/seatd.c:64] Could not connect to socket /run/seatd.sock: No such file or directory
info(wlroots): [libseat] [libseat/libseat.c:76] Backend 'seatd' failed to open seat, skipping
info(wlroots): [libseat] [libseat/libseat.c:73] Seat opened with backend 'logind'
info(wlroots): [backend/session/session.c:109] Successfully loaded libseat session
info(wlroots): [backend/backend.c:220] Found 1 GPUs
info(wlroots): [backend/drm/backend.c:200] Initializing DRM backend for /dev/dri/card0 (nvidia-drm)
debug(wlroots): [backend/drm/drm.c:88] Using atomic DRM interface
debug(wlroots): [backend/drm/drm.c:101] ADDFB2 modifiers supported
@@ -1,28 +1,29 @@
; ModuleID = 'repro'
source_filename = "repro"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%target.Target.Cpu.Feature.Set = type { [5 x i64] }
%target.Target.Cpu.Model = type { { ptr, i64 }, { ptr, i64 }, %target.Target.Cpu.Feature.Set }
%target.Target.Cpu = type { ptr, %target.Target.Cpu.Feature.Set, i6, [7 x i8] }
@jacobly0
jacobly0 / naked.md
Last active August 2, 2023 19:55
Zig 0.11.0 Release Notes - Language Changes - Naked Functions

Language Changes

Naked Functions

Some things that used to be allowed in callconv(.Naked) functions are now compile errors:

  • runtime calls
  • explicit returns
  • runtime safety checks (which produce runtime calls)