Skip to content

Commit 9d9db11

Browse files
committed
---
yaml --- r: 138551 b: refs/heads/try2 c: 598e814 h: refs/heads/master i: 138549: 34a050e 138547: 64b1a08 138543: c5562d9 v: v3
1 parent abb0215 commit 9d9db11

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: ca147a029e2052f03029a78602c292e4ec267ed6
8+
refs/heads/try2: 598e8141524c0dd316c586738c9920cd4b98fe93
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcore/hash.rs

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -186,42 +186,46 @@ fn SipState(key0: u64, key1: u64) -> SipState {
186186
state
187187
}
188188

189+
// sadly, these macro definitions can't appear later,
190+
// because they're needed in the following defs;
191+
// this design could be improved.
192+
193+
macro_rules! u8to64_le (
194+
($buf:expr, $i:expr) =>
195+
($buf[0+$i] as u64 |
196+
$buf[1+$i] as u64 << 8 |
197+
$buf[2+$i] as u64 << 16 |
198+
$buf[3+$i] as u64 << 24 |
199+
$buf[4+$i] as u64 << 32 |
200+
$buf[5+$i] as u64 << 40 |
201+
$buf[6+$i] as u64 << 48 |
202+
$buf[7+$i] as u64 << 56)
203+
)
204+
205+
macro_rules! rotl (
206+
($x:expr, $b:expr) =>
207+
(($x << $b) | ($x >> (64 - $b)))
208+
)
209+
210+
macro_rules! compress (
211+
($v0:expr, $v1:expr, $v2:expr, $v3:expr) =>
212+
({
213+
$v0 += $v1; $v1 = rotl!($v1, 13); $v1 ^= $v0;
214+
$v0 = rotl!($v0, 32);
215+
$v2 += $v3; $v3 = rotl!($v3, 16); $v3 ^= $v2;
216+
$v0 += $v3; $v3 = rotl!($v3, 21); $v3 ^= $v0;
217+
$v2 += $v1; $v1 = rotl!($v1, 17); $v1 ^= $v2;
218+
$v2 = rotl!($v2, 32);
219+
})
220+
)
221+
189222

190223
impl io::Writer for SipState {
191224

192225
// Methods for io::writer
193226
#[inline(always)]
194227
fn write(&self, msg: &[const u8]) {
195228

196-
macro_rules! u8to64_le (
197-
($buf:expr, $i:expr) =>
198-
($buf[0+$i] as u64 |
199-
$buf[1+$i] as u64 << 8 |
200-
$buf[2+$i] as u64 << 16 |
201-
$buf[3+$i] as u64 << 24 |
202-
$buf[4+$i] as u64 << 32 |
203-
$buf[5+$i] as u64 << 40 |
204-
$buf[6+$i] as u64 << 48 |
205-
$buf[7+$i] as u64 << 56)
206-
);
207-
208-
macro_rules! rotl (
209-
($x:expr, $b:expr) =>
210-
(($x << $b) | ($x >> (64 - $b)))
211-
);
212-
213-
macro_rules! compress (
214-
($v0:expr, $v1:expr, $v2:expr, $v3:expr) =>
215-
({
216-
$v0 += $v1; $v1 = rotl!($v1, 13); $v1 ^= $v0;
217-
$v0 = rotl!($v0, 32);
218-
$v2 += $v3; $v3 = rotl!($v3, 16); $v3 ^= $v2;
219-
$v0 += $v3; $v3 = rotl!($v3, 21); $v3 ^= $v0;
220-
$v2 += $v1; $v1 = rotl!($v1, 17); $v1 ^= $v2;
221-
$v2 = rotl!($v2, 32);
222-
})
223-
);
224-
225229
let length = msg.len();
226230
self.length += length;
227231

0 commit comments

Comments
 (0)