diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-27 03:59:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-27 03:59:08 +0400 |
commit | c62a4629979c1ce95f5d001870583d5463062cf4 (patch) | |
tree | 2bc07106d682d1c193d71bc22614f771c3060f23 /source/blender/python/mathutils/mathutils.c | |
parent | 3ba37b65a32541ac594183d45c0939ee95bb098d (diff) |
use LIKELY/UNLIKELY macros for operations that run a lot.
Diffstat (limited to 'source/blender/python/mathutils/mathutils.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index a9a9ba8643c..e6be81f88a3 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -304,8 +304,9 @@ int Mathutils_RegisterCallback(Mathutils_Callback *cb) int _BaseMathObject_ReadCallback(BaseMathObject *self) { Mathutils_Callback *cb = mathutils_callbacks[self->cb_type]; - if (cb->get(self, self->cb_subtype) != -1) + if (LIKELY(cb->get(self, self->cb_subtype) != -1)) { return 0; + } if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, @@ -318,8 +319,9 @@ int _BaseMathObject_ReadCallback(BaseMathObject *self) int _BaseMathObject_WriteCallback(BaseMathObject *self) { Mathutils_Callback *cb = mathutils_callbacks[self->cb_type]; - if (cb->set(self, self->cb_subtype) != -1) + if (LIKELY(cb->set(self, self->cb_subtype) != -1)) { return 0; + } if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, @@ -332,8 +334,9 @@ int _BaseMathObject_WriteCallback(BaseMathObject *self) int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index) { Mathutils_Callback *cb = mathutils_callbacks[self->cb_type]; - if (cb->get_index(self, self->cb_subtype, index) != -1) + if (LIKELY(cb->get_index(self, self->cb_subtype, index) != -1)) { return 0; + } if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, @@ -346,8 +349,9 @@ int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index) int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index) { Mathutils_Callback *cb = mathutils_callbacks[self->cb_type]; - if (cb->set_index(self, self->cb_subtype, index) != -1) + if (LIKELY(cb->set_index(self, self->cb_subtype, index) != -1)) { return 0; + } if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, |