Loading...
Logo
Processing Forum

Binary operation

in General Discussion  •  Other  •  1 month ago  
Hello,

I tried to work with binary operation.

byte aByte = (byte)0b00001011;

Processing does not recognize the binary format 0bxxxxx but java do :

The other thing when the >> (right shift) works only with integer not byte …

This is very strange.

Processing 2.0.3
Mac OSX 10.8.4
Java 7 update 25

Replies(1)

Re: Binary operation

1 month ago
Processing has a pre-processor (changing the 'color' datatype to int, #AABBCC to 0xFFAABBCC, int() to a real function name, etc.) that must parse the Processing code, and is actually a Java parser modified to handle the above mentioned particularities of the syntax.
The problem is that the Java syntax is complex, and the changes to it are not trivial.

At one time in the Processing history, they jumped from the syntax of Java 1.4 to the one of 1.5, like supporting 'foreach' style loops, generics, annotations (?), although forgetting some stuff like enums.
Processing 2.0 is still shipped with Java 1.6, perhaps because precisely it doesn't support yet the new syntax of Java 7, like 0b0, 1_000_000, try with resources, multiple exception catch or switch on strings (probably).
Perhaps they will support it when Java 8 will be officially out...