How to calculate parity of a 32bits number in assembly?
问题 I need to calculate the parity of a 32 bits number and return it. To do this I must use XOR, SHR,SETP(or similar) and movzx. Somebody have an idea ? 回答1: Many ways to do this, of course. If you decide to use the hardware parity flag, keep in mind that it only checks the low 8 bits. A solution using this approach might be to process your 32 bit input as four 8 bit values, and use XOR on the partial results: p(31:0) = p(31:24) ^ p(23:16) ^ p(15:8) ^ p(7:0) To get the 8 bit units, you can use