On Fri, May 15, 2009 at 4:03 PM, Robert Bradshaw
<[email protected]> wrote:
>
>>> Also, we are
>>> assuming that the only sizes that can occur are char, short, int,
>>> long, and long long. (It sounds inconceivable, but the C spec would
>>> allow 16-bit ints and 64-bit longs, or 64-bit ints as in ILP64.)
>>>
>>
>> OK... I could fix this returning a PyLong instance.
>

> My point was that there are systems with none of char, short, int,
> long being 32 bits, but your extern type could have 32 bits. The if-
> then statement dispatching on type sizes wouldn't work.
>

I understood precisely that, and my point was that is more or less
easy to support, for example

...
else if (sizeof(type) == sizeof(long long))
...
else {
       unsigned char *bytes = (unsigned char *) &VALUE;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(type), little, SIGNED);
}

>> What do you think? Does this make sense? Any better syntax?
>
> I'm -1 on both the syntax and the idea, comments in the next email.
>

OK, waiting for it...


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to