Re: TIB: A few more questions


[Prev][Next][Index][Thread]

Re: TIB: A few more questions




> > And can you read individual bits of an integer (like
> > asm)? For example: 
> > read 150 as 10010110 and take each bit a put it in matrix.
> 
> It's possible but not easy.  I am not sure the best way to do
> it, but I'm sure someone on this list knows a few tricks.
> 

why do you want to test each bit?  Why not use the number 10010110
instead of 150?  10010110 takes up just as much memory as 150 does. 
If you use 10010110, you can test for the number in the x position. 
For instance, to find the number in the 10's place, you would do

:10010110->A
:(abs (A-10int (A/10)))/10

or to test in the 10000 place

:int ((abs (A-10000 int(A/10000))/10000

or in general, with A=the number and P=the position you want to know
the number.

:int (abs ((A-10^P*int(A/10^P))/(10^(int log A

you have to add the int log A+1 because otherwise it would return 10000.

I am doing this by memory, so it might not be exactly right.  I did
something similar on a game I did a year or so ago.  I will try to
find it if you wish.

If you really want to do something with the bits, you might be able to
somehow turn the 10 from above into 2.  I don't know.
==
Garth Johnson
Please email me at garthjohnson@bigfoot.com
 or brandtly@hotmail.com for large files

Visit my website!
http://www.bigfoot.com/~garthjohnson

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


Follow-Ups: