experimental module bipack is made pub for test in real projects
This commit is contained in:
1 parent
89b67f74bc
commit
ef42a1b282
4 files changed
+5
-7
No files matched your search
+2
-4
@@ -133,10 +133,8 @@ pub trait BipackSink {
|
||||
/// unsigned value except that LSB (bit 0) is used as negative number flag (when set,
|
||||
/// the encoded number is negative).
|
||||
///
|
||||
/// Note that because of this the range of supported integers is one bit smaller than
|
||||
/// i64, only 30 bits for value and one for a sign. This will probably be fixed later
|
||||
/// but please note that it is impractical to store really big numbers in variable-length
|
||||
/// format, consider using [BipackSink::put_i64] instead, it has no such limitation.
|
||||
/// Note that for really big number using [BipackSink::put_i64] could be more effective
|
||||
/// than the variable-length.
|
||||
fn put_signed(self: &mut Self, val: i64) {
|
||||
let (neg, val) = if val < 0 { (1, -val) } else { (0, val) };
|
||||
self.put_unsigned( (neg as u64) | ((val as u64) << 1) );
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@
|
||||
pub mod bipack_source;
|
||||
pub mod bipack_sink;
|
||||
pub mod tools;
|
||||
mod bipack;
|
||||
pub mod bipack;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
Reference in new issue
Block a user