|
|
@ -1,4 +1,4 @@
|
|
|
|
From f578b5f3761f56cb5c5d74ae476006341a5c33c8 Mon Sep 17 00:00:00 2001
|
|
|
|
From e3e13c3bce273a05d7101d174db1d6e0f49a908d Mon Sep 17 00:00:00 2001
|
|
|
|
From: Diggory Hardy <git@dhardy.name>
|
|
|
|
From: Diggory Hardy <git@dhardy.name>
|
|
|
|
Date: Sat, 25 Nov 2017 17:38:40 +0000
|
|
|
|
Date: Sat, 25 Nov 2017 17:38:40 +0000
|
|
|
|
Subject: [PATCH] Fix read_u64 for 32-bit platforms
|
|
|
|
Subject: [PATCH] Fix read_u64 for 32-bit platforms
|
|
|
@ -6,24 +6,24 @@ Subject: [PATCH] Fix read_u64 for 32-bit platforms
|
|
|
|
(Why you can't rely on .to_le() being correct I don't understand. If compiler
|
|
|
|
(Why you can't rely on .to_le() being correct I don't understand. If compiler
|
|
|
|
is mixed-endian then to_le ought still do the correct swaps.)
|
|
|
|
is mixed-endian then to_le ought still do the correct swaps.)
|
|
|
|
---
|
|
|
|
---
|
|
|
|
seahash/src/buffer.rs | 4 ++--
|
|
|
|
src/buffer.rs | 4 ++--
|
|
|
|
seahash/src/helper.rs | 2 +-
|
|
|
|
src/helper.rs | 2 +-
|
|
|
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/seahash/src/buffer.rs b/seahash/src/buffer.rs
|
|
|
|
diff --git a/src/buffer.rs b/src/buffer.rs
|
|
|
|
index 573273d..eb2193c 100644
|
|
|
|
index a39be99..af910e2 100644
|
|
|
|
--- a/seahash/src/buffer.rs
|
|
|
|
--- a/src/buffer.rs
|
|
|
|
+++ b/seahash/src/buffer.rs
|
|
|
|
+++ b/src/buffer.rs
|
|
|
|
@@ -63,7 +63,7 @@ impl State {
|
|
|
|
@@ -65,7 +65,7 @@ impl State {
|
|
|
|
|
|
|
|
|
|
|
|
// Calculate the number of excessive bytes. These are bytes that could not be handled in
|
|
|
|
// Calculate the number of excessive bytes. These are bytes that could not be handled
|
|
|
|
// the loop above.
|
|
|
|
// in the loop above.
|
|
|
|
- let mut excessive = buf.len() as usize + buf.as_ptr() as usize - end_ptr as usize;
|
|
|
|
- let mut excessive = buf.len() as usize + buf.as_ptr() as usize - end_ptr as usize;
|
|
|
|
+ let mut excessive = buf.len() % 32;
|
|
|
|
+ let mut excessive = buf.len() % 32;
|
|
|
|
// Handle the excessive bytes.
|
|
|
|
// Handle the excessive bytes.
|
|
|
|
match excessive {
|
|
|
|
match excessive {
|
|
|
|
0 => {},
|
|
|
|
0 => {},
|
|
|
|
@@ -71,7 +71,7 @@ impl State {
|
|
|
|
@@ -73,7 +73,7 @@ impl State {
|
|
|
|
// 1 or more excessive.
|
|
|
|
// 1 or more excessive.
|
|
|
|
|
|
|
|
|
|
|
|
// Write the last excessive bytes (<8 bytes).
|
|
|
|
// Write the last excessive bytes (<8 bytes).
|
|
|
@ -32,10 +32,10 @@ index 573273d..eb2193c 100644
|
|
|
|
|
|
|
|
|
|
|
|
// Diffuse.
|
|
|
|
// Diffuse.
|
|
|
|
a = helper::diffuse(a);
|
|
|
|
a = helper::diffuse(a);
|
|
|
|
diff --git a/seahash/src/helper.rs b/seahash/src/helper.rs
|
|
|
|
diff --git a/src/helper.rs b/src/helper.rs
|
|
|
|
index a95b89c..d3be89a 100644
|
|
|
|
index df379a9..fbb9f6d 100644
|
|
|
|
--- a/seahash/src/helper.rs
|
|
|
|
--- a/src/helper.rs
|
|
|
|
+++ b/seahash/src/helper.rs
|
|
|
|
+++ b/src/helper.rs
|
|
|
|
@@ -60,7 +60,7 @@ pub unsafe fn read_u64(ptr: *const u8) -> u64 {
|
|
|
|
@@ -60,7 +60,7 @@ pub unsafe fn read_u64(ptr: *const u8) -> u64 {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// We cannot be sure about the memory layout of a potentially emulated 64-bit integer, so
|
|
|
|
// We cannot be sure about the memory layout of a potentially emulated 64-bit integer, so
|
|
|
@ -46,5 +46,5 @@ index a95b89c..d3be89a 100644
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(target_pointer_width = "64")]
|
|
|
|
#[cfg(target_pointer_width = "64")]
|
|
|
|
--
|
|
|
|
--
|
|
|
|
2.16.2
|
|
|
|
2.21.0.rc1
|
|
|
|
|
|
|
|
|
|
|
|