I recently saw an open source program where somebody used
if (x & 1){
Where x was an int. I tried this out myself and as far as I can see this has the same effect us using
if (x == 1){
As far as I understand the &
symbol is used for referencing objects, but here it seems to be used as an equal to operator.
Am I mistaken in thinking these are the same thing? Or are there different reasons to use each one?