View Single Post
Old 07-09-2005, 11:12 PM   #5 (permalink)
ever_thus
 
Junior Techie

Join Date: Jun 2005

Posts: 94

ever_thus

Default

I'm afraid Bla! has made quite a few mistakes.

Or

If either of the two bits are 1 the result of this operation is a 1. Only if both bits are 0 is the result a 0.

What Bla! described was a nand operation. (This is an advanced operation which no language, to my knowledge, supports, so you won't need to learn it.)

and

if both of the two bits are 1 the result is a 1. In all other cases (that is, there is at least one 0) the result is 0.

What Bla! is an xnor operation. (Again, an advanced operation which you needn't learn.)


Regarding shifts I'm less sure of myself, but I'm pretty certain that the following is true.

In a left shift the spaces opened up on the right are filled with 0s. This is true of both arithmetic and logical shifts, though the Pentiums provide both operation to make it symettrical with right shifts.

In a logical right shift the spaces opened up on the left are filled with 0s. In a arithmetic right shift the spaces are filled with sign bit. That means that if the shift was applied to a positive number the spaces are filled with 0s; if it was applied to a negative number they are filled with 1s.
ever_thus is offline