From 63a3571e1732176e0e784e0d0e6dac07c9162611 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 11 Dec 2001 19:57:24 +0000 Subject: [PATCH] float_int_div(): For clarity, move this closer to the other float division functions, and rename to float_floor_div. --- Objects/floatobject.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Objects/floatobject.c b/Objects/floatobject.c index ea162dfde7b..8ce0ff5f922 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -513,6 +513,21 @@ float_divmod(PyObject *v, PyObject *w) return Py_BuildValue("(dd)", floordiv, mod); } +static PyObject * +float_floor_div(PyObject *v, PyObject *w) +{ + PyObject *t, *r; + + t = float_divmod(v, w); + if (t != NULL) { + r = PyTuple_GET_ITEM(t, 0); + Py_INCREF(r); + Py_DECREF(t); + return r; + } + return NULL; +} + static PyObject * float_pow(PyObject *v, PyObject *w, PyObject *z) { @@ -568,21 +583,6 @@ float_pow(PyObject *v, PyObject *w, PyObject *z) return PyFloat_FromDouble(ix); } -static PyObject * -float_int_div(PyObject *v, PyObject *w) -{ - PyObject *t, *r; - - t = float_divmod(v, w); - if (t != NULL) { - r = PyTuple_GET_ITEM(t, 0); - Py_INCREF(r); - Py_DECREF(t); - return r; - } - return NULL; -} - static PyObject * float_neg(PyFloatObject *v) { @@ -757,7 +757,7 @@ static PyNumberMethods float_as_number = { 0, /* nb_inplace_and */ 0, /* nb_inplace_xor */ 0, /* nb_inplace_or */ - float_int_div, /* nb_floor_divide */ + float_floor_div, /* nb_floor_divide */ float_div, /* nb_true_divide */ 0, /* nb_inplace_floor_divide */ 0, /* nb_inplace_true_divide */