; Return in register EAX the number of the coincident bits on the same position ; in the words, passed in registers RDI, RSI and RDX. option prologue:none, epilogue:none .code nsamebit proc _nsamebit proc XOR RDI,RDX ; RDI ^= RDX (coincident bits become 0, the rest - 1) XOR RSI,RDX ; RSI ^= RDX ( " " " " " " " " " ") OR RDI,RSI ; RDI = RDI ^ RDX | RSI ^ RDX (" " " " " ") NOT RDI ; Make the coincident bits log. 1, non-coincident - 0 POPCNT RAX,RDI ; Count the coincident bits RET ; and return their number in EAX (RAX) _nsamebit endp nsamebit endp end