|
Boost : |
Subject: [boost] [xint] what about a DSEL?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-05-03 02:09:13
Hi Chad,
I dont know the complexity of the algorithms behind the xint operations, but instead of making eager evaluation you could do lazy evaluation. You could define a DSEL which evaluates the expression x*y + z at once.
it would be great if at the end
w = x*y + z;
resulted in only one allocation for the result of the expression, and a move to make the assignement.
If given two integers i and j using n and m bits, you know the number of bits needed by i @ j, you can know the number of bits of x*y + z, isn't it?
If in addition, the rhs expression resulted on a integer needing less bits than the lsh, you could do the operation directly on the lhs, avoiding any allocation!
My 2cts,
_____________________
Vicente Juan Botet Escribá
http://viboes.blogspot.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk