Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

More BitPacking fixes #14

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bitpacking.zig
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ test "bitpack range" {
const fl = @import("./fastlanez.zig");
const BP = BitPacking(fl.FastLanez(u8));

const W = 3;
const W = 6;

var ints: [1024]u8 = undefined;
for (0..1024) |i| {
ints[i] = @intCast(i % 7);
ints[i] = @intCast(i % std.math.maxInt(std.meta.Int(.unsigned, W)));
}

var packed_ints: [128 * W]u8 = undefined;
Expand Down
6 changes: 3 additions & 3 deletions src/fastlanez.zig
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ pub fn FastLanez(comptime Element: type) type {
self.t += 1;

var tmp: MM1024 = undefined;
if (self.input_idx == 0) {
tmp = load(input, 0);
if (self.bit_idx % T == 0) {
tmp = load(input, self.input_idx);
self.input_idx += 1;
} else {
tmp = state;
Expand All @@ -197,7 +197,7 @@ pub fn FastLanez(comptime Element: type) type {

var next: MM1024 = and_rshift(tmp, shift_bits, bitmask(mask_bits));

if (mask_bits != Width and self.input_idx < Width) {
if (mask_bits != Width) {
tmp = load(input, self.input_idx);
self.input_idx += 1;

Expand Down