From 8194963098247be6bca9cc4a54dbfa65c73e8ccc Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 2 May 2014 11:53:22 +0100 Subject: Replace CountOneBits and __builtin_popcount with POPCOUNT. Clean up utils.h, make some functions constexpr. Change-Id: I2399100280cbce81c3c4f5765f0680c1ddcb5883 --- runtime/base/bit_vector.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/base/bit_vector.cc') diff --git a/runtime/base/bit_vector.cc b/runtime/base/bit_vector.cc index 12c0352ef5..3df5101fa3 100644 --- a/runtime/base/bit_vector.cc +++ b/runtime/base/bit_vector.cc @@ -201,7 +201,7 @@ void BitVector::Subtract(const BitVector *src) { uint32_t BitVector::NumSetBits() const { uint32_t count = 0; for (uint32_t word = 0; word < storage_size_; word++) { - count += __builtin_popcount(storage_[word]); + count += POPCOUNT(storage_[word]); } return count; } @@ -331,10 +331,10 @@ uint32_t BitVector::NumSetBits(const uint32_t* storage, uint32_t end) { uint32_t count = 0u; for (uint32_t word = 0u; word < word_end; word++) { - count += __builtin_popcount(storage[word]); + count += POPCOUNT(storage[word]); } if (partial_word_bits != 0u) { - count += __builtin_popcount(storage[word_end] & ~(0xffffffffu << partial_word_bits)); + count += POPCOUNT(storage[word_end] & ~(0xffffffffu << partial_word_bits)); } return count; } -- cgit v1.2.3