In C#, is it possible to perform a sum of two 32-bit integers without using things like if..else, loops etc?
That is, can it be done using only the bitwise operation
Try this:
private int add(int a, int b) { if(b == 0) return a; return add( a ^ b, (a & b) << 1); }
Edit: Corrected if statement
if