changeset 1465:2f0eeba34609

cfield: Avoid unnecessary type check.
author Marcel Keller <mkeller@cs.au.dk>
date Wed, 11 Aug 2010 19:23:54 +0200
parents 47f4c80e1acd
children 9ee98fe5024c
files viff/cfield.c
diffstat 1 files changed, 25 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/viff/cfield.c	Wed Aug 11 18:30:38 2010 +0200
+++ b/viff/cfield.c	Wed Aug 11 19:23:54 2010 +0200
@@ -146,31 +146,31 @@
     return cfield_GF256__new(value);
 }
 
-#define GET_VALUES(IN1, IN2, OUT1, OUT2, OP)			    \
-    if (Py_TYPE(IN1)->tp_as_number != NULL &&			    \
-	Py_TYPE(IN1)->tp_as_number->nb_##OP == cfield_GF256_##OP) { \
-	OUT1 = (unsigned char) ((cfield_GF256*)IN1)->value;	    \
-    } else {							    \
-	if (PyInt_Check(IN1))					    \
-	    OUT1 = (unsigned char) PyInt_AS_LONG(IN1);		    \
-	else if (PyLong_Check(IN1))				    \
-	    OUT1 = (unsigned char) PyLong_AsLong(IN1);		    \
-	else {							    \
-	    Py_INCREF(Py_NotImplemented);			    \
-	    return Py_NotImplemented;				    \
-	}							    \
-	OUT2 = (unsigned char) ((cfield_GF256*)IN2)->value;	    \
-    }								    \
-    if (Py_TYPE(IN2)->tp_as_number != NULL &&			    \
-	Py_TYPE(IN2)->tp_as_number->nb_##OP == cfield_GF256_##OP) { \
-	OUT2 = (unsigned char) ((cfield_GF256*)IN2)->value;	    \
-    } else if (PyInt_Check(IN2))				    \
-	OUT2 = (unsigned char) PyInt_AS_LONG(IN2);		    \
-    else if (PyLong_Check(IN2))					    \
-	OUT2 = (unsigned char) PyLong_AsLong(IN2);		    \
-    else {							    \
-	Py_INCREF(Py_NotImplemented);				    \
-	return Py_NotImplemented;				    \
+#define GET_VALUES(IN1, IN2, OUT1, OUT2, OP)				\
+    if (Py_TYPE(IN1)->tp_as_number != NULL &&				\
+	Py_TYPE(IN1)->tp_as_number->nb_##OP == cfield_GF256_##OP) {	\
+	OUT1 = (unsigned char) ((cfield_GF256*)IN1)->value;		\
+	if (Py_TYPE(IN2)->tp_as_number != NULL &&			\
+	    Py_TYPE(IN2)->tp_as_number->nb_##OP == cfield_GF256_##OP) { \
+	    OUT2 = (unsigned char) ((cfield_GF256*)IN2)->value;		\
+	} else if (PyInt_Check(IN2))					\
+	    OUT2 = (unsigned char) PyInt_AS_LONG(IN2);			\
+	else if (PyLong_Check(IN2))					\
+	    OUT2 = (unsigned char) PyLong_AsLong(IN2);			\
+	else {								\
+	    Py_INCREF(Py_NotImplemented);				\
+	    return Py_NotImplemented;					\
+	}								\
+    } else {								\
+	if (PyInt_Check(IN1))						\
+	    OUT1 = (unsigned char) PyInt_AS_LONG(IN1);			\
+	else if (PyLong_Check(IN1))					\
+	    OUT1 = (unsigned char) PyLong_AsLong(IN1);			\
+	else {								\
+	    Py_INCREF(Py_NotImplemented);				\
+	    return Py_NotImplemented;					\
+	}								\
+	OUT2 = (unsigned char) ((cfield_GF256*)IN2)->value;		\
     }
 
 static PyObject* cfield_GF256_add(PyObject* self, PyObject* other) {