Kenneth Zadeck <zad...@naturalbridge.com> writes: >> it avoids a 2nd copy though, which shows nicely what was rummaging in >> my head for the last two days - that the int_trais <> abstraction >> was somehow at the wrong level - it should have been traits that >> are specific to the storage model? or the above should use >> int_traits<>::decompose manually with it always doing the >> copy (that would also optimize away one copy and eventually >> would make the extra zeros not necessary). > this came in with richard's storage manager patch. In my older code, > we tried and succeeded many times to just borrow the underlying rep. > I think that richard needs to work this out.
Hmm, you mean the patch to introduce all the wi:: stuff? Which cases do you mean? That patch didn't change the HWI representation (and therefore when a copy was needed by the to_shwi*/decompose routines). And it got rid of quite a few *_wide_int constructions, things like: - wide_int wi = (max_wide_int (prev_value) - .add (1, sgn, &overflowed)); + wide_int wi = wi::add (prev_value, 1, sgn, &overflowed); Thanks, Richard