'AND how fast?'
How fast can you logically AND two bits?
bit_a of register A
bit_b of register B
bit_c of register C
The goal in C parlance is:
C.bit_c = A.bit_a & B.bot_b;
And just so it's clear, here's some sluggish PIC code that does
9 unbearably long cycles and trashes W. Last week I placed too much
emphasis on preserving W. This week the emphasis is on speeeed.
So here are how the points are to be tallied:
1) Size: 2*(6 - # of execution cycles)
2) Isosynchonous: 3 points
3) Preserves W: 2 points
4) Preserves reg A and B: 1 point
The example slug scores: 2*(6-9) + 3 + 0 + 1 = -2
My pre-Payson/Keitz solution is worth 10 points.
hint: x & y = ~(~x | ~y)
I still buy pizza instead of gas. \<
Scott Dattalo wrote:
> And just so it's clear, here's some sluggish PIC code that does
> the job:
> BTFSC A,bit_a
> MOVLW 1
> BTFSC B,bit_b
> BCF C,bit_c
> IORLW 0
> BSF C,bit_c
> 9 unbearably long cycles and trashes W.
Not to mention it doesn't work. Jeeezz, it's difficult to right bad
code! What I meant was:
BTFSS B,bit_b ;Was BTFSC
On Tue, 2 Sep 1997, Scott Dattalo wrote:
> How fast can you logically AND two bits?
> bit_a of register A
> bit_b of register B
> bit_c of register C
> The goal in C parlance is:
> C.bit_c = A.bit_a & B.bot_b;
bsf C,bit_c ;assume the result will be high.
btfss A,bit_a ;does bit_a make the result low?
bcf C,bit_c ;yes.
btfss B,bit_b ;does bit_b make the result low?
bcf C,bit_c ;yes.
2+3+2+1=8 points if this works :)
Correct me if I'm wrong, but I believe this one scores 8 good points.
Fast bitwise AND? How many points for:
bcf C, bit_c
btfss A, bit_a
btfss B, bit_b
bsf C, bit_c
At 12:22 PM 9/2/97 -0800, you wrote:
After further review:
This one scores 10!
Marc 'Nepomuk' Heuler
Hi Shane (Shane Nelson), in <cheetah.spots.ab.ca> on Sep 2 you wrote: Pine.LNX.3.96.970902133152.20030y-100000
You can save a cycle:
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- New search...