We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63c169e commit e3c1804Copy full SHA for e3c1804
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
@@ -737,14 +737,12 @@ class HexagonMCInstrAnalysis : public MCInstrAnalysis {
737
738
uint32_t getValueFromMask(uint32_t Instruction, uint32_t Mask) const {
739
uint32_t Result = 0;
740
- size_t Off = 0;
741
- for (uint32_t Bit = 0; Bit != sizeof(uint32_t) * CHAR_BIT; ++Bit) {
742
- const uint8_t ValBit = (Instruction >> Bit) & 1;
743
- const bool MaskBit = (Mask >> Bit) & 1;
744
- if (MaskBit) {
745
- Result |= (ValBit << Off);
746
- ++Off;
747
- }
+ uint32_t Offset = 0;
+ while (Mask) {
+ if (Instruction & (Mask & -Mask))
+ Result |= (1 << Offset);
+ Mask &= (Mask - 1);
+ ++Offset;
748
}
749
return Result;
750
0 commit comments