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))
}
}