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
@@ -22,6 +22,11 @@ interface DataSink {
|
||||
fun writeBytes(data: ByteArray) {
|
||||
for(d in data) writeByte(d)
|
||||
}
|
||||
|
||||
fun writeVarUInt(value: UInt) { Varint.encodeUnsigned(value.toULong())}
|
||||
fun writeVarInt(value: UInt) { Varint.encodeSigned(value.toLong())}
|
||||
fun writeSmartUInt(value: UInt) { Smartint.encodeUnsigned(value.toULong())}
|
||||
fun writeSmartInt(value: UInt) { Smartint.encodeSigned(value.toLong())}
|
||||
}
|
||||
|
||||
inline fun <reified T:Any>DataSink.writeNumber(value: T) {
|
||||
|
||||
Reference in new issue
Block a user