Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Bitwise operation

Name: Anonymous 2010-06-09 5:28

How are simple operations like adding and subtraction represented using only bitwise operators such as &, |, ^, >>, ~, and <<?

Also, do each of the bitwise operators perform at the same rate, or are some faster than others?

Name: Anonymous 2010-06-09 14:17

>>18
Did you mean:
      int add(int a, int b){
            if (!a) return b;
            else
                 return add((a & b) << 1, a ^ b);
      }

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List