Hi Tim,
While I was working on the AArch64 bitmask immediate optimization patch, I noticed the code in processLogicalImmediate, which determines whether an immediate value can be encoded as the immediate operand of a logical instruction, isn't using an efficient algorithm. The attached patch attempts to make it more efficient.
This is undefined behaviour if size > 62. I think "(1ULL << size) - 1" is OK.