forked from sergeych/crypto2
use asByteArray _view_ where possible (optimization)
This commit is contained in:
1 parent
b5ac0c4e7e
commit
6431d4896a
17 files changed
+50
-22
No files matched your search
@@ -43,4 +43,4 @@ fun <T>pack(serializer: KSerializer<T>, element: T?): UByteArray =
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <T: Any?> unpack(serializer: KSerializer<T>, encoded: UByteArray): T =
|
||||
if (encoded.isEmpty()) null as T
|
||||
else BipackDecoder.decode(encoded.toByteArray().toDataSource(),serializer)
|
||||
else BipackDecoder.decode(encoded.asByteArray().toDataSource(),serializer)
|
||||
Reference in new issue
Block a user