Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
145 user(s) are online (125 user(s) are browsing Forums)

Members: 3
Guests: 142

vagappc, Amigafreak02, Petrol, more...

Support us!

Headlines

 
  Register To Post  

« 1 (2)
Re: UDivMod32 ?
Home away from home
Home away from home


See User information
Quote:

ps. what is strange, its why we still references to them in os4 sdk (pretty a lot should to say


You'll notice they are *not* in the autodocs, nor are they mentioned in any os4 pecific include files, they are only reference in the ggc inlne files (as opposed to inline4) they are 68k only

It could be there a 68k stubs for them but not PPC or they may just be depreicated (but still present for backwards com patabilty with 68k software using them()

Go to top
Re: UDivMod32 ?
Home away from home
Home away from home


See User information

Quote:

#define UDivMod32(x,y)( (ULONG) x % (ULONG) y ) // UDivMod32() replacement (so on os3 it still be used as it)
#define SDivMod32(x,y) ( (LONG) x % (LONG) y ) // SDivMod32() replacement (so on os3 it still be used)
#define UMult32(x,y) ( (ULONG) x * (ULONG) y ) // UMult32() replacement (so on os3 it still be used)


Then it should be

#define UDivMod32(x,y)( (ULONG) x / (ULONG) y ) // UDivMod32() replacement (so on os3 it still be used as it)
#define SDivMod32(x,y) ( (LONG) x / (LONG) y ) // SDivMod32() replacement (so on os3 it still be used)
#define UMult32(x,y) ( (ULONG) x * (ULONG) y ) // UMult32() replacement (so on os3 it still be used)


(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: UDivMod32 ?
Home away from home
Home away from home


See User information
I would recomend complete replacement so that gcc can optimise feely but if you must use nmacros then LiveForIts ones are correct.

Although the UDivMod returns the Divsion amd Modulus the division is returned in D0 so is the standard return result with modolus being a side effect.





Go to top
Re: UDivMod32 ?
Home away from home
Home away from home


See User information
@Andy
i think about rewrite right at begining and do not use them at all in code, but maybe on os3 those asm functions will be faster in compare with gcc rewrite / optimize. besides i use gcc2.9.x for os3, so maybe gcc optimisation there will be even worse

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: UDivMod32 ?
Home away from home
Home away from home


See User information
Kas1e

There is no way that a call which extracts both the div and mod of a pair of numbers will be faster that one that only extracts the div


gcc can certainly optimise


int x,y,z;

z = x / y ;


more efficiently than

int x,y,z;

z = div(x,y)

and furthermore the example case you gave was hardly even a speed sensitive usage.

It's sensible to do it in stages, but for long term managable portable code, such platform specific calls should go.



Go to top
Re: UDivMod32 ?
Just can't stay away
Just can't stay away


See User information
@kas1e
Check my clarification of this issue in the developer forum at SF.

Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

Go to top
Re: UDivMod32 ?
Home away from home
Home away from home


See User information
@all

Just to make you all know, those:

Quote:

#define UDivMod32(x,y)( (ULONG) x / (ULONG) y ) // UDivMod32() replacement (so on os3 it still be used as it)
#define SDivMod32(x,y) ( (LONG) x / (LONG) y ) // SDivMod32() replacement (so on os3 it still be used)
#define UMult32(x,y) ( (ULONG) x * (ULONG) y ) // UMult32() replacement (so on os3 it still be used)


Didn't solve problem. I.e. once i replace it like this, cursor and mouse x/y fucked up :( So i have recheck again, and (ULONG) x / (ULONG) y is not the same as ((ULONG) x) / ((ULONG) y) of course :)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: UDivMod32 ?
Just can't stay away
Just can't stay away


See User information
@kas1e

They probably don't work because he hasn't added parenthesis around the x and y arguments in the macro definitions:
Quote:

#define UDivMod32(x,y) ((ULONG)(x)/(ULONG)(y))
#define SDivMod32(x,y) ((LONG)(x)/(LONG)(y))
#define UMult32(x,y) ((ULONG)(x)*(ULONG)(y))


Without the parenthesis if you do something like:
result = UMult32(5+3,4);
it will be expanded to:
5+3*4 = 17
instead of what was intended:
(5+3)*(4) = 32

Go to top
Re: UDivMod32 ?
Home away from home
Home away from home


See User information
@salas00
Right,works like this as well and compile the same code as if it ( ( (ULONG) x) / ( (ULONG) y ) )

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post
« 1 (2)

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project