swapf command in MikroC?

General discussion on mikroC.
Post Reply
Author
Message
wuu
Posts: 115
Joined: 24 Mar 2008 00:48

swapf command in MikroC?

#1 Post by wuu » 04 Mar 2009 19:09

Which is the easiest and the fastest way for interpretation of SWAPF command from assembler in MikroC? In other word's I want to swap four upper and lover nibbles of a byte.

eddyb
Posts: 14
Joined: 22 Feb 2009 14:47

#2 Post by eddyb » 04 Mar 2009 19:59

Code: Select all

x=(x<<4&0xF0)|(x>>4&0xF)

andrixnet
Posts: 8
Joined: 12 May 2011 11:50

Re:

#3 Post by andrixnet » 26 Apr 2012 18:13

eddyb wrote:

Code: Select all

x=(x<<4&0xF0)|(x>>4&0xF)
Yes, this is the C way of writing it, but compiles to about 29 instructions ...

Post Reply

Return to “mikroC General”