Function bitLength [src]

Prototype

pub fn bitLength(self: *HuffmanEncoder, freq: []u16) u32

Parameters

self: *HuffmanEncoderfreq: []u16

Source

pub fn bitLength(self: *HuffmanEncoder, freq: []u16) u32 { var total: u32 = 0; for (freq, 0..) |f, i| { if (f != 0) { total += @as(u32, @intCast(f)) * @as(u32, @intCast(self.codes[i].len)); } } return total; }