Skip to content

Commit

Permalink
Manual function specification reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Jan 2, 2020
1 parent 3a5d5a8 commit fab964d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
18 changes: 11 additions & 7 deletions rand_distr/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,17 @@ pub(crate) fn log_gamma(x: f64) -> f64 {
// size from force-inlining.
#[inline(always)]
pub(crate) fn ziggurat<R: Rng + ?Sized, P, Z>(
rng: &mut R,
symmetric: bool,
x_tab: ziggurat_tables::ZigTable,
f_tab: ziggurat_tables::ZigTable,
mut pdf: P,
mut zero_case: Z)
-> f64 where P: FnMut(f64) -> f64, Z: FnMut(&mut R, f64) -> f64 {
rng: &mut R,
symmetric: bool,
x_tab: ziggurat_tables::ZigTable,
f_tab: ziggurat_tables::ZigTable,
mut pdf: P,
mut zero_case: Z
) -> f64
where
P: FnMut(f64) -> f64,
Z: FnMut(&mut R, f64) -> f64,
{
loop {
// As an optimisation we re-implement the conversion to a f64.
// From the remaining 12 most significant bits we use 8 to construct `i`.
Expand Down
18 changes: 11 additions & 7 deletions src/distributions/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,17 @@ pub fn log_gamma(x: f64) -> f64 {
#[cfg(feature = "std")]
#[inline(always)]
pub fn ziggurat<R: Rng + ?Sized, P, Z>(
rng: &mut R,
symmetric: bool,
x_tab: ziggurat_tables::ZigTable,
f_tab: ziggurat_tables::ZigTable,
mut pdf: P,
mut zero_case: Z)
-> f64 where P: FnMut(f64) -> f64, Z: FnMut(&mut R, f64) -> f64 {
rng: &mut R,
symmetric: bool,
x_tab: ziggurat_tables::ZigTable,
f_tab: ziggurat_tables::ZigTable,
mut pdf: P,
mut zero_case: Z
) -> f64
where
P: FnMut(f64) -> f64,
Z: FnMut(&mut R, f64) -> f64,
{
use crate::distributions::float::IntoFloat;
loop {
// As an optimisation we re-implement the conversion to a f64.
Expand Down

0 comments on commit fab964d

Please sign in to comment.