-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support 8 and 16 bit integer data types with zfp codec by promoting t…
…o 32 bit - https://zfp.readthedocs.io/en/release1.0.1/low-level-api.html#utility-functions - https://github.com/LLNL/zfp/blob/1.0.1/src/zfp.c#L978-L1047
- Loading branch information
Showing
6 changed files
with
319 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#[derive(Debug)] | ||
pub enum ZfpArray { | ||
Int32(Vec<i32>), | ||
Int64(Vec<i64>), | ||
Float(Vec<f32>), | ||
Double(Vec<f64>), | ||
} | ||
|
||
impl ZfpArray { | ||
pub fn len(&self) -> usize { | ||
match self { | ||
ZfpArray::Int32(v) => v.len(), | ||
ZfpArray::Int64(v) => v.len(), | ||
ZfpArray::Float(v) => v.len(), | ||
ZfpArray::Double(v) => v.len(), | ||
} | ||
} | ||
|
||
pub fn zfp_type(&self) -> zfp_sys::zfp_type { | ||
match self { | ||
ZfpArray::Int32(_) => zfp_sys::zfp_type_zfp_type_int32, | ||
ZfpArray::Int64(_) => zfp_sys::zfp_type_zfp_type_int64, | ||
ZfpArray::Float(_) => zfp_sys::zfp_type_zfp_type_float, | ||
ZfpArray::Double(_) => zfp_sys::zfp_type_zfp_type_double, | ||
} | ||
} | ||
|
||
// pub fn as_ptr(&self) -> *const std::ffi::c_void { | ||
// match self { | ||
// ZfpArray::Int32(v) => v.as_ptr().cast::<std::ffi::c_void>(), | ||
// ZfpArray::Int64(v) => v.as_ptr().cast::<std::ffi::c_void>(), | ||
// ZfpArray::Float(v) => v.as_ptr().cast::<std::ffi::c_void>(), | ||
// ZfpArray::Double(v) => v.as_ptr().cast::<std::ffi::c_void>(), | ||
// } | ||
// } | ||
|
||
pub fn as_mut_ptr(&mut self) -> *mut std::ffi::c_void { | ||
match self { | ||
ZfpArray::Int32(v) => v.as_mut_ptr().cast::<std::ffi::c_void>(), | ||
ZfpArray::Int64(v) => v.as_mut_ptr().cast::<std::ffi::c_void>(), | ||
ZfpArray::Float(v) => v.as_mut_ptr().cast::<std::ffi::c_void>(), | ||
ZfpArray::Double(v) => v.as_mut_ptr().cast::<std::ffi::c_void>(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.