Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

[Fix] Updated BitSet to use all 32 bits of an Int #179

Merged
merged 1 commit into from Feb 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion kds/src/commonMain/kotlin/com/soywiz/kds/BitSet.kt
Expand Up @@ -6,7 +6,7 @@ import com.soywiz.kds.internal.*
* Fixed size [BitSet]. Similar to a [BooleanArray] but tightly packed to reduce memory usage.
*/
class BitSet(override val size: Int) : Collection<Boolean> {
val data = IntArray(size divCeil 4)
private val data = IntArray(size divCeil 32)

private fun part(index: Int) = index ushr 5
private fun bit(index: Int) = index and 0x1f
Expand Down