fix(alg): ffi crc adjustment
This commit is contained in:
parent
96eee72756
commit
00ced8e548
1 changed files with 4 additions and 4 deletions
|
@ -6,9 +6,9 @@ pub type ChecksumCrc32 = u32; // uint32_t in C
|
||||||
|
|
||||||
unsafe extern "C" {
|
unsafe extern "C" {
|
||||||
fn crc32_new() -> Crc32;
|
fn crc32_new() -> Crc32;
|
||||||
fn crc32_process(data: *const c_void, len: u32, crc32: *mut Crc32);
|
fn crc32_process(data: *const u8, len: u32, crc32: *mut Crc32);
|
||||||
|
|
||||||
fn crc32_checksum(data: *const c_void, len: u32) -> ChecksumCrc32;
|
fn crc32_checksum(data: *const u8, len: u32) -> ChecksumCrc32;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -28,7 +28,7 @@ impl Crc for Crc32 {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn process(&mut self, data: &Self::Input) {
|
fn process(&mut self, data: &Self::Input) {
|
||||||
unsafe { crc32_process(ref_to_voidptr(data), data.len() as u32, self as *mut Self) }
|
unsafe { crc32_process(data, data.len() as u32, self as *mut Self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -38,7 +38,7 @@ impl Crc for Crc32 {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn checksum(data: &Self::Input) -> Self::Checksum {
|
fn checksum(data: &Self::Input) -> Self::Checksum {
|
||||||
unsafe { crc32_checksum(ref_to_voidptr(data), data.len() as u32) }
|
unsafe { crc32_checksum(data, data.len() as u32) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue