I am giving a function to write as part of my program that takes as input a
short integer num, and a short integer parity mask. The function then return the
number of 1’s that are in the same position in num and in the parity
mask. for example, if you enter num as 0x8
and parity mask as 0x9
then it return 1. (since 0x8 = 00001000
and 0x9 = 00001001
so they both have a 1 at position 3).
I have looked everywhere online trying to find a simple way to implement it but couldn't find anything similar to it.
Could someone please explain to me how to write this function or give some suggestion on how to start?
Thank you