Convert over some residual uses of #oldmacros.
This commit is contained in:
parent
38fee9526a
commit
5d56da1678
3 changed files with 29 additions and 19 deletions
|
|
@ -131,24 +131,34 @@ impl &SipState : io::Writer {
|
|||
// Methods for io::writer
|
||||
fn write(msg: &[const u8]) {
|
||||
|
||||
#macro[[#u8to64_le(buf,i),
|
||||
(buf[0+i] as u64 |
|
||||
buf[1+i] as u64 << 8 |
|
||||
buf[2+i] as u64 << 16 |
|
||||
buf[3+i] as u64 << 24 |
|
||||
buf[4+i] as u64 << 32 |
|
||||
buf[5+i] as u64 << 40 |
|
||||
buf[6+i] as u64 << 48 |
|
||||
buf[7+i] as u64 << 56)]];
|
||||
macro_rules! u8to64_le (
|
||||
($buf:expr, $i:expr) =>
|
||||
($buf[0+$i] as u64 |
|
||||
$buf[1+$i] as u64 << 8 |
|
||||
$buf[2+$i] as u64 << 16 |
|
||||
$buf[3+$i] as u64 << 24 |
|
||||
$buf[4+$i] as u64 << 32 |
|
||||
$buf[5+$i] as u64 << 40 |
|
||||
$buf[6+$i] as u64 << 48 |
|
||||
$buf[7+$i] as u64 << 56)
|
||||
);
|
||||
|
||||
#macro[[#rotl(x,b), (x << b) | (x >> (64 - b))]];
|
||||
macro_rules! rotl (
|
||||
($x:expr, $b:expr) =>
|
||||
(($x << $b) | ($x >> (64 - $b)))
|
||||
);
|
||||
|
||||
#macro[[#compress(v0,v1,v2,v3), {
|
||||
v0 += v1; v1 = #rotl(v1, 13); v1 ^= v0; v0 = #rotl(v0, 32);
|
||||
v2 += v3; v3 = #rotl(v3, 16); v3 ^= v2;
|
||||
v0 += v3; v3 = #rotl(v3, 21); v3 ^= v0;
|
||||
v2 += v1; v1 = #rotl(v1, 17); v1 ^= v2; v2 = #rotl(v2, 32);
|
||||
}]];
|
||||
macro_rules! compress (
|
||||
($v0:expr, $v1:expr, $v2:expr, $v3:expr) =>
|
||||
{
|
||||
$v0 += $v1; $v1 = rotl!($v1, 13); $v1 ^= $v0;
|
||||
$v0 = rotl!($v0, 32);
|
||||
$v2 += $v3; $v3 = rotl!($v3, 16); $v3 ^= $v2;
|
||||
$v0 += $v3; $v3 = rotl!($v3, 21); $v3 ^= $v0;
|
||||
$v2 += $v1; $v1 = rotl!($v1, 17); $v1 ^= $v2;
|
||||
$v2 = rotl!($v2, 32);
|
||||
}
|
||||
);
|
||||
|
||||
let length = msg.len();
|
||||
self.length += length;
|
||||
|
|
|
|||
|
|
@ -321,8 +321,8 @@ fn program_output(prog: &str, args: &[~str]) ->
|
|||
errs = s;
|
||||
}
|
||||
(n, _) => {
|
||||
fail(#fmt("program_output received an unexpected file \
|
||||
number: %u", n));
|
||||
fail(fmt!("program_output received an unexpected file \
|
||||
number: %u", n));
|
||||
}
|
||||
};
|
||||
count -= 1;
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ fn pop<T>(&v: ~[const T]) -> T {
|
|||
fn swap_remove<T>(&v: ~[const T], index: uint) -> T {
|
||||
let ln = len(v);
|
||||
if index >= ln {
|
||||
fail #fmt("vec::swap_remove - index %u >= length %u", index, ln);
|
||||
fail fmt!("vec::swap_remove - index %u >= length %u", index, ln);
|
||||
}
|
||||
let lastptr = ptr::mut_addr_of(v[ln - 1]);
|
||||
unsafe {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue