Skip to content

Commit f0cb898

Browse files
committed
---
yaml --- r: 145346 b: refs/heads/try2 c: 0951313 h: refs/heads/master v: v3
1 parent 24ca197 commit f0cb898

File tree

10 files changed

+3
-392
lines changed

10 files changed

+3
-392
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: fb923c7d3f8b37661f49dc2d384749f0296896a0
8+
refs/heads/try2: 0951313c1eb6ef0d7b6c30d51211637fcc1b3624
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/rt.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ RUNTIME_CXXS_$(1)_$(2) := \
7474
rt/rust_rng.cpp \
7575
rt/rust_upcall.cpp \
7676
rt/rust_uv.cpp \
77-
rt/isaac/randport.cpp \
7877
rt/miniz.cpp \
7978
rt/memory_region.cpp \
8079
rt/boxed_region.cpp \

branches/try2/src/libstd/rand/mod.rs

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ pub mod rustrt {
242242
use libc::size_t;
243243

244244
extern {
245-
pub fn rand_seed_size() -> size_t;
246245
pub fn rand_gen_seed(buf: *mut u8, sz: size_t);
247246
}
248247
}
@@ -822,8 +821,8 @@ pub fn seed() -> ~[u8] {
822821
#[fixed_stack_segment]; #[inline(never)];
823822

824823
unsafe {
825-
let n = rustrt::rand_seed_size() as uint;
826-
let mut s = vec::from_elem(n, 0_u8);
824+
let n = RAND_SIZE * 4;
825+
let mut s = vec::from_elem(n as uint, 0_u8);
827826
do s.as_mut_buf |p, sz| {
828827
rustrt::rand_gen_seed(p, sz as size_t)
829828
}
@@ -1053,46 +1052,6 @@ mod test {
10531052
(f32, (f64, (float,)))) = random();
10541053
}
10551054

1056-
#[test]
1057-
fn compare_isaac_implementation() {
1058-
#[fixed_stack_segment]; #[inline(never)];
1059-
1060-
// This is to verify that the implementation of the ISAAC rng is
1061-
// correct (i.e. matches the output of the upstream implementation,
1062-
// which is in the runtime)
1063-
use libc::size_t;
1064-
1065-
#[abi = "cdecl"]
1066-
mod rustrt {
1067-
use libc::size_t;
1068-
1069-
#[allow(non_camel_case_types)] // runtime type
1070-
pub enum rust_rng {}
1071-
1072-
extern {
1073-
pub fn rand_new_seeded(buf: *u8, sz: size_t) -> *rust_rng;
1074-
pub fn rand_next(rng: *rust_rng) -> u32;
1075-
pub fn rand_free(rng: *rust_rng);
1076-
}
1077-
}
1078-
1079-
// run against several seeds
1080-
do 10.times {
1081-
unsafe {
1082-
let seed = super::seed();
1083-
let rt_rng = do seed.as_imm_buf |p, sz| {
1084-
rustrt::rand_new_seeded(p, sz as size_t)
1085-
};
1086-
let mut rng = IsaacRng::new_seeded(seed);
1087-
1088-
do 10000.times {
1089-
assert_eq!(rng.next(), rustrt::rand_next(rt_rng));
1090-
}
1091-
rustrt::rand_free(rt_rng);
1092-
}
1093-
}
1094-
}
1095-
10961055
#[test]
10971056
fn test_sample() {
10981057
let MIN_VAL = 1;

branches/try2/src/rt/isaac/rand.h

Lines changed: 0 additions & 54 deletions
This file was deleted.

branches/try2/src/rt/isaac/randport.cpp

Lines changed: 0 additions & 139 deletions
This file was deleted.

branches/try2/src/rt/isaac/standard.h

Lines changed: 0 additions & 50 deletions
This file was deleted.

branches/try2/src/rt/rust_builtin.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -69,35 +69,11 @@ rust_env_pairs() {
6969
}
7070
#endif
7171

72-
extern "C" CDECL size_t
73-
rand_seed_size() {
74-
return rng_seed_size();
75-
}
76-
7772
extern "C" CDECL void
7873
rand_gen_seed(uint8_t* dest, size_t size) {
7974
rng_gen_seed(dest, size);
8075
}
8176

82-
extern "C" CDECL void *
83-
rand_new_seeded(uint8_t* seed, size_t seed_size) {
84-
assert(seed != NULL);
85-
rust_rng *rng = (rust_rng *) malloc(sizeof(rust_rng));
86-
assert(rng != NULL && "rng alloc failed");
87-
rng_init(rng, NULL, seed, seed_size);
88-
return rng;
89-
}
90-
91-
extern "C" CDECL uint32_t
92-
rand_next(rust_rng *rng) {
93-
return rng_gen_u32(rng);
94-
}
95-
96-
extern "C" CDECL void
97-
rand_free(rust_rng *rng) {
98-
free(rng);
99-
}
100-
10177
extern "C" CDECL char*
10278
#if defined(__WIN32__)
10379
rust_list_dir_val(WIN32_FIND_DATA* entry_ptr) {

0 commit comments

Comments
 (0)