C
chrisben
Hi,
I try to use an integer to pass 4 kinds of information. Each kind may have 5
types. I plan to use an integer like 2034, while 2 0 3 4 are corresponding to
the type of each kind. I am wondering, what is the most efficient way to
1. update any of field, for example, changing from 2034 to 2134
2. grab the number (0 to 4) from any one of those field. for example,
immediately figure out my third kind is type 3 by reading 2034.
There are many ways of doing it. I am wondering whether there is a way (as
bitwise operations etc.) that I can use to do it most efficiently.
Thanks
Chris
I try to use an integer to pass 4 kinds of information. Each kind may have 5
types. I plan to use an integer like 2034, while 2 0 3 4 are corresponding to
the type of each kind. I am wondering, what is the most efficient way to
1. update any of field, for example, changing from 2034 to 2134
2. grab the number (0 to 4) from any one of those field. for example,
immediately figure out my third kind is type 3 by reading 2034.
There are many ways of doing it. I am wondering whether there is a way (as
bitwise operations etc.) that I can use to do it most efficiently.
Thanks
Chris