From 5e91ac10b65a4c20915868d3af3c06f1d3d3cada Mon Sep 17 00:00:00 2001 From: Jason Toffaletti Date: Tue, 8 Oct 2013 08:09:13 -0700 Subject: minor --- src/libstd/rt/mpmc_bounded_queue.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/mpmc_bounded_queue.rs b/src/libstd/rt/mpmc_bounded_queue.rs index c0c7d281136..ea5d1050c18 100644 --- a/src/libstd/rt/mpmc_bounded_queue.rs +++ b/src/libstd/rt/mpmc_bounded_queue.rs @@ -57,8 +57,12 @@ struct Queue { impl State { fn with_capacity(capacity: uint) -> State { let capacity = if capacity < 2 || (capacity & (capacity - 1)) != 0 { - // use next power of 2 as capacity - 2f64.pow(&((capacity as f64).log2().floor()+1f64)) as uint + if capacity < 2 { + 2u + } else { + // use next power of 2 as capacity + 2f64.pow(&((capacity as f64).log2().ceil())) as uint + } } else { capacity }; -- cgit 1.4.1-3-g733a5