Hi, Is there an equivelan function or keyword to "swap"? Is there anyway to get the high or lower nibbles of a variable or swap them in C? any help would be appreciated. -=N
uhhh, well the code doesn't look good. The shift are taken literally and theres two loops in the swap function. I think the assembly function is much faster. Regards -=N
All that would be required is for C51 to detect a special case of the intrinsic function _crol_() when the number of bits to roll is known to be four. e.g.
c = _crol_(c, 4);
And you know: Cole Knows Rolls! (Ought to be able to get some sort of Nike or Gatorade endorsement ad outta this somehow.)
For some 4-bit shift subexpressions, C51 does optimize and utilize the SWAP instruction. If you are interested, follow this link to some comments I made in another 8051-related forum: http://www.8052.com/forum/read.phtml?id=55578