support for @Unsigned fields and fox bad error of kotlinjs x is Float glitch: it returns true for integers

This commit is contained in:
sergeych committed 2023-03-13 16:27:06 +01:00
1 parent 6bc01e9534
commit 0e8f3daf99
7 files changed
+103 -30

No files matched your search

@@ -25,11 +25,7 @@ interface DataSink {
}
inline fun <reified T:Any>DataSink.writeNumber(value: T) {
when(value) {
is Float -> writeFloat(value)
is Double -> writeDouble(value)
else -> Smartint.encode(value, this)
}
Smartint.encode(value, this)
}
fun DataSink.writeI32(value: Int) {
@@ -13,7 +13,7 @@ interface DataSource {
/**
* Exception that implementations must throw on end of data
*/
class EndOfData() : Exception("no more data available")
class EndOfData: Exception("no more data available")
fun readByte(): Byte
@@ -51,3 +51,4 @@ inline fun <reified T : Any> DataSource.readNumber(): T = when(typeOf<T>()) {
typeOf<Float>() -> readFloat() as T
else -> Smartint.decode(this)
}