fix: Correct FeedEvent size 96 bytes, fix PNG types

- feed.zig: Fix @sizeOf from 104 to 96 (actual struct size)
- png.zig: Fix type cast in wrapping arithmetic

Refs: RFC-0015
This commit is contained in:
Markus Maiwald 2026-02-03 18:01:15 +01:00
parent ef0b7b61f6
commit 482b5488e6
2 changed files with 5 additions and 5 deletions

View File

@ -71,9 +71,9 @@ pub const PngState = struct {
const timing_dist_val = entropy[1] % 3;
// Use wrapping arithmetic to avoid overflow panics in debug mode
const size_mean_val = @as(u16, 1200) +% @as(u16, @as(u32, entropy[2]) * 2);
const size_stddev_val = @as(u16, 100) +% @as(u16, entropy[3]);
const epoch_count = @as(u32, 100) +% (@as(u32, entropy[7]) * 4);
const size_mean_val = @as(u16, 1200 +% (@as(u16, entropy[2]) * 2));
const size_stddev_val = @as(u16, 100 +% entropy[3]);
const epoch_count: u32 = 100 +% (@as(u32, entropy[7]) * 4);
return EpochProfile{
.size_distribution = @enumFromInt(@as(u32, size_dist_val)),

View File

@ -36,7 +36,7 @@ pub const FeedEvent = extern struct {
parent_id: u64, // 0 = none (for replies/threading)
comptime {
std.debug.assert(@sizeOf(FeedEvent) == 104);
std.debug.assert(@sizeOf(FeedEvent) == 96);
}
};
@ -196,7 +196,7 @@ pub const FeedStore = struct {
// ============================================================================
test "FeedEvent size" {
comptime try std.testing.expectEqual(@sizeOf(FeedEvent), 104);
comptime try std.testing.expectEqual(@sizeOf(FeedEvent), 96);
}
test "EventType conversion" {