From d8c2a4829807f324d36dfa4a2350f3f7703a8986 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Mon, 24 Jan 2011 19:46:32 +0000 Subject: Add Encoding T2 & T3 of the PUSH instructions to the g_arm_opcodes table. Plus add an extra field ARMInstrSize to the table entry type 'ARMOpcode'. llvm-svn: 124140 --- lldb/source/Plugins/Process/Utility/ARMUtils.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lldb/source/Plugins/Process/Utility/ARMUtils.h') 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_ -- cgit v1.2.3