Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

RE: [AVR-Chat] Exclusive or

2004-06-19 by David VanHorn

At 09:01 PM 6/18/2004 -0700, Dave Hylands wrote:

>I think that the fastest way is to have a sixteen entry lookup table,
>where the answer is precomputed and stored.
>
>You could also store a 16 bit value, where each bit position holds the
>answer and use something like (in C):
>
>Lookup & ( 1 << val )

Yes, that was my first take.

In avr assembler:

clr     TEMP2
ldi     ZL,low(Xor_Table*2)
ldi     ZH,high(Xor_Table*2)
add     ZL,XOR_Dat
adc     ZH,TEMP2
lpm

I suppose this isn't all that ugly. 
What's this anyway, two PIC instructions worth?

I just get the feeling there's a better way.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.