[squeak-dev] java to squeak conversation

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sun Dec 6 10:05:09 UTC 2015


Hi,

((term & 0x1) ==0) just test if least significant bit is unset
? (term | 1) will set the LSB to 1 if unset
: (term & ~1) will unset the LSB if set

so, all it does is (term bitXOr: 1), that is it changes the LSB of term...

The name termPlus1 is misleading.

2015-12-06 4:41 GMT+01:00 Robert Withers <robert.w.withers at gmail.com>:

> I still have some rot in my head, from too much java, and so I don't think
> consistently clearly, it's more cyclic I've noticed. As a result, my eyes
> are doing back-flips when looking at this code; perhaps I need eine kleine
> pause...does anyone else want to try it?
>
>     int termPlus1 = ((term & 0x1) == 0) ? (term | 1) : (term & ~1);
>
> cheers,
> Robert
>
> ps. an example of Java conciseness, dear God.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20151206/88858fb8/attachment.htm


More information about the Squeak-dev mailing list