|
Boost : |
Subject: Re: [boost] Fixed point integer proposal
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2009-06-25 05:08:07
Soren Holstebroe wrote:
> Some years ago I wrote a fixed point template for transparent fixed point
> integer arithmetics and conversion.
To me, "fixed point" => !"integer".
> It worked well and performance was equal to that of native integer types, at
> least in MS VC++.
> The template takes a base type and the number of bits reserved for the
> fraction part and meta-programming works out boundary safe arithmetics and
> conversions.
> The template has been used in an image processing library, but lately I used
> it for seamless conversion of a 4+28 bit fixed point MAD-library decoded
> mp3-stream to the output buffer of the sound system, with a detour through a
> float-based sound effect.
>
> Would there be public interest in a template like that in the boost library?
I proposed something like this a while ago. The feedback suggested
that most potential users wanted more than I was offering. In
particular, saturating or otherwise detecting overflows seemed to be
required. I did have a go at implementing this (using a saturating int
class as the implementation type) but I'm unenthusiastic about
proposing something that I'm not myself using. Other people suggested
that it would be better to use expression templates and I seem to
recall that someone was actually working on that. It was also
suggested that I ought to provide all of the features that <cmath>
provides for floating point.
Regards, Phil.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk