Skip to content

Commit

Permalink
WIP: dectris impl almost done
Browse files Browse the repository at this point in the history
  • Loading branch information
sk1p committed Jul 2, 2024
1 parent 511c9ea commit a9484a5
Show file tree
Hide file tree
Showing 19 changed files with 1,432 additions and 742 deletions.
189 changes: 184 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions bs-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ pub fn decompress_lz4<T>(
let block_size = block_size.unwrap_or(0);
let mut out: Vec<T> = Vec::with_capacity(out_size);
let out_ptr: *mut T = out.as_mut_ptr();
decompress_lz4_into(in_, out_ptr, out_size, Some(block_size))?;
unsafe { out.set_len(out_size) };
unsafe {
decompress_lz4_into(in_, out_ptr, out_size, Some(block_size))?;
out.set_len(out_size)
};
Ok(out)
}

Expand All @@ -128,7 +130,7 @@ pub fn decompress_lz4<T>(
///
/// The memory pointed to by `out` must be large enough to fit the output, i.e.
/// at least `std::mem::size_of::<T> * out_size`.
pub fn decompress_lz4_into<T>(
pub unsafe fn decompress_lz4_into<T>(
in_: &[u8],
out: *mut T, // FIXME: replace with slice of MaybeUninit from Vec::spare_capacity_mut?
out_size: usize, // number of elements
Expand Down
9 changes: 9 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ tempfile = "3.10.1"
thiserror = "1.0.59"
log = "0.4.21"
ndarray = { version = "0.15.6" }
zerocopy = "0.6.1"
num = "0.4.3"

[dev-dependencies]
criterion = "0.5.1"

[[bench]]
name = "casting"
harness = false
Loading

0 comments on commit a9484a5

Please sign in to comment.