Revision control
Copy as Markdown
Other Tools
/**
* @suppress
*/
public object FfiConverterBoolean: FfiConverter<Boolean, Byte> {
override fun lift(value: Byte): Boolean {
return value.toInt() != 0
}
override fun read(buf: ByteBuffer): Boolean {
return lift(buf.get())
}
override fun lower(value: Boolean): Byte {
return if (value) 1.toByte() else 0.toByte()
}
override fun allocationSize(value: Boolean) = 1UL
override fun write(value: Boolean, buf: ByteBuffer) {
buf.put(lower(value))
}
}