Normally, each word or other addressable unit (byte, halfword, and so on) is treated
as a single unit of data. It is sometimes useful, however, to consider an n-bit unit as
consisting of n 1-bit items of data, each item having the value 0 or 1. When data are
viewed this way, they are considered to be logical data.
There are two advantages to the bit-oriented view. First, we may sometimes
wish to store an array of Boolean or binary data items, in which each item can take
on only the values 1 (true) and 0 (false).With logical data, memory can be used most
efficiently for this storage. Second, there are occasions when we wish to manipulate
the bits of a data item. For example, if floating-point operations are implemented in
software, we need to be able to shift significant bits in some operations. Another example:
To convert from IRA to packed decimal, we need to extract the rightmost
4 bits of each byte.
Note that, in the preceding examples, the same data are treated sometimes as
logical and other times as numerical or text. The “type” of a unit of data is determined
by the operation being performed on it. While this is not normally the case in
high-level languages, it is almost always the case with machine language.