We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38732c4 commit 649c175Copy full SHA for 649c175
src/libstd/rand/reader.rs
@@ -47,13 +47,17 @@ impl<R: Reader> ReaderRng<R> {
47
48
impl<R: Reader> Rng for ReaderRng<R> {
49
fn next_u32(&mut self) -> u32 {
50
+ // This is designed for speed: reading a LE integer on a LE
51
+ // platform just involves blitting the bytes into the memory
52
+ // of the u32, similarly for BE on BE; avoiding byteswapping.
53
if cfg!(target_endian="little") {
54
self.reader.read_le_u32_()
55
} else {
56
self.reader.read_be_u32_()
57
}
58
59
fn next_u64(&mut self) -> u64 {
60
+ // see above for explanation.
61
62
self.reader.read_le_u64_()
63
0 commit comments