Boost logo

Boost :

From: Maurizio Vitale (mav_at_[hidden])
Date: 2007-04-19 02:27:48


"Michael Marcin" <mmarcin_at_[hidden]> writes:

> I'd also add assert on overflow, which I would have as default in debug
> builds and ignore as default in release builds.
> The question is how does one do this cleanly?
> Bear in mind that, at least for my purposes, it is necessary that
> sizeof(fixed<16,16>) == sizeof(GLfixed).

I'm working on a very similar library, also using boost::operators for
minimizing the behaviours to be specified and (at the 4th rewrite)
boost::proto for building expression templates involving differnt
classes of fixed-point (I'll have limited precision, < 64bit, unlimited
fixed precision and variable precision). I'm also using proto, with a
different evaluation context to compute overflow and quantization
correction (SystemC is rather fancy in what allows there, if you want to
see overflow modes you've never seen before, go there).

Overflow and quantization handling are user specifiable, with no impact on the
object size (e.g. for me a fized<16,16> will be 4 bytes).
You can get an idea on how to do it by looking at the conversion library
by Fernando Cacciola, included in boost.

Best regards,

     Maurizio


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk