Pdf on Bitwise operators and their functios

Following are some excerpts from the document

Manipulating Rightmost Bits

Some of the formulas in this section find application in later chapters.

Use the following formula to turn off the rightmost 1-bit in a word, producing 0 if none (e.g., 01011000

01010000):

This may be used to determine if an unsigned integer is a power of 2; apply the formula followed by a 0-test on the result.

Similarly, the following formula can be used to test if an unsigned integer is of the form (including 0 or all 1’s):

Use the following formula to isolate the rightmost 1-bit, producing 0 if none (e.g., 01011000

00001000):

Use the following formula to isolate the rightmost 0-bit, producing 0 if none (e.g., 10100111

00001000):

Use one of the following formulas to form a mask that identifies the trailing 0’s, producing all 1’s if (e.g., 01011000

00000111):

The first formula has a little instruction-level parallelism.

Download the whole document in the attachment section


Attachments

Comments (2)

abhishek sharma
Said this on 9-10-2009 At 02:40 am
thanks buddy
Said this on 12-24-2009 At 03:35 am

Why does it say written by Abhishek Kumar, when it is Henry S. Warren Jr.'s book:  "Hacker's Delight"?

Post a Comment
* Your Name:
* Your Email:
(not publicly displayed)
Reply Notification:
Approval Notification:
Website:
* Security Image:
Security Image Generate new
Copy the numbers and letters from the security image:
* Message:

Email to Friend

Fill in the form below to send this article to a friend:

Email to Friend
* Your Name:
* Your Email:
* Friend's Name:
* Friend's Email:
* Security Image:
Security Image Generate new
Copy the numbers and letters from the security image
* Message: