Re: Bitwise Operators.

1998-08-04 Thread Carlos Cassino
Sorry for sending two messages, I had a problem in my connection and thought the first mail was lost (it wasn't even in the system log) so I wrote another... -- Cassino

Re: Bitwise Operators.

1998-08-04 Thread Azazel
Thanks chaps: the operators are now doing what I hoped. Learnt a valuable lesson today: if one is going to twiddle bits it helps if one is familiar with the bits one is twiddling. :) J. +0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+ www:http://www.elephant.org/~azazel/ mail: [EMAIL PRO

Re: Bitwise operators

1998-08-04 Thread Dirk Vanhalle
Actually, they all make sense. It's plain 2's complement binary arithmatic. First of all, 0xF0F0F0F0 is a negative (signed) integer number. So assigning it to a long makes it 0xF0F0F0F0L. This accounts for the fact that all 1's are shifted in when you shift right, even if you use '>>>'.

Re: Bitwise operators

1998-08-03 Thread Juergen Kreileder
tterns. As I see it, >one > of two things is happening. > > 1. There's a bug in the JDK and bitwise operators don't work properly, which > seems unlikely. > 2.The dprint function is not printing the actual bit-strings but I can't see why. > > &

Re: Bitwise operators

1998-08-03 Thread Carlos Cassino
Hi Jeremy. I guess your problem is the size of long. It has 64 bits and not only the 32 bits you are using. If you change your program to: n = 0xf0f0f0f0L; it should work. If you don't do this, higher bits get set to 1 and the output of your program is right (although it does not show these hi

Re: Bitwise operators

1998-08-03 Thread Carlos Cassino
Hi Jeremy. Maybe your problem is the long type size: it has 64 bits, not only the 32 bits you are using. If you change your program to: n = 0xf0f0f0f0L; You'll get the expected result. When you don't do it, higher bits are set to 1 and the output seems wrong (only seems). Try using: System.o

Bitwise operators

1998-08-03 Thread Azazel
g. 1. There's a bug in the JDK and bitwise operators don't work properly, which seems unlikely. 2. The dprint function is not printing the actual bit-strings but I can't see why. public class pubtest { public static void main(String args[]) {