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

Commit 851765c

Browse files
authored
More BitPacking fixes (#14)
1 parent 8108ce7 commit 851765c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/bitpacking.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ test "bitpack range" {
6060
const fl = @import("./fastlanez.zig");
6161
const BP = BitPacking(fl.FastLanez(u8));
6262

63-
const W = 3;
63+
const W = 6;
6464

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

7070
var packed_ints: [128 * W]u8 = undefined;

src/fastlanez.zig

+3-3
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ pub fn FastLanez(comptime Element: type) type {
185185
self.t += 1;
186186

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

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

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

0 commit comments

Comments
 (0)