79309719

Date: 2024-12-26 14:39:00
Score: 0.5
Natty:
Report link
fun Int.setBit(@IntRange(from = 0, to = 1) value: Int, position: Int): Int {
    return if (value == 1) {
        this or (1 shl position)
    } else {
        val size = Int.SIZE_BITS - this.countLeadingZeroBits()
        this and (((1 shl size) - 1) - (1 shl position))
    }
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: JoShin