Android Question shift left or shift right with 0 replacing

fgh3966

Active Member
Licensed User
Hello everybody

How can we shift a 4-bit byte to the right and replace the empty spaces with zero, and then also do the same thing to shift to the left ?

Thank
 

Daestrum

Expert
Licensed User
Longtime User
RightShift example - basically the same for LeftShift
B4X:
Dim value As Int = 0x48
value = Bit.And(value, 0xF0) ' not really needed but would be 0x0F for left shift to clear sign bit
value = Bit.ShiftRight( value, 4) ' shift right 4 bits
 
Upvote 0
Top