optimization: ise varint on field counter for extendable format (it's rare for a struct to have so many fields so smartint will be better).
This commit is contained in:
1 parent
e556d4bc3d
commit
149a0e1850
6 files changed
+23
-10
No files matched your search
@@ -34,6 +34,14 @@ interface DataSource {
|
||||
|
||||
fun readFloat() = Float.fromBits(readI32()).toFloat()
|
||||
|
||||
fun readSmartUInt(): UInt = Smartint.decodeUnsigned(this).toUInt()
|
||||
fun readSmartInt(): Int = Smartint.decodeSigned(this).toInt()
|
||||
|
||||
fun readVarUInt(): UInt = Varint.decodeUnsigned(this).toUInt()
|
||||
fun readVarInt(): Int = Varint.decodeSigned(this).toInt()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun ByteArray.toDataSource(): DataSource =
|
||||
|
||||
Reference in new issue
Block a user