diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Int.kt b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Int.kt index 8b0938e0..dcf929e4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Int.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Int.kt @@ -5,4 +5,4 @@ import java.util.concurrent.TimeUnit val Int.secondsToMillis get() = TimeUnit.SECONDS.toMillis(this.toLong()) val Int.millisToSeconds get() = TimeUnit.MILLISECONDS.toSeconds(this.toLong()) -fun Int.isBitSet(bit: Int) = this and bit == bit +fun Int.isBitSet(bit: Int) = (this shr bit and 1) > 0 diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt index 2622a49f..84fad56b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt @@ -227,18 +227,7 @@ fun getTimeUntilNextAlarm(alarmTimeInMinutes: Int, days: Int): Int? { } } -fun isAlarmEnabledForDay(day: Int, alarmDays: Int): Boolean { - val bit = createBit(day) - return alarmDays.isBitSet(bit) -} - -fun createBit(day: Int): Int { - var bit = 1 - repeat(day) { - bit = bit.addBit(bit) - } - return bit -} +fun isAlarmEnabledForDay(day: Int, alarmDays: Int) = alarmDays.isBitSet(day) fun getTimeDifferenceInMinutes(currentTimeInMinutes: Int, alarmTimeInMinutes: Int, daysUntilAlarm: Int): Int { val minutesInADay = 24 * 60 diff --git a/gradle.properties b/gradle.properties index b2d106ed..24c6f860 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ android.enableJetifier=true android.useAndroidX=true android.nonTransitiveRClass=true +org.gradle.jvmargs=-Xmx4g