We’ll just have to call it Tara’s party was on last weekend. I got my head out of my ass long enough to post the pictures I took with my mobile phone – I forgot my proper camera so they’re pretty crap. I had a hangover, but it was much alleviated by not drinking of the Sambuca and Mezcal that was on offer.
Buy one for Mid January (Xbox 360s in Tralee)
I wandered into the store yesterday and they have sold out of Xboxes. Now they have a sign up telling people that they can pay for the box now, and expect it in mid January. Well, I would just love to see the face of some snotty little kid on Christmas day, expecitng and Xbox and getting a card saying: ‘iou in mid January’.
Liver liver on the wall, who’s the swollenest of them all.
New Xboxes for sale in Tralee
Considering al the insanity that followed the launch in the USA with people having to get the next generation console it is refreshing to note that there are Xbox consoles for sale in the Smyths toy shop in Manor West in Tralee. Of course, I’m not going to buy one. I did buy a television on Sunday – the smell of fried capacitors on the old one convinced me that it needed to be replaced.
Waiting for a Darwinia
I just love the retro look of Darwinia I’ve pre-ordered it on steam, but can’t wait for it to come out, so I’ve been looking for illicit copies of it. I thought I had one, but it turns out to have been released as a ‘Don’t steal our game‘ exercise. Even then, it’s just increased my desire to have the game. The interation model has been changed in the 1.3 version – you can use either gestures or an icon based environment. I use the gestures when I’ve got a mouse, the Icons when I’m on the touchpad of the laptop. It works quite well providing I tweak the configuration file, putting RenderLandscapeMode = 1 (corrected 2005-12-20) into the settings.txt file. Otherwise I get a crash in iglicd32.dll when you enter the game. I’ll probably have to apply this to the game once it’s released.
Correction 2005-12-20 – the entry should read RenderLandscapeMode = 1
Widow PC are building their dual-core laptops
The folks at Widow PC are building their dual core laptops already – the text on the Sting laptop page tells people that they’re starting to ship before Christmas.
Alienware are listing a delivery date of 30 Jan 2006. Cough, no chance then.
Did you get your 360 today?
I’m wondering if my friend ‘Tipp got his Xbox 360 today. I certainly didn’t get one. I’ll just saunter down to the nearest toy shop and see if they have one. If they do, then maybe I’ll get it, or maybe not. I don’t really have the time to invest in games at the moment.
Least Significant 1 Bit
This can be useful for extracting the lowest numbered element of a bit set. Given a 2’s complement binary integer value x, (x&-x) is the least significant 1 bit. The reason this works is that it is equivalent to (x & ((~x) + 1)); any trailing zero bits in x become ones in ~x, adding 1 to that carries into the following bit, and AND with x yields only the flipped bit… the original position of the least significant 1 bit.
Alternatively, since (x&(x-1)) is actually x stripped of its least significant 1 bit, the least significant 1 bit is also (x^(x&(x-1))).
Integer Selection
A branchless, lookup-free, alternative to code like if (a<b) x=c; else x=d; is ((((a-b) >> (WORDBITS-1)) & (c^d)) ^ d). This code assumes that the shift is signed, which, of course, C does not promise.
Integer Minimum or Maximum
Given 2’s complement integer values x and y, the minimum can be computed without any branches as x+(((y-x)>>(WORDBITS-1))&(y-x)). Logically, this works because the shift by (WORDBITS-1) replicates the sign bit to create a mask — be aware, however, that the C language does not require that shifts are signed even if their operands are signed, so there is a potential portability problem. Additionally, one might think that a shift by any number greater than or equal to WORDBITS would have the same effect, but many instruction sets have shifts that behave strangely when such shift distances are specified.
Of course, maximum can be computed using the same trick: x-(((x-y)>>(WORDBITS-1))&(x-y)).
Dual-Linked List with One Pointer Field
Normally, a dual-linked circular list would contain both previous and next pointer fields and the current position in the list would be identified by a single pointer. By using two current pointers, one to the node in question and the other to the one just before/after it, it becomes possible to store only a single pointer value in each node. The value stored in each node is the XOR of the next and previous pointers that normally would have been stored in each node. Decoding is obvious.
Unfortunately, using this trick in C is awkward because the XOR operation is not defined for pointers.