From 5c04aa3a37c813a2e54a312a25f8bd96a0c23ab5 Mon Sep 17 00:00:00 2001 From: Markus Maiwald Date: Tue, 3 Feb 2026 17:30:48 +0100 Subject: [PATCH] fix: Zig 0.15.2 type casts and enum syntax - png.zig: Use @floatFromInt for u8->f64 conversions - png.zig: Use @as(u32, ...) for enumFromInt - png.zig: Mark unused Gamma parameters - duckdb.zig: Simplify enum Refs: RFC-0015 --- l0-transport/png.zig | 11 +++++++---- l4-feed/duckdb.zig | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/l0-transport/png.zig b/l0-transport/png.zig index d5707ac..c6b1f09 100644 --- a/l0-transport/png.zig +++ b/l0-transport/png.zig @@ -71,12 +71,12 @@ pub const PngState = struct { const timing_dist_val = entropy[1] % 3; return EpochProfile{ - .size_distribution = @enumFromInt(size_dist_val), + .size_distribution = @enumFromInt(@as(u32, size_dist_val)), .size_mean = @as(u16, 1200) + (@as(u16, entropy[2]) * 2), // 1200-1710 bytes .size_stddev = 100 + entropy[3], // 100-355 bytes - .timing_distribution = @enumFromInt(timing_dist_val), - .timing_lambda = 0.001 + (@as(f64, entropy[4]) / 255.0) * 0.019, // 0.001-0.02 - .dummy_probability = @as(f64, entropy[5] % 16) / 100.0, // 0.0-0.15 + .timing_distribution = @enumFromInt(@as(u32, timing_dist_val)), + .timing_lambda = 0.001 + (@as(f64, @floatFromInt(entropy[4])) / 255.0) * 0.019, + .dummy_probability = @as(f64, @floatFromInt(entropy[5] % 16)) / 100.0, .dummy_distribution = if (entropy[6] % 2 == 0) .Uniform else .Bursty, .epoch_packet_count = 100 + (@as(u32, entropy[7]) * 4), // 100-1116 packets }; @@ -202,6 +202,9 @@ pub const PngState = struct { } fn sampleGamma(self: *Self, shape: f64, scale: f64) f64 { + _ = self; + _ = shape; + _ = scale; // Marsaglia-Tsang method if (shape < 1.0) { const d = shape + 1.0 - 1.0 / 3.0; diff --git a/l4-feed/duckdb.zig b/l4-feed/duckdb.zig index b088ef0..ba07aa0 100644 --- a/l4-feed/duckdb.zig +++ b/l4-feed/duckdb.zig @@ -19,7 +19,6 @@ pub const Appender = opaque {}; pub const State = enum { success, error, - // ... more error codes }; /// C API Functions