At some point this morning I was suddenly and without warning struck with the urge to get the old AALib demo “BB” running on my ‘droid. Eventually I had an ARM build of Debian running and BB installed without any fuss. (apt-get install bb).
What I hadn’t anticipated though was that using ADB shell from the windows command prompt would result in color code escape sequences being printed straight to the screen. Worse still, I couldn’t Ctrl+C out of a program without killing ADB shell, and other keys such as the arrows and escape key were being ignored completely.
So without further ado, here are a few solutions :
Time and time again, AS3 reaffirms its place in my heart as one of the most well planned, well implemented and functional languages I’ve had the pleasure of using. So when I came across this little gem – someone trying to perform a bitwise shift left on a floating point number – I wasn’t sure whether to be intrigued, impressed or confused.
var Y:Number = 5.5;
var X:int = Y << 8;
I found myself asking why this functionality was included, what would be the outcome, why it worked, and if it did work what sort of rounding was going on behind the scenes.(Also why would anyone attempt this, but that was fairly tertiary.)
As it turns out, AS3’s SHL operator can actually be used as a very fast and quite useful form of rounding. Read on for an explanation, some examples and calculated times.