diff options
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/ARMUtils.h')
| -rw-r--r-- | lldb/source/Plugins/Process/Utility/ARMUtils.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Utility/ARMUtils.h b/lldb/source/Plugins/Process/Utility/ARMUtils.h index 5b10b31b2f3..137acb40d48 100644 --- a/lldb/source/Plugins/Process/Utility/ARMUtils.h +++ b/lldb/source/Plugins/Process/Utility/ARMUtils.h @@ -18,6 +18,18 @@ namespace lldb_private { // not permitted for many Thumb register specifiers. static inline bool BadReg(uint32_t n) { return n == 13 || n == 15; } +// Returns an integer result equal to the number of bits of x that are ones. +static inline uint32_t BitCount(uint32_t x) +{ + // c accumulates the total bits set in x + uint32_t c; + for (c = 0; x; ++c) + { + x &= x - 1; // clear the least significant bit set + } + return c; +} + } // namespace lldb_private #endif // lldb_ARMUtils_h_ |

