Thursday, March 12, 2015
Swapping bits of an Integer
Swapping individual bits is implemented using a function. This function is repeatedly called with different position data.
Wednesday, March 11, 2015
Printing the binary format of a integer
Here printing iss done thru a neat macro trick. We can calculate different way too, which is commonly seen. In that case we divide the number by 2 and not the modulo and append it to a string. Same time we will divide the number by two and make it as the new number. This process continues till the number becomes equivalent to one.
Subscribe to:
Posts (Atom)