Author: Gerd Isenberg
Date: 02:26:41 09/23/02
Go up one level in this thread
On September 23, 2002 at 04:43:27, Gerd Isenberg wrote: >On September 22, 2002 at 20:48:48, Russell Reagan wrote: > >>On September 22, 2002 at 15:57:09, Matthias Gemuh wrote: >> >>>What is ">>>" ? >> >>In Java there are two right shift operators. One is the signed right shift (>>) >>and the other is the unsigned right shift (>>>). If you do a >> b in Java, and a >>is a negative number, a will be negative after the >> call. If you do a >>> b, a >>will be positive always. More specifically, >> fills the leftmost bits with >>whatever the sign bit is (0 or 1, for positive and negative, respectively), and >>>>> fills with zeros always. >> >>The >> operator preserves the sign (positive or negative). The >>> operator does >>not. >> >>The >>> operator is the equivalent of >> in C/C++, I believe. Someone will >>correct me if I'm wrong. >> > >">>>" in Java is unsigned shift right. >">>" is signed shift right. oups, you always told that, sorry. I was focused on your statement: "The >>> operator is the equivalent of >> in C/C++, I believe" In C/C++ the behaviour of ">>" depends on the (signed/unsigned) type of the variabled to be shifted. To get the ">>>" behaviour with a signed value, you have to cast the signed to unsigned. Gerd > >Gerd > >>Russell
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.