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

Commit

Permalink
More BitPacking fixes (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesn authored Mar 19, 2024
1 parent 8108ce7 commit 851765c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 851765c

Please sign in to comment.