π
<-

fonctions de sprite gcc4ti

Programmation et implémentation d'algorithmes.

Re: fonctions de sprite gcc4ti

Unread postby Michael0x18 » 24 Feb 2021, 01:40

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.
User avatar
Michael0x18
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Level up: 36%
 
Posts: 12
Joined: 07 Oct 2020, 17:10
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: fonctions de sprite gcc4ti

Unread postby Lionel Debroux » 24 Feb 2021, 08:30

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.
User avatar
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 11.4%
 
Posts: 6873
Joined: 23 Dec 2009, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Class: -
GitHub: debrouxl

Re: fonctions de sprite gcc4ti

Unread postby Michael0x18 » 24 Feb 2021, 17:01

True. It's called eight times within the same function. I'll declare it inline/convert it to a macro and see.
User avatar
Michael0x18
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Level up: 36%
 
Posts: 12
Joined: 07 Oct 2020, 17:10
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: fonctions de sprite gcc4ti

Unread postby Lionel Debroux » 24 Feb 2021, 17:55

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.
User avatar
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 11.4%
 
Posts: 6873
Joined: 23 Dec 2009, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Class: -
GitHub: debrouxl

Re: fonctions de sprite gcc4ti

Unread postby Michael0x18 » 24 Feb 2021, 18:07

Okay. Got it. (And thank you yet again!)
User avatar
Michael0x18
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Level up: 36%
 
Posts: 12
Joined: 07 Oct 2020, 17:10
Gender: Not specified
Calculator(s):
MyCalcs profile

Previous

Return to Programmation

Who is online

Users browsing this forum: ClaudeBot [spider] and 5 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
2373 utilisateurs:
>2317 invités
>48 membres
>8 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)