From 6ab88618f9c713ebbd3d4f017db101fd670b1c3d Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 20 Jan 2013 17:36:39 +0100 Subject: [PATCH] suppress C compiler warning on power operation on unsigned C int types --- Cython/Compiler/ExprNodes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index d3f968b..095c322 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -8438,8 +8438,10 @@ class PowNode(NumBinopNode): else: self.pow_func = "__Pyx_pow_%s" % self.type.declaration_code('').replace(' ', '_') env.use_utility_code( - int_pow_utility_code.specialize(func_name=self.pow_func, - type=self.type.declaration_code(''))) + int_pow_utility_code.specialize( + func_name=self.pow_func, + type=self.type.declaration_code(''), + signed=self.type.signed and 1 or 0)) def calculate_result_code(self): # Work around MSVC overloading ambiguity. @@ -10055,7 +10057,9 @@ static CYTHON_INLINE %(type)s %(func_name)s(%(type)s b, %(type)s e) { case 0: return 1; } + #if %(signed)s if (unlikely(e<0)) return 0; + #endif t = 1; while (likely(e)) { t *= (b * (e&1)) | ((~e)&1); /* 1 or b */ -- 2.7.4