diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-06 12:30:35 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-13 17:03:46 -0500 |
| commit | 533a47bd9bb4aebe61af8d7ff9327af8cffdb583 (patch) | |
| tree | 96b5845240a5d38ffbe11940e46e2433ebf1986d /src | |
| parent | 5d7543b6baf511306ea91ac5f59ae8265ab0b6a3 (diff) | |
| download | rust-533a47bd9bb4aebe61af8d7ff9327af8cffdb583.tar.gz rust-533a47bd9bb4aebe61af8d7ff9327af8cffdb583.zip | |
librand: use unboxed closures in `distributions` module
Diffstat (limited to 'src')
| -rw-r--r-- | src/librand/distributions/mod.rs | 8 | ||||
| -rw-r--r-- | src/librand/lib.rs | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 0fa989bf0b2..a44197c9859 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -208,14 +208,14 @@ mod ziggurat_tables; // the perf improvement (25-50%) is definitely worth the extra code // size from force-inlining. #[inline(always)] -fn ziggurat<R:Rng>( +fn ziggurat<R: Rng, P, Z>( rng: &mut R, symmetric: bool, x_tab: ziggurat_tables::ZigTable, f_tab: ziggurat_tables::ZigTable, - pdf: |f64|: 'static -> f64, - zero_case: |&mut R, f64|: 'static -> f64) - -> f64 { + mut pdf: P, + mut zero_case: Z) + -> f64 where P: FnMut(f64) -> f64, Z: FnMut(&mut R, f64) -> f64 { static SCALE: f64 = (1u64 << 53) as f64; loop { // reimplement the f64 generation as an optimisation suggested diff --git a/src/librand/lib.rs b/src/librand/lib.rs index d357f247f1b..4fba3707703 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -24,6 +24,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![feature(macro_rules, phase, globs)] +#![feature(unboxed_closures)] #![no_std] #![experimental] |
