Commit afd87826 authored by Him188's avatar Him188

Make functions inline

parent c847b174
...@@ -43,11 +43,11 @@ class ImageId0x03 constructor(override inline val value: String, inline val uniq ...@@ -43,11 +43,11 @@ class ImageId0x03 constructor(override inline val value: String, inline val uniq
.toByteArray().also { check(it.size == 16); debugPrintln("image md5=" + it.toUHexString()); debugPrintln("imageId=$this") } .toByteArray().also { check(it.size == 16); debugPrintln("image md5=" + it.toUHexString()); debugPrintln("imageId=$this") }
} }
@Suppress("FunctionName") @Suppress("FunctionName", "NOTHING_TO_INLINE")
fun ImageId(value: String): ImageId = ImageId0x06(value) inline fun ImageId(value: String): ImageId = ImageId0x06(value)
@Suppress("FunctionName") @Suppress("FunctionName", "NOTHING_TO_INLINE")
fun ImageId(value: String, uniqueId: UInt, height: Int, width: Int): ImageId = ImageId0x03(value, uniqueId, height, width) inline fun ImageId(value: String, uniqueId: UInt, height: Int, width: Int): ImageId = ImageId0x03(value, uniqueId, height, width)
/** /**
...@@ -65,6 +65,7 @@ interface ImageId { ...@@ -65,6 +65,7 @@ interface ImageId {
fun ImageId.checkLength() = check(value.length == 37 || value.length == 42) { "Illegal ImageId length" } fun ImageId.checkLength() = check(value.length == 37 || value.length == 42) { "Illegal ImageId length" }
fun ImageId.requireLength() = require(value.length == 37 || value.length == 42) { "Illegal ImageId length" } fun ImageId.requireLength() = require(value.length == 37 || value.length == 42) { "Illegal ImageId length" }
fun ImageId.image(): Image = Image(this) @Suppress("NOTHING_TO_INLINE")
inline fun ImageId.image(): Image = Image(this)
suspend inline fun ImageId.sendTo(contact: Contact) = contact.sendMessage(this.image()) suspend inline fun ImageId.sendTo(contact: Contact) = contact.sendMessage(this.image())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment