diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-04-04 19:11:39 +0300 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-04-04 19:11:39 +0300 |
commit | b16946dea6382100940ffb4b5bbd4cf1a1ff16ec (patch) | |
tree | f0036ab34edaeabfe1b531db5e73db43a8ffafbc | |
parent | a18989602b00f2940befa0b780af14efc7603dd8 (diff) |
Fix BitMap calculating incorrect true bit count
-rw-r--r-- | scene/resources/bit_map.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/resources/bit_map.cpp b/scene/resources/bit_map.cpp index d2e4d28b44..55264bcdf9 100644 --- a/scene/resources/bit_map.cpp +++ b/scene/resources/bit_map.cpp @@ -96,7 +96,7 @@ int BitMap::get_true_bit_count() const { const uint8_t *d = bitmask.ptr(); int c = 0; - //fast, almot branchless version + //fast, almost branchless version for (int i = 0; i < ds; i++) { @@ -106,6 +106,7 @@ int BitMap::get_true_bit_count() const { c += (d[i] & (1 << 4)) >> 4; c += (d[i] & (1 << 3)) >> 3; c += (d[i] & (1 << 2)) >> 2; + c += (d[i] & (1 << 1)) >> 1; c += d[i] & 1; } |