diff --git a/ASTCEncoder/src/Utils.h b/ASTCEncoder/src/Utils.h index 514dc81..22c7572 100644 --- a/ASTCEncoder/src/Utils.h +++ b/ASTCEncoder/src/Utils.h @@ -101,6 +101,14 @@ namespace ASTCC { return -1; }; + // Count the number of bits set in a number. + Popcnt(uint32 n) { + uint32 c; + for(c = 0; n; c++) { + n &= n-1; + } + return c; + } } // namespace ASTCC #endif // ASTCENCODER_SRC_UTILS_H_