Thank you yet again! I think I'm going to use the new one because it seems to be a little faster.
Niveau 3: MH (Membre Habitué)
- Level up: 28%
- Posts: 12
- Joined: 07 Oct 2020, 17:10
A bit earlier, I figured out that since the 68K uses big endian, we can't do 1<<offset; it needs to be 1<<(size-offset).
Oh yeah, I missed that too. You could also shift right a 0x8000 value for a short, 0x80 for a byte.
I think I'm going to use the new one because it seems to be a little faster.
The byte-sized version should indeed be marginally faster if the compiler produces a btst instruction, but not that much.
If the pixel test function is used at few call sites (say, less than 5), you should consider declaring it "inline", so as to avoid the overhead of passing arguments into the appropriate registers (or worse, on the stack, if you didn't use the -mregparm=5 compiler flag), calling into a subroutine, returning from that subroutine, and possibly adjusting the stack pointer at some point if the default stack-based calling convention is being used.
In ExtGraph, pixel operations are macros because it yields much, much better speed optimization, and sometimes size optimization as well.
Users browsing this forum: No registered users and 2 guests