Skip to content

Commit 42538d1

Browse files
author
Palmer Cox
committed
---
yaml --- r: 85470 b: refs/heads/dist-snap c: a37f284 h: refs/heads/master v: v3
1 parent 97afd02 commit 42538d1

File tree

13 files changed

+397
-392
lines changed

13 files changed

+397
-392
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 0983ebe5310d4eb6d289f636f7ed0536c08bbc0e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 20213fcca420f6b6a0b8990a4647edad39148c07
9+
refs/heads/dist-snap: a37f2844e0acc8c87e4550ebd031bfd1d3dc6c57
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libextra/crypto/cryptoutil.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ pub fn write_u32_be(dst: &mut[u8], input: u32) {
3636
}
3737
}
3838

39+
/// Write a u32 into a vector, which must be 4 bytes long. The value is written in little-endian
40+
/// format.
41+
pub fn write_u32_le(dst: &mut[u8], input: u32) {
42+
use std::cast::transmute;
43+
use std::unstable::intrinsics::to_le32;
44+
assert!(dst.len() == 4);
45+
unsafe {
46+
let x: *mut i32 = transmute(dst.unsafe_mut_ref(0));
47+
*x = to_le32(input as i32);
48+
}
49+
}
50+
3951
/// Read a vector of bytes into a vector of u64s. The values are read in big-endian format.
4052
pub fn read_u64v_be(dst: &mut[u64], input: &[u8]) {
4153
use std::cast::transmute;
@@ -68,6 +80,22 @@ pub fn read_u32v_be(dst: &mut[u32], input: &[u8]) {
6880
}
6981
}
7082

83+
/// Read a vector of bytes into a vector of u32s. The values are read in little-endian format.
84+
pub fn read_u32v_le(dst: &mut[u32], input: &[u8]) {
85+
use std::cast::transmute;
86+
use std::unstable::intrinsics::to_le32;
87+
assert!(dst.len() * 4 == input.len());
88+
unsafe {
89+
let mut x: *mut i32 = transmute(dst.unsafe_mut_ref(0));
90+
let mut y: *i32 = transmute(input.unsafe_ref(0));
91+
do dst.len().times() {
92+
*x = to_le32(*y);
93+
x = x.offset(1);
94+
y = y.offset(1);
95+
}
96+
}
97+
}
98+
7199

72100
/// Returns true if adding the two parameters will result in integer overflow
73101
pub fn will_add_overflow<T: Int + Unsigned>(x: T, y: T) -> bool {

branches/dist-snap/src/libstd/local_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ wish to store.
2424
~~~{.rust}
2525
use std::local_data;
2626
27-
static key_int: local_data::Key<int> = &local_data::Key;
28-
static key_vector: local_data::Key<~[int]> = &local_data::Key;
27+
local_data_key!(key_int: int);
28+
local_data_key!(key_vector: ~[int]);
2929
3030
local_data::set(key_int, 3);
3131
local_data::get(key_int, |opt| assert_eq!(opt, Some(&3)));

branches/dist-snap/src/libstd/rt/rtio.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,22 @@ pub type RtioTcpStreamObject = uvio::UvTcpStream;
2424
pub type RtioTcpListenerObject = uvio::UvTcpListener;
2525
pub type RtioUdpSocketObject = uvio::UvUdpSocket;
2626
pub type RtioTimerObject = uvio::UvTimer;
27-
pub type PausibleIdleCallback = uvio::UvPausibleIdleCallback;
2827

2928
pub trait EventLoop {
3029
fn run(&mut self);
3130
fn callback(&mut self, ~fn());
32-
fn pausible_idle_callback(&mut self) -> ~PausibleIdleCallback;
3331
fn callback_ms(&mut self, ms: u64, ~fn());
3432
fn remote_callback(&mut self, ~fn()) -> ~RemoteCallbackObject;
3533
/// The asynchronous I/O services. Not all event loops may provide one
3634
fn io<'a>(&'a mut self) -> Option<&'a mut IoFactoryObject>;
3735
}
3836

3937
pub trait RemoteCallback {
40-
/// Trigger the remote callback. Note that the number of times the
41-
/// callback is run is not guaranteed. All that is guaranteed is
42-
/// that, after calling 'fire', the callback will be called at
43-
/// least once, but multiple callbacks may be coalesced and
44-
/// callbacks may be called more often requested. Destruction also
45-
/// triggers the callback.
38+
/// Trigger the remote callback. Note that the number of times the callback
39+
/// is run is not guaranteed. All that is guaranteed is that, after calling 'fire',
40+
/// the callback will be called at least once, but multiple callbacks may be coalesced
41+
/// and callbacks may be called more often requested. Destruction also triggers the
42+
/// callback.
4643
fn fire(&mut self);
4744
}
4845

0 commit comments

Comments
 (0)