浏览代码

Fix BitMap calculating incorrect true bit count

Andrii Doroshenko (Xrayez) 6 年之前
父节点
当前提交
b16946dea6
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      scene/resources/bit_map.cpp

+ 2 - 1
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;
 	}