diff options
-rw-r--r-- | Modules/almodule.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/Modules/almodule.c b/Modules/almodule.c index 7e399ea..ffd5a56 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -86,72 +86,6 @@ ErrorHandler(long code, const char *fmt, ...) #ifdef AL_NO_ELEM /* IRIX 6 */ static PyObject * -PyLong_FromLongLong(long long v) -{ - /* XXXX Somewhat complicated way to convert a long long to a PyLong */ - PyObject *l = NULL, *lhi, *llo; - int is_negative = 0; - static PyObject *i32; /* 32 as a python long */ - - if (v < 0) { - is_negative = 1; - v = -v; - } - lhi = PyLong_FromUnsignedLong((unsigned long) ((unsigned long long) v >> 32)); - llo = PyLong_FromUnsignedLong((unsigned long) (v & 0xFFFFFFFFLL)); - if (i32 == NULL) - i32 = PyLong_FromLong(32L); /* don't decref */ - if (PyErr_Occurred()) - goto error; - if ((l = PyNumber_Lshift(lhi, i32)) == NULL) - goto error; - Py_DECREF(lhi); - lhi = l; - if ((l = PyNumber_Or(lhi, llo)) == NULL) - goto error; - Py_DECREF(lhi); - Py_DECREF(llo); - if (is_negative) { - if ((lhi = PyNumber_Negative(l)) == NULL) - goto error; - Py_DECREF(l); - l = lhi; - } - return l; - - error: - Py_XDECREF(lhi); - Py_XDECREF(llo); - Py_XDECREF(l); - return NULL; -} - -static long long -PyLong_AsLongLong(PyObject *v) -{ - /* XXXX Somewhat complicated way to convert a PyLong to a long long */ - static PyObject *i2_32; /* 2**32 as a python long */ - PyObject *lhi, *llo; - long long ihi; - unsigned long long ilo; - - if (!PyLong_Check(v)) { - PyErr_BadInternalCall(); - return -1; - } - if (i2_32 == NULL) - i2_32 = PyLong_FromLongLong(0x100000000LL); /* don't decref */ - if ((v = PyNumber_Divmod(v, i2_32)) == NULL) - return -1; - lhi = PyTuple_GetItem(v, 0); - llo = PyTuple_GetItem(v, 1); - ihi = PyLong_AsLong(lhi); - ilo = PyLong_AsUnsignedLong(llo); - Py_DECREF(v); - return ihi * 0x100000000LL + ilo; -} - -static PyObject * param2python(int resource, int param, ALvalue value, ALparamInfo *pinfo) { ALparamInfo info; |