more sugar & unsigned support

This commit is contained in:
sergeych committed 2024-06-30 12:50:52 +07:00
1 parent 1fd229fdb1
commit 904a91b8de
8 files changed
+247 -1063

No files matched your search

@@ -1,5 +1,6 @@
package net.sergeych.bintools
@Suppress("unused")
interface DataSink {
fun writeByte(data: Byte)
@@ -24,9 +25,9 @@ interface DataSink {
}
fun writeVarUInt(value: UInt) { Varint.encodeUnsigned(value.toULong(), this)}
fun writeVarInt(value: UInt) { Varint.encodeSigned(value.toLong(), this)}
fun writeVarInt(value: Int) { Varint.encodeSigned(value.toLong(), this)}
fun writeSmartUInt(value: UInt) { Smartint.encodeUnsigned(value.toULong(), this)}
fun writeSmartInt(value: UInt) { Smartint.encodeSigned(value.toLong(), this)}
fun writeSmartInt(value: Int) { Smartint.encodeSigned(value.toLong(), this)}
}
inline fun <reified T:Any>DataSink.writeNumber(value: T) {