Created
April 14, 2014 09:47
-
-
Save Leonidas-from-XIV/10633161 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn read_u64(mut from: File, n: uint) -> ~[u64] { | |
| let mut buffer: Vec<u8> = Vec::with_capacity(n * 4); | |
| let mut buf = buffer.as_mut_slice(); | |
| match from.read(buf) { | |
| Ok(_) => (), | |
| Err(e) => fail!("reading failed {}", e), | |
| }; | |
| let v: ~[u64] = unsafe { std::cast::transmute(buf) }; | |
| v | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment