释义 |
logical shift
logical shift[′läj·ə·kəl ′shift] (computer science) A shift operation that treats the operand as a set of bits, not as a signed numeric value or character representation. logical shift (programming)(Either shift left logical or shift rightlogical) Machine-level operations available on nearly allprocessors which move each bit in a word one or more bitpositions in the given direction. A left shift moves the bitsto more significant positions (like multiplying by two), aright shift moves them to less significant positions (likedividing by two). The comparison with multiplication anddivision breaks down in certain circumstances - a logicalshift may discard bits that are shifted off either end of theword and does not preserve the sign of the word (positive ornegative).
Logical shift is approriate when treating the word as a bit string or a sequence of bit fields, whereas arithmetic shift is appropriate when treating it as a binary number.The word to be shifted is usually stored in a register, orpossibly in memory. |