Game Development Community

Would be nice for the BIT() function to be defined in the engine

by Bryan Edds · in Torque Game Builder · 05/05/2005 (6:06 pm) · 7 replies

I feel it'd be a lot nicer for the BIT() function to be defined in the engine so as to avoid spamming up the console trace. Might slow the function down though...

Anywho, just a though :)

#1
05/06/2005 (3:53 am)
Whilst it could certainly be added into the engine, albeit working slower, I'm a little confused by what you mean when you say "spamming up the console trace".

There shouldn't be any output from using this. Just wondering what you mean, that's all.

- Melv.
#2
05/06/2005 (10:40 am)
Here's an example of the spam stuff I'm talking about that I copied from the console.log when the trace is on -
Entering BIT(7)
         Leaving BIT() - return 128
         Entering BIT(8)
         Leaving BIT() - return 256
         Entering BIT(9)
         Leaving BIT() - return 512
         Entering BIT(10)
         Leaving BIT() - return 1024
         Entering BIT(11)
         Leaving BIT() - return 2048
         Entering BIT(12)
         Leaving BIT() - return 4096
         Entering BIT(13)
         Leaving BIT() - return 8192
         Entering BIT(14)
         Leaving BIT() - return 16384
         Entering BIT(15)
         Leaving BIT() - return 32768
         Entering BIT(16)
         Leaving BIT() - return 65536
         Entering BIT(17)
         Leaving BIT() - return 131072
         Entering BIT(18)
         Leaving BIT() - return 262144
         Entering BIT(19)
         Leaving BIT() - return 524288
         Entering BIT(20)
         Leaving BIT() - return 1048576
         Entering BIT(21)
         Leaving BIT() - return 2097152
         Entering BIT(22)
         Leaving BIT() - return 4194304
         Entering BIT(23)
         Leaving BIT() - return 8388608
         Entering BIT(24)
         Leaving BIT() - return 16777216
         Entering BIT(25)
         Leaving BIT() - return 33554432
         Entering BIT(26)
         Leaving BIT() - return 67108864
         Entering BIT(27)
         Leaving BIT() - return 134217728
         Entering BIT(28)
         Leaving BIT() - return 268435456
         Entering BIT(29)
         Leaving BIT() - return 536870912
         Entering BIT(30)
         Leaving BIT() - return 1073741824
         Entering BIT(31)
         Leaving BIT() - return -2147483648

Here I had used BIT about 24 times, and it makes its presence known in roughly 50 lines of what seems like unecessary output.

It's not a big bother, but it's a little annoying being all over my trace logs :)
#3
05/07/2005 (2:01 am)
Ah okay, I didn't realise you actually meant tracing when you said trace, hey hey! ;)

There are lots of script-based helper functions around in "common" although I admit that this one is used quite frequently. To be honest, yes, it'd be easy to add in a function although I don't like forcing people to go via the engine for such simplistic utility but there are a couple of ways to give you a choice on what you use.

Actually, I've been toying around with various ways to try to avoid this function altogether so I could solve it by removing it. :)

- Melv.
#4
05/07/2005 (12:25 pm)
Hey, whatever works :)

I was thinking of even making an eBit() function (stands for engineBit) that won't spam up the trace. That way I could choose between them.

Anywho, thanks for listening :)
#5
05/07/2005 (12:47 pm)
Ok i'm confused. Why would it be slower if this was in the engine? Shouldn't that if anything be faster? Or is it a matter of since its such a simple function that the call overhead would be the killer?
#6
05/07/2005 (10:07 pm)
It's the overhead of such a simple function I believe.
#7
05/08/2005 (5:55 am)
In the scheme of things, it's probably nothing you'd notice. I'm working on an alternative anyway.

- Melv.