
On 13 April 2010 01:26, Chad Nelson <chad.thecomfychair@gmail.com> wrote:
That's easily done. It's what the aforementioned "quick digits" are used for at present. Of course, it means that the space taken up by those digits will be wasted on every integer that's larger than they can hold.
SBO = Small Buffer Optimization You said the "quick digits" are inside the struct to which the xint object holds a pointer, so using them requires dynamic allocation. I picture it something like this: struct xint { union { internal_xint *ptr; intptr_t small; }; xint() : small(1) {} }; Then you only allocate internal_xints on even addresses, so that if (small&1), then the value of the xint is ashr(small, 1). And that way I don't have to worry that a use of a common literal, like xint(3), might throw an exception,