lbowers
asked on
Bit shifting...
What's the best method of bit shifting in VB6?
I'm unable to find any methods to do the job so assume a bit of work is required. I need to be able to shift the bits by a set amount.
Thanks in advance.
I'm unable to find any methods to do the job so assume a bit of work is required. I need to be able to shift the bits by a set amount.
Thanks in advance.
Don't forget integer divide \
AND won't *shift* bits. You've got to declare 'em integers and multiply by 2/4/8, etc. to implement shift lefts and you can do integer divide by 2/4/8 etc. for shift right.
M
AND won't *shift* bits. You've got to declare 'em integers and multiply by 2/4/8, etc. to implement shift lefts and you can do integer divide by 2/4/8 etc. for shift right.
M
ASKER
AND doesn't shift - It just selectively removes bits.
Thanks anyway.
Thanks anyway.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
opps ;-))
sorry, the line that reads..
bit(1)=1:bit(2)=2:bit(3)=4 :bit(4)=8: bit(5)=16: bit(6)=32: bit(7)=64: bit(8)=128
should be replaced with the following :)
bit(1)=2:bit(2)=4:bit(3)=8 :bit(4)=16 :bit(5)=32 :bit(6)=64 :bit(7)=12 8:bit(8)=2 56
sorry for the inconvenience.. ;-)
..-=ViKtOr=-..
sorry, the line that reads..
bit(1)=1:bit(2)=2:bit(3)=4
should be replaced with the following :)
bit(1)=2:bit(2)=4:bit(3)=8
sorry for the inconvenience.. ;-)
..-=ViKtOr=-..
Eqv,imp, Not,Or,Xor operators as below. Use the same to implement the shift
MyCheck = A And B