diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-02-17 17:54:18 -0500 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-02-17 23:09:20 -0500 |
| commit | a01ef8ef87d9697307c5d4fec4d1fa1ede0d65ae (patch) | |
| tree | 412c8fbd518402daf2e0a89dbb14d191dbec654c /src/libstd | |
| parent | 91fae2791292c7374143e82814a375a12bfd4e83 (diff) | |
| download | rust-a01ef8ef87d9697307c5d4fec4d1fa1ede0d65ae.tar.gz rust-a01ef8ef87d9697307c5d4fec4d1fa1ede0d65ae.zip | |
Change SmallBitv to use uint instead of u32
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bitv.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index c72f9ec2f98..4d995c733be 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -16,25 +16,25 @@ use core::vec; struct SmallBitv { /// only the lowest nbits of this value are used. the rest is undefined. - bits: u32 + bits: uint } /// a mask that has a 1 for each defined bit in a small_bitv, assuming n bits #[inline(always)] -fn small_mask(nbits: uint) -> u32 { +fn small_mask(nbits: uint) -> uint { (1 << nbits) - 1 } impl SmallBitv { - static fn new(bits: u32) -> SmallBitv { + static fn new(bits: uint) -> SmallBitv { SmallBitv {bits: bits} } #[inline(always)] - fn bits_op(&mut self, right_bits: u32, nbits: uint, - f: fn(u32, u32) -> u32) -> bool { + fn bits_op(&mut self, right_bits: uint, nbits: uint, + f: fn(uint, uint) -> uint) -> bool { let mask = small_mask(nbits); - let old_b: u32 = self.bits; + let old_b: uint = self.bits; let new_b = f(old_b, right_bits); self.bits = new_b; mask & old_b != mask & new_b @@ -71,7 +71,7 @@ impl SmallBitv { self.bits |= 1<<i; } else { - self.bits &= !(1<<i as u32); + self.bits &= !(1<<i as uint); } } @@ -259,7 +259,7 @@ priv impl Bitv { impl Bitv { static fn new(nbits: uint, init: bool) -> Bitv { - let rep = if nbits <= 32 { + let rep = if nbits <= uint::bits { Small(~SmallBitv::new(if init {!0} else {0})) } else { |
