On Apr 28, 6:03 pm, Francis Glassborow
<francis.glassbo...@[EMAIL PROTECTED]
> wrote:
> nickf3 wrote:
> > On Apr 27, 10:13 am, "Brig White" <brighamand...@[EMAIL PROTECTED]
> wrote:
> >> { Multi-posted article. -mod }
>
> >> Why is it than when I bit ****ft to the right with a signed integer
type, all
> >> the higher order bits above the move are set but when I ****ft with an
> >> unsigned type, they are cleared?
>
> > This is how ones' complement signed number representation works.
> > For example, 31 in binary (showing only 8 bits) is 00011111
> > -31 is then 11100001, i.e. binary complement (all bits flipped)
> > plus one (11100000 + 00000001 = 11100001).
>
> No that is two's complement. One's complement does not have the final
> 'plus one'.
>
Yes, you're right, of course.
--
Nikolai
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|