Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a74b230 authored by tibbi's avatar tibbi
Browse files

adding a new int extension for adding bit with a condition

parent 766f10a7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ buildscript {
        propMinSdkVersion = 21
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '5.3.15'
        propVersionName = '5.3.16'
        kotlin_version = '1.3.10'
    }

+7 −0
Original line number Diff line number Diff line
@@ -35,6 +35,13 @@ fun Int.getFormattedDuration(): String {
    return sb.toString()
}

fun Int.addBitIf(add: Boolean, bit: Int) =
        if (add) {
            addBit(bit)
        } else {
            removeBit(bit)
        }

// TODO: how to do "bits & ~bit" in kotlin?
fun Int.removeBit(bit: Int) = addBit(bit) - bit