|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Least significant bit?
On Wed, 26 Jul 2000, Lionel Pinkhard wrote: > I've been thinking of doing this with some kind of AND/OR/XOR mask, > but I think that would get way too complex (after all, I'm only trying > to read in ONE BIT!) > Kind regards, > Lionel Pinkhard Hmm... assuming you mean you're programming in asm or similar... you should be able to do a byte/word ROR or ROL and check to see if the overflow flag was triggered. (Or was that a SHL/SHR?) Ie, depending on the architecture, I think the fastes way to check was to do that. You rotate the register where the bit of the word/byte in question is stored. Since you are, by shifting the bits towards the least sig/bit, you force that bit to land in one of the state flags. By checking the flag after the register has been shifted/rotated will achive what you want. I think that's like what? 2-3 instructions. In C/C++, there is a library you can use to check it, but I forget what it's called and it is slower than a shift+flag check. Hope that helps some. Wing. ================================================================= The GameProgrammer.Com mailing list is for the open discussion of any topic related to the art, science, and business of programming games. This list is especially tolerant of beginners. We were all beginners once To SUBSCRIBE or UNSUBSCꫨ please visit: http://gameprogrammer.com/mailinglist.html
|
|