Skip to content

Commit a3b3f16

Browse files
committed
cleanup
1 parent f8733d2 commit a3b3f16

2 files changed

Lines changed: 23 additions & 25 deletions

File tree

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ Create one instance per thread or synchronize access externally.
7575

7676
## Crate Features
7777

78-
| Feature | Default | Description |
79-
|---------|---------|-------------|
80-
| `rust` | **yes** | Pure-Rust implementation — no `unsafe`, no build dependencies |
81-
| `cpp` | no | C++ wrapper via CXX — requires a C++14 compiler with SIMD support |
82-
| `cpp_portable` | no | Enables `cpp`, compiles C++ with SSE4.2 baseline (runs on any x86-64 from ~2008+) |
83-
| `cpp_native` | no | Enables `cpp`, compiles C++ with `-march=native` for maximum throughput on the build machine |
78+
| Feature | Default | Description |
79+
|----------------|---------|----------------------------------------------------------------------------------------------|
80+
| `rust` | **yes** | Pure-Rust implementation — no `unsafe`, no build dependencies |
81+
| `cpp` | no | C++ wrapper via CXX — requires a C++14 compiler with SIMD support |
82+
| `cpp_portable` | no | Enables `cpp`, compiles C++ with SSE4.2 baseline (runs on any x86-64 from ~2008+) |
83+
| `cpp_native` | no | Enables `cpp`, compiles C++ with `-march=native` for maximum throughput on the build machine |
8484

8585
The `FASTPFOR_SIMD_MODE` environment variable (`portable` or `native`) can override the SIMD mode at build time.
8686

@@ -92,14 +92,14 @@ The `FASTPFOR_SIMD_MODE` environment variable (`portable` or `native`) can overr
9292

9393
Rust block codecs require block-aligned input. `CompositeCodec` chains a block codec with a tail codec (e.g. `VariableByte`) to handle arbitrary-length input. `FastPFor256` and `FastPFor128` are type aliases for such composites.
9494

95-
| Codec | Description |
96-
|----------------------------|-------------------------------------------------------------------------------------------|
97-
| `FastPFor256` | `CompositeCodec` of `FastPForBlock256` + `VariableByte`. **Recommended for general use.** |
98-
| `FastPFor128` | `CompositeCodec` of `FastPForBlock128` + `VariableByte` |
99-
| `VariableByte` | Variable-byte encoding only; good for small integers |
100-
| `JustCopy` | No compression; useful as a baseline |
101-
| `FastPForBlock256` (block) | `FastPFor` with 256-element blocks; block-aligned input only |
102-
| `FastPForBlock128` (block) | `FastPFor` with 128-element blocks; block-aligned input only |
95+
| Codec | Description |
96+
|--------------------|--------------------------------------------------------------|
97+
| `FastPFor256` | `CompositeCodec` of `FastPForBlock256` + `VariableByte` |
98+
| `FastPFor128` | `CompositeCodec` of `FastPForBlock128` + `VariableByte` |
99+
| `VariableByte` | Variable-byte encoding, MSB is opposite to protobuf's varint |
100+
| `JustCopy` | No compression; useful as a baseline |
101+
| `FastPForBlock256` | `FastPFor` with 256-element blocks; block-aligned input only |
102+
| `FastPForBlock128` | `FastPFor` with 128-element blocks; block-aligned input only |
103103

104104
### C++ (`cpp` feature)
105105

@@ -108,8 +108,8 @@ All C++ codecs are composite (any-length) and implement `AnyLenCodec` only.
108108

109109
| Codec | Notes |
110110
|-----------------------------|------------------------------------------------------------------------|
111-
| `CppFastPFor128` | `FastPFor + VByte` composite, 128-element blocks. Also supports `u64`. |
112-
| `CppFastPFor256` | `FastPFor + VByte` composite, 256-element blocks. Also supports `u64`. |
111+
| `CppFastPFor128` | `FastPFor + VByte` composite, 128-element blocks. Also supports `u64`. |
112+
| `CppFastPFor256` | `FastPFor + VByte` composite, 256-element blocks. Also supports `u64`. |
113113
| `CppSimdFastPFor128` | SIMD-optimized 128-element variant |
114114
| `CppSimdFastPFor256` | SIMD-optimized 256-element variant |
115115
| `CppBP32` | Binary packing, 32-bit blocks |

tests/cpp_compat_tests.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
mod test_utils;
1010

1111
use fastpfor::{FastPFor128, FastPFor256, FastPForBlock128};
12-
use test_utils::{block_compress, block_decompress, compress, decompress, roundtrip};
12+
use test_utils::{block_compress, block_decompress, compress, roundtrip, roundtrip_full};
1313

1414
mod common;
1515
use common::{get_test_cases, test_input_sizes};
1616
use fastpfor::cpp::CppFastPFor128;
1717

18-
use crate::test_utils::roundtrip_full;
18+
use crate::test_utils::decompress;
1919

2020
/// C++ `AnyLenCodec` encode → Rust `BlockCodec` decode (same wire format for block-aligned data).
2121
#[test]
@@ -60,27 +60,25 @@ fn test_cpp_decompresses_rust_block_encoded_data() {
6060
fn test_rust_and_cpp_compression_matches() {
6161
for n in test_input_sizes() {
6262
for input in get_test_cases(n + 128) {
63-
if input.len() % 128 != 0 || input.is_empty() {
63+
let len = input.len();
64+
if len % 128 != 0 || input.is_empty() {
6465
continue;
6566
}
6667
let compressed = compress::<CppFastPFor128>(&input).unwrap();
6768
assert_eq!(
6869
compressed,
6970
block_compress::<FastPForBlock128>(&input).unwrap(),
70-
"Compressed bytes differ for input len {}",
71-
input.len()
71+
"Compressed bytes differ for input len {len}",
7272
);
7373
assert_eq!(
7474
decompress::<CppFastPFor128>(&compressed, None).unwrap(),
7575
input,
76-
"Rust→C++ roundtrip mismatch for len {}",
77-
input.len()
76+
"Rust→C++ roundtrip mismatch for len {len}",
7877
);
7978
assert_eq!(
8079
decompress::<FastPFor128>(&compressed, None).unwrap(),
8180
input,
82-
"Rust→C++ roundtrip mismatch for len {}",
83-
input.len()
81+
"Rust→C++ roundtrip mismatch for len {len}",
8482
);
8583
}
8684
}

0 commit comments

Comments
 (0)