diff options
author | Paul Masurel <paul.masurel@gmail.com> | 2017-05-15 22:30:18 +0900 |
---|---|---|
committer | Paul Masurel <paul.masurel@gmail.com> | 2017-05-15 22:30:18 +0900 |
commit | 4c8f9742f882dd1366f4130ac11a5ce4a786180f (patch) | |
tree | af07264eadf34f1dd55898e90ff23388734324f9 /src/common/mod.rs | |
parent | a23b7a181541f00d0a8b437af8617951526d23a6 (diff) |
format
Diffstat (limited to 'src/common/mod.rs')
-rw-r--r-- | src/common/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/mod.rs b/src/common/mod.rs index ae9f567..4629ed9 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -19,10 +19,10 @@ pub fn make_io_err(msg: String) -> io::Error { /// Has length trait pub trait HasLen { /// Return length - fn len(&self,) -> usize; - + fn len(&self) -> usize; + /// Returns true iff empty. - fn is_empty(&self,) -> bool { + fn is_empty(&self) -> bool { self.len() == 0 } } @@ -32,13 +32,13 @@ const HIGHEST_BIT: u64 = 1 << 63; /// Maps `i64` to `u64` so that /// `-2^63 .. 2^63-1` is mapped -/// to +/// to /// `0 .. 2^64` /// in that order. /// /// This is more suited than simply casting (`val as u64`) /// because of bitpacking. -/// +/// /// Imagine a list of `i64` ranging from -10 to 10. /// When casting negative values, the negative values are projected /// to values over 2^63, and all values end up requiring 64 bits. @@ -47,7 +47,7 @@ pub fn i64_to_u64(val: i64) -> u64 { (val as u64) ^ HIGHEST_BIT } -/// Reverse the mapping given by +/// Reverse the mapping given by /// `i64_to_u64`. #[inline(always)] pub fn u64_to_i64(val: u64) -> i64 { @@ -76,4 +76,4 @@ mod test { test_i64_converter_helper(i); } } -}
\ No newline at end of file +} |