| ... | ... | @@ -993,14 +993,15 @@ const huffman = struct { |
| 993 | 993 | const max_leafs = 286; |
| 994 | 994 | const max_nodes = max_leafs * 2; |
| 995 | 995 | |
| 996 | | const Node = struct { |
| 997 | | freq: u16, |
| 996 | const Node = packed struct(u32) { |
| 998 | 997 | depth: u16, |
| 998 | freq: u16, |
| 999 | 999 | |
| 1000 | 1000 | pub const Index = u16; |
| 1001 | 1001 | |
| 1002 | /// `freq` is more significant than `depth` |
| 1002 | 1003 | pub fn smaller(a: Node, b: Node) bool { |
| 1003 | | return if (a.freq != b.freq) a.freq < b.freq else a.depth < b.depth; |
| 1004 | return @as(u32, @bitCast(a)) < @as(u32, @bitCast(b)); |
| 1004 | 1005 | } |
| 1005 | 1006 | }; |
| 1006 | 1007 | |