Merge pull request #16 from gavofyork/hash_changes
added H264 (required for extras_db slices), removed unnecessary unsafe code
This commit is contained in:
commit
d88c4db470
11
src/hash.rs
11
src/hash.rs
@ -43,19 +43,17 @@ macro_rules! impl_hash {
|
||||
|
||||
impl Deref for $from {
|
||||
type Target = [u8];
|
||||
|
||||
#[inline]
|
||||
fn deref(&self) -> &[u8] {
|
||||
unsafe {
|
||||
::std::slice::from_raw_parts(self.0.as_ptr(), $size)
|
||||
}
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
impl DerefMut for $from {
|
||||
|
||||
#[inline]
|
||||
fn deref_mut(&mut self) -> &mut [u8] {
|
||||
unsafe {
|
||||
::std::slice::from_raw_parts_mut(self.0.as_mut_ptr(), $size)
|
||||
}
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,6 +325,7 @@ impl_hash!(H64, 8);
|
||||
impl_hash!(H128, 16);
|
||||
impl_hash!(Address, 20);
|
||||
impl_hash!(H256, 32);
|
||||
impl_hash!(H264, 33);
|
||||
impl_hash!(H512, 64);
|
||||
impl_hash!(H520, 65);
|
||||
impl_hash!(H1024, 128);
|
||||
|
Loading…
Reference in New Issue
Block a user