View Single Post
Old 22 June 2005, 19:54   #5
Zone Friend
Join Date: Jun 2001
Location: Germany
Age: 44
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Originally Posted by IFW
Well if you think this is complex... oh dear
*bzzzt* Wrong! I said this is complicated, which is not the same!
If I think it is complicated, it means that it's me who is probably thinking too complicated and that any other people might find a simpler way!
Though it looks it's a working and not-considered-too-complicated way.
So I will keep this.

Anyway if you are so much concerned
You ALWAYS should. This is good programming; as it doesn't get you into this "bahh, we have 3 ghz machines - who cares!" thinking.
I still use *unsigned short* whenever possible, although by average, no machine might care about this nowadays. But -- sorry I'm getting a bit OT -- this is what makes WinFellow run on low-end machines: only using CPU and memory hogs if really necessary; all other techniques follow the "use the LEAST you require" rule. And I think this is good practice, and I'm very happy to see this in all those GPL applications coded for Linux. Rant over.

you shouldn't have used MOD which is the remainder of a division and such is performed by using a division. For two numbers there you can use an AND operation instead.
AND? Well you should know about that! Thanks!
When thinking a formula in my head, I usually use MOD because that way, it is easier to predict results. For AND, I will usually have to write the value down in binary (yes, even on paper ) as well as AND it by hand, so I can assure the result is the one I wanted.
OR is usually predictable; but AND does a lot of modifications...
But well, if AND really works exactly as MOD with two binary numbers, this is even better

Last edited by andreas; 22 June 2005 at 20:19.
andreas is offline  
Page generated in 0.07493 seconds with 11 queries