On Sun, Jun 15, 2008 at 4:44 AM, Aleksander Morgado <[EMAIL PROTECTED]> wrote: > Which would be the cleanest way of converting a pdf_i64_t into a pdf_i32_t? > > We may need new functions in the bignum implementation to maintain the > pdf_i64_t as a blackbox. > > What do you all think? > The cleanest way is to use a mask to retrieve the least significant 4 bytes. However, the upper 32 bits MUST be all zero (positive 32-bit value) or all 1 (negative) - otherwise the conversion must fail.
What problems do you encounter with the pdf_i64_t implementation? Compilers often do all the maths; you just have to choose the keyword that means "this is a 64-bit int regardless of the CPU"). I think it is C99 which specifies the keywords for those types, but even in 2005 I found it very unportable, so I suspect the "best" way involves a lot of #ifdef/#ifndef directives. - Cirilo
