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 1ff8994 commit 0fc4403Copy full SHA for 0fc4403
src/libstd/map.rs
@@ -296,15 +296,15 @@ mod chained {
296
}
297
298
obj o<copy K, copy V>(tbl: @t<K,V>,
299
- lf: float) {
+ lf: util::rational) {
300
fn size() -> uint {
301
ret tbl.size;
302
303
304
fn insert(k: K, v: V) -> bool {
305
let nchains = vec::len(tbl.chains);
306
- let load = (tbl.size + 1u as float) / (nchains as float);
307
- if load > lf {
+ let load = {num:tbl.size + 1u as int, den:nchains as int};
+ if !util::rational_leq(load, lf) {
308
rehash(*tbl);
309
310
ret insert(*tbl, k, v);
@@ -349,7 +349,7 @@ mod chained {
349
mutable chains: chains(initial_capacity),
350
hasher: hasher,
351
eqer: eqer};
352
- ret o(t, 0.75);
+ ret o(t, {num:3, den:4});
353
354
355
0 commit comments