in reply to Re: Q about module building
in thread Q about module building

** is handled as a floating point operation using log and exp, and 64-bit FP doesn't have the mantissa precision for the 1 to add in. Use 1<<55 instead.

I found my problem. After carefully coding to work with 32 and 64 bit ints, I wrote lines like left_shift = 32 - right_shift; not once but 4 times!

ANSWER MY OWN Q: stuck "LLU" after the 0x8000000000000000 and all is well

Which brings me to a question that is REALLY off topic for Perlmonks, but if no one wants to answer it, maybe someone can suggest a place to ask the Q. For this example, UV and IV are 64 bits.
#define BIT_WITHIN_UV_MASK 0x3F #define BIT0 ((UV)0x8000000000000000) #define BITNO_TO_BITMASK(bitno) (BIT0>>(bitno&BIT_WITHIN_UV_MASK)) SV *mm_array_fetch (mm_array *array, IV index, int prelocked) { UV uv; uv = ... sv = uv & BITNO_TO_BITMASK(index) ? &PL_sv_yes : &PL_sv_no;
The last line gets the following warning from gcc:
MMA.xs:463: warning: integer constant is too large for "long" type
Thanks,
cmac

Replies are listed 'Best First'.
Re^3: Q about module building
by ikegami (Patriarch) on Feb 27, 2009 at 04:54 UTC
    #define BIT0 ((UV)0x8000000000000000ULL)