Jump to content

Bit manipulation

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Wickund (talk | contribs) at 15:17, 4 October 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Bit twiddling, or to bit twiddle, is the act of algorithmically manipulating computer bits, often in clever or non-obvious ways. The term leaked into early computer jargon, where computer operators would make adjustments by tweaking or twiddling computer controls. As computer programming languages evolved, programmers adopted the term to mean any handling of data that involved bit level computation.

In the C programming language, a bit twiddler, would primarily make use of the bitwise operations AND, OR, XOR, NOT, or, any of the bit shift operations.

As a derogatory term, bit twiddling is described as an exercise in tweaking computer programs, where vast amounts of time and effort produce negligible improvement; leaving program source code unreadable to all but the bit twiddler.

The word twiddle was also adopted in computer jargon as an alternative name for the ascii tilde (~) character. Twiddle was preferable to tilde as it was audibly distinctive in noisy computer rooms.

Bit twiddling reference

Hacker’s Delight by Henry S. Warren Jr., Addison-Wesley ISBN 0-201-91465-4