comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: integer operations in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: integer operations in IDL [message #43033] Thu, 10 March 2005 13:57
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
Dan Larson wrote:
> there are integer operations in windows API which I find really speed
> calculations on large data sets, for example UInt32x32To64
>
> The UInt32x32To64 function multiplies two unsigned 32-bit integers,
> returning an unsigned 64-bit integer result. The function performs
> optimally on 32-bit Windows.
>
> Is there anything comprable in IDL? Or does anyone have a suggestion
> on how to implement it?

I don't think there's anything like this in IDL. (Covering myself here -
sometimes obscure new functionality like this sidles in unnoticed.) The
way you'd do the multiplication in question would be to cast one or both
arguments "up" with IDL's ULONG64() function, then do a straight
multiplication. No doubt that's going to take a performance hit on a
32-bit platform.
If you're really after performance then you will have to code an external
routine in C or such. For the given multiplication (and perhaps other
operations), I'd actually go for inline assembly rather than the Win32
system call. I mean, the job itself is simple and IDL can already do it,
but you're after better performance (presumably working on arrays) so you
might as well go all out. Avoid all those Win32 function calls. In this
case, the good old MUL instruction does exactly what you want. There's
also the MMX instruction PMULUDQ that can do two at once, but it seems a bit
awkward in the way it loads its inputs and it might not be worth the
trouble. (I've never tried it myself.)

Peter Mason
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: integer operations in IDL
Next Topic: Calling data from a structure of pointers?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:06:28 PDT 2025

Total time taken to generate the page: 0.00570 seconds