A new gem for REALbasic 2007r1

| | Comments (11)

You may have noticed by now that REALbasic 2007 release 1 was released yesterday morning. There are some really cool things in this release, but the one that I'm most excited about is a relatively small thing: new bitwise operators.

That's right, I said "operators" -- not methods. This means you can finally do bitwise operations at the assembly level, instead of incurring method call overhead for doing them.

The new operators are: And, Or, Xor and Not (crazy names, eh?) and you'd use them exactly how you'd expect. Foo And Bar, Not Wahoo And (Yippee XOr Kiyay), etc.

And is the new version of BitwiseAnd/Bitwise.BitAnd
Or is the new version of BitwiseOr/Bitwise.BitOr
XOr is the new version of BitwiseXOr/Bitwise.BitXOr
Not is the new version of Bitwise.OnesComplement

I should also note that XOr has become a logical (boolean) operator as well, and would behave as you'd expect when using true and false instead of integer values.

So there's a word of caution here, which should be fairly obvious (I'd hope). You still can't mix integer and boolean datatypes. You can't do True And 12 while expecting to get anything out of it aside from a compiler error.

So that's my neat new feature for the day -- pretty cool, eh?

11 Comments

I am especially happy for the XOR! At last! :-)

Math

You and me both -- now I just want to see some bit shifting operators too.

Is this part of an effort towards optimizations (avoiding the function call) ?
Or some other rationale ?

It's an interesting addition but not on my "must have" list

It's part of an effort towards "why the heck didn't we have this since day 1?" ;-)

It's an optimization thing, as well as a needed change. With the advent of all the different data types, we needed operators so that the operations could happen without datatype conversions. Imagine the converse: a conversion from UInt8 to UInt64, a second conversion of the same type, a method call overhead, and then a conversion back to UInt8. That's a lot of mess for something which is a single assembly opcode.

If there's a "why the heck didn't we have this since day 1?" effort there's a long list of things :)

I was just curious about the rationale for putting this particular change in the release

Uh, I just happen to ahve an article ready to go on this subject.

Everybody, go buy it now!

Everybody is a critic!

That is going to make it a LOT easier to convert from VB! Yippy Skippy!

Nice new site. Guess I missed a few days - big (Good) changes.

Oh ya....and about this entry - the XOR is great news for me too - totally cool to have finally. I'm sure the others will come in handy here and there, but XOR will be mighty dandy.

Leave a comment

Disclaimer

I'm currently an employee of REAL Software. My blog is mine. The opinions represented in this blog are mine as well and may not represent my employer's opinions. All original material is copyrighted and property of the author.

REALbasic® is a registered trademark of REAL Software, Inc. REAL SQL Server™ and Lingua™ are pending trademarks of REAL Software, Inc. All rights reserved.