Rotate on Byte? Or always a long
TJHJ
Posts: 243
Hey all,
Dumb question. If I use the rotate command on a byte, will it properly rotate around to the 8th bit? Or Does rotate like its a long?
Ex
Side note
Anyone have a good way to rotate a 4 bit value around? With out a bunch of checking?
Im really trying to rotate %1100 right 1 per loop. But keep it all in the 4 bit format.
Thanks
·TJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I owe everyone here a bunch, So thanks again for answering my dumb questions.
Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
Suzuki RG500 in a RGV 250 frame.
Bimota V-Due (Running on the fuel injection system)
Aprilia RS250
Dumb question. If I use the rotate command on a byte, will it properly rotate around to the 8th bit? Or Does rotate like its a long?
Ex
Var byte RotateTest Pub Main RotateTest := %1010 RotateTest <-= 8 'Is rotate test now %0000_1010 or %1010_0000_0000 ???
Side note
Anyone have a good way to rotate a 4 bit value around? With out a bunch of checking?
Im really trying to rotate %1100 right 1 per loop. But keep it all in the 4 bit format.
Thanks
·TJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I owe everyone here a bunch, So thanks again for answering my dumb questions.
Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
Suzuki RG500 in a RGV 250 frame.
Bimota V-Due (Running on the fuel injection system)
Aprilia RS250
Comments
To rotate a 4 bit value, you have to do masking and multiple shifts like
(value << 1 & %1110) | (value >> 3 & %0001)
rotate it then do if greater then 16 subtract 15 this will clear the greater bit and set lowest bit at same time
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
((value << 1) | (value >> 3)) & %1111
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys