From ef42a1b28226956d7bcaeb2107508ea35ece9a01 Mon Sep 17 00:00:00 2001 From: sergeych Date: Fri, 13 Oct 2023 03:28:12 +0100 Subject: [PATCH] experimental module bipack is made pub for test in real projects --- Cargo.toml | 2 +- README.md | 2 +- src/bipack_sink.rs | 6 ++---- src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3586c9e..849f937 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bipack_ru" -version = "0.2.1" +version = "0.2.2" edition = "2021" license = "Apache-2.0" description = "binary size-effective format used in Divan smart contracts, wasm bindings, network protocols, etc." diff --git a/README.md b/README.md index bb84802..1834f5e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The following parts are already safe to use - u8, u16, u32, u64, `smartint` variable-length unsigned - i8, i16, i32, i64, `smartint` variable-length signed - strings (utf8, variable length) -- fixed byte arrays +- fixed size byte arrays - variable length byte arrays The sample code (see `src/lib.rs` for more:) diff --git a/src/bipack_sink.rs b/src/bipack_sink.rs index ad08662..1fc08a9 100644 --- a/src/bipack_sink.rs +++ b/src/bipack_sink.rs @@ -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) ); diff --git a/src/lib.rs b/src/lib.rs index 543aab0..f01264b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -117,7 +117,7 @@ pub mod bipack_source; pub mod bipack_sink; pub mod tools; -mod bipack; +pub mod bipack; #[cfg(test)] mod tests {