fast conversion int<->float<->double arays

Posted on 2004-11-09
Last Modified: 2008-02-01
I am looking for fast conversion routines that convert between arrays of int (different types|widths), float, and double.
They should use platform-specific instructions (e.g. SIMD2) if available, or fall back a portable solution otherwise.

I am *not* looking for loose links/snippets how to do individual conversions.

Any suggestions?
Question by:peterchen092700
    LVL 22

    Accepted Solution

    You may not like this suggestion:

    You're probably barking up the wrong tree.  Converting the data is very unlikely to be a bottleneck:

    (1)  Assuming the data came off or is going to the disk or network, the I/O has to be much slower than the conversion time.

    (2)  If the floats are going in or out of some computation, any non-trivial computation is going to be much slower than the conversion.

    (3)  If you really want to speed up the code, recast it so no data conversion is required.

    So I suggest you look elsewhere for speedups unless you can show that the conversion really is a speed problem.

    LVL 7

    Author Comment

    Problem is, this goes into a tool library that runs background services which should have lowest possible impact. If I find something ready made that reduces time by 5%, I'm fine. (If I have to code two days, it's not worth the trouble)

    The data conversions are unavoidable, since they are interfacing different components.

    (I think the biggest time easter will be running through the 128K*8Bytes of memory anyway)
    LVL 7

    Author Comment

    Can be closed for my part.
    LVL 7

    Author Comment

    umm... I can't close it with points refunded, right?
    (haven't been here often lately...)

    while grg99's comments are valid, they don't answer the question at all.
    LVL 7

    Author Comment

    I've obviously not been here for too long... sorry.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
    C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (…
    The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now