Message13612
Logged In: YES
user_id=21627
Something very simple:
PyObject *
PyLong_FromVoidPtr(void *p)
{
#if SIZEOF_VOID_P <= SIZEOF_LONG
return PyInt_FromLong((long)p);
#else
#ifndef HAVE_LONG_LONG
# error "PyLong_FromVoidPtr: sizeof(void*) > sizeof(long),
but no long long"
#endif
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
# error "PyLong_FromVoidPtr: sizeof(LONG_LONG) < sizeof
(void*)"
#endif
/* optimize null pointers */
if (p == NULL)
return PyInt_FromLong(0);
return PyLong_FromLongLong((LONG_LONG)p);
#endif /* SIZEOF_VOID_P <= SIZEOF_LONG */
}
|
|
Date |
User |
Action |
Args |
2007-08-23 14:09:23 | admin | link | issue653542 messages |
2007-08-23 14:09:23 | admin | create | |
|