Shift by 4 bits at a time

Code:

Alex Davies of Ace Electronics Engineering Says:

You can save 1 word per byte on the above by using XOR swaps with W as a carry register. ie, to shift to the left by a nibble:

SWAPF TEMP0, W
MOVWF TEMP0
ANDLW 0x0F
XORWF TEMP0, F

SWAPF TEMP1, F
XORWF TEMP1, F
XORWF TEMP1, W
ANDLW 0x0F
XORWF TEMP1, F

SWAPF TEMP2, F
XORWF TEMP2, F
XORWF TEMP2, W
ANDLW 0x0F
XORWF TEMP2, F

...

(untested)