1 / 6

Bitstring Manipulation

Bitstring Manipulation. Once we know how to define and manipulate large integers with short formulas , we are on our way to manipulating long bitstrings . Here are some useful formulas that will help us with this task.

korbin
Download Presentation

Bitstring Manipulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Bitstring Manipulation • Once we know how to define and manipulate large integers with short formulas, we are on our way to manipulating long bitstrings. Here are some useful formulas that will help us with this task.

  2. Here is an explanation of the formula bitn(x, y). Suppose x and y are numbers satisfying bitn(x, y). Because y is a power of two, its binary representation consists of a 1 followed by a string of zeros. The formula bitn(x, y) is true precisely when x’s bit in the same position as the 1 in y is 1. We get hold of this bit in x by dividing x by y using integer division; the quotient q and remainder r are the binary numbers illustrated. The bit we are interested in is 1 iffq is odd.

  3. This formula is useful for treating numbers as bit strings of exponential length and indexing into them with other numbers to extract bits.

More Related