How to make a Python Long from a long long in an extension
searleir at my-deja.com
searleir at my-deja.com
Mon Aug 28 13:47:38 EDT 2000
Sorry for posting without doing all my homework. I found an
undocumented PyLong_FromUnsignedLongLong() which is exactly what I want.
-Ian
In article <8oe46r$gi6$1 at nnrp1.deja.com>,
searleir at my-deja.com wrote:
> I am writing an extension module that defines a new Python type. This
> type is responsible for reading a stream of data, and creating a large
> table. Within the table is a column of time values that are 64 bits
> wide. I can easily create the value properly using either GNUs long
> long, or MS __int64.
>
> The problem I am having is having is how do I get a 64 bit integer
into
> a Python Long Integer. PyLong_FromLong() takes a 32bit integer, not
64.
> Casting to Double works, but truncates the precision for larger
values.
>
> The values are ticks, in 75 nano-second increments, so I do need all
64
> bits of precision.
>
> Does anyone know a way I can get a 64 bit integer into a Python Long
> through an interface ? Or am I forced to create a Long, and write
> directly to its data (ugh).
>
> Thanks,
> -Ian Searle
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list