Interesting. I tried the second one, and it works. 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).
Thank you yet again! I think I'm going to use the new one because it seems to be a little faster.
fonctions de sprite gcc4ti
-
Michael0x18
Niveau 3: MH (Membre Habitué)- Messages: 12
- Inscription: 07 Oct 2020, 17:10
- Genre:
- Calculatrice(s):→ MyCalcs profile
Re: fonctions de sprite gcc4ti
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.
Membre de la TI-Chess Team.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
-
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)- Messages: 6859
- Inscription: 23 Déc 2009, 00:00
- Localisation: France
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Classe: -
- GitHub: debrouxl
Re: fonctions de sprite gcc4ti
True. It's called eight times within the same function. I'll declare it inline/convert it to a macro and see.
-
Michael0x18
Niveau 3: MH (Membre Habitué)- Messages: 12
- Inscription: 07 Oct 2020, 17:10
- Genre:
- Calculatrice(s):→ MyCalcs profile
Re: fonctions de sprite gcc4ti
An inline function buys you type checking and other niceties that macros can't bring, so you should keep using a function
Membre de la TI-Chess Team.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
-
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)- Messages: 6859
- Inscription: 23 Déc 2009, 00:00
- Localisation: France
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Classe: -
- GitHub: debrouxl
Re: fonctions de sprite gcc4ti
Okay. Got it. (And thank you yet again!)
-
Michael0x18
Niveau 3: MH (Membre Habitué)- Messages: 12
- Inscription: 07 Oct 2020, 17:10
- Genre:
- Calculatrice(s):→ MyCalcs profile
15 messages
• Page 2 sur 2 • 1, 2
Qui est en ligne
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 11 invités