All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.BitmaskUtilities.kt Maven / Gradle / Ivy

package dev.nycode.kotlinx.serialization.bitmask.runtime

@InternalBitmaskApi
public fun Number.toBoolean(): Boolean {
    return when (this) {
        0 -> false
        1 -> true
        else -> error("Can't parse number $this to a boolean.")
    }
}

@InternalBitmaskApi
public fun Boolean.toInt(): Int {
    return if (this) 1 else 0
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy