
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 04/13/2010 01:34 AM, Scott McMurray wrote:
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,
And in exchange, every function in the library that uses the internals of the integer -- and there are several -- would need to have special-case handling for small numbers. Not worth the trade-off. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvEB0YACgkQp9x9jeZ9/wRx5gCfaI6W7GVN5qxE5eSreEcVl9qV I7YAoNT2FeIVJk95S+SBtkF4TXK0rs4R =QNd/ -----END PGP SIGNATURE-----