QB45 Forums
Party like you didn't do in 1999.

Programming Talk - View Post
Anything related to programming under the sun

GizmoGuy
NORMAL

Posts: 151
Simple Bit Extraction (only in FB or QB ASM)
Posted by GizmoGuy, on Aug 16th, 2005
There is a tutorial on this site that gives a length explanation of bits and how to extract you. I think it is the following
n=number extracting bit from
b=bit to extract
((N and (2^b))/b^2)
the following function appears to be much quicker and takes up less memory. for those of you that know a little asm, it can be used in QB or FB but the follwing code only works for FB.
function getbit(byval number, byval bitpos)
function=(number shr bitpos)mod 2
end function

Back to Programming Talk


My system crashed like a princess on the run
All work was lost and the o.s. was done
What did I do to have faulty parts bestowed?
Maybe the gods don’t know binary code.
Replies:
There are no replies to this message

Post a reply:







All content copyrighted 2004, All rights reserved.