'>>>' Java to C++

c++, shift

Solution

The unsigned right shift (`>>>`) doesn't exist in C++, because it's not necessary -- C++ has distinct signed and unsigned integer types. If you want right shifts to be unsigned, make the variable that's being shifted unsigned:

unsigned int x1 = text1[i1++] & 0xff;
text2[i2++] = (char) (x1 >> 8);

That being said, the code you're translating is silly. The result of the second operation will always be zero in Java, so you could just as easily translate it to:

i1++;
text2[i2++] = 0;

Problem

Possible Duplicate: What is >>> operation in C++ I need to convert this tiny little part of Java to C + +, but do not know what is '>>>' ... searched, but found no references, only on shift. Does anyone have any ideas? ``` int x1; x1 = text1[i1++] & 0xff; text2[i2++] = (char) (x1 >>> 8); ```

Original source

Related problems