Re: [Fink-devel] ASM in C file ; porting from CodeWarrior - OSX

2002-06-07 Thread Alexander Strange

int float2int(register float in)
{
return (int)in;
}

Begin forwarded message:

 From: Erik de Castro Lopo [EMAIL PROTECTED]
 Date: Fri Jun 07, 2002  08:54:14  PM US/Eastern
 To: [EMAIL PROTECTED]
 Subject: [Fink-devel] ASM in C file ; porting from CodeWarrior - OSX

 Hi all,

 Does anyboy have any idea how to port his code from CodeWarrior
 to OSX?

 inline int
 float2int (register float in)
 {   long res [2] ;
   
   asm
   {   fctiw   in,in
 stfd  in,res
   }
   
 return res [1] ;
 }

 Thanks in advance,
 Erik
 --
 +---+
   Erik de Castro Lopo  [EMAIL PROTECTED] (Yes it's valid)
 +---+
 If dolphins are so smart, why do they live in igloos? -Eric Cartman

 ___

 Don't miss the 2002 Sprint PCS Application Developer's Conference
 August 25-28 in Las Vegas - 
 http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

 ___
 Fink-devel mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/fink-devel


___

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

___
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel



Re: [Fink-devel] ASM in C file ; porting from CodeWarrior - OSX

2002-06-07 Thread Erik de Castro Lopo

On Fri, 7 Jun 2002 21:28:20 -0400
Alexander Strange [EMAIL PROTECTED] wrote:

 int float2int(register float in)
 {
 return (int)in;
 }

Hmm. 

I'm not an expert on PPC, in fact I've only had one for three days. 

However I know that on x86 a bit of inline assember can improve
the execution speed of float/double to int casts by a factor of
8 or more. 

In fact, I wrote a paper on it:

http://mega-nerd.com/FPcast/

Now that I have a PPC machine I will compare the standard C cast
against a function similar to the one I posted. I cannot do that
until I can convert the code, so if anyone knows how to do it,
I would appreciate hearing from them.

Regards,
Erik
-- 
+---+
  Erik de Castro Lopo  [EMAIL PROTECTED] (Yes it's valid)
+---+
Reality is just a crutch for people that can't handle CyberSpace!!
- Hank Duderstadt

___

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

___
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel