delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/12/09:06:08

From: night DOT walker AT tiscalinet DOT it
Message-ID: <391C0409.79567772@tiscalinet.it>
Date: Fri, 12 May 2000 15:15:53 +0200
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en,pdf
MIME-Version: 1.0
To: DJ Delorie <djgpp AT delorie DOT com>
Subject: Right shift
Reply-To: djgpp AT delorie DOT com

Why right-shifting ">>" a negative signed int will first turn it
positive?

4 >>1 = 2 but also -4 >> 1 = 2!!

It seems like the int is computed without considering the sign bit (is
the most significant, isn't it?) at all...

What EXACTLY happens?

Thanx for the feedback, Night Walker.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019