And them with %11110000 for the 4 higher bits or and them with %00001111 for the for lower bits.
For the 4 higher bits you could shift them 4 times right to get them on the lower positions
And them with %11110000 for the 4 higher bits or and them with %00001111 for the for lower bits.
For the 4 higher bits you could shift them 4 times right to get them on the lower positions
Last edited by mat janssen; - 12th March 2010 at 11:37.
Use the bitwise operator "&" like this:
steveCode:mynibble = mybyte & %00001111 'Put the lower 4 bits into mynibble myothernibble = mybyte & %11110000 'Put the upper 4 bytes into myothernibbe
Dohh! Mat beat me to it.![]()
Last edited by Byte_Butcher; - 12th March 2010 at 16:27. Reason: slow on the draw
You could do this:
Code:highbits = yourbyte / 16 lowbits = yourbyte // 16
Last edited by misamilanovic; - 12th March 2010 at 17:36.
Bookmarks