π
<-
Chat plein-écran
[^]

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 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 66.7%
 
Posts: 8
Joined: 07 Oct 2020, 17:10
Gender: Not specified
Calculator(s):

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: 8.4%
 
Posts: 6627
Joined: 23 Dec 2009, 00:00
Location: France
Gender: Male
Calculator(s):
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 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 66.7%
 
Posts: 8
Joined: 07 Oct 2020, 17:10
Gender: Not specified
Calculator(s):

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: 8.4%
 
Posts: 6627
Joined: 23 Dec 2009, 00:00
Location: France
Gender: Male
Calculator(s):
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 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 66.7%
 
Posts: 8
Joined: 07 Oct 2020, 17:10
Gender: Not specified
Calculator(s):

Previous

Return to Programmation

Who is online

Users browsing this forum: No registered users and 3 guests

-
Search
-
Social
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Découvre les nouvelles fonctionnalités en Python de l'OS 5.2 pour les Nspire CX II
Découvre les nouvelles fonctionnalités en Python de l'OS 5.5 pour la 83PCE/84+C-T Python Edition
Omega, le fork étendant les capacités de ta NumWorks, même en mode examen !
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.
558 utilisateurs:
>543 invités
>9 membres
>6 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)