Bitwise Addition

Please explain this how this code is working

Hi @O17CPBTC0026,
See every number can be represented as a binary number please refer to coding blocks video to see how to do that… Then when we do AND (&) of two number(one,two) it actually gives us a decimal number in which all those bits are set which are set in both number one and number two … So hence gives us the carry … to get a intuition please write two number in binary on a paper and try solving .
And for basic sum operation when we do number one ^ number two we actually get a new number in which all those bits are set which differ in number one and number two … So if number one was 101 and number two was 111 so the output will be 010. And further left shift operator is used to multiply the number by 2 and add to the number as carry is added …
If you do not understand this first refer to coding blocks video of bitmasking in which all the operations are explained nicely.
Due to lack of interaction written reply might not be sufficient to make you understand.