From: Robert Bradshaw Date: Thu, 26 Mar 2009 04:56:52 +0000 (-0700) Subject: CEP 516 in pure mode X-Git-Tag: 0.11.1.alpha~32 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=621d7cdbdb8861aade47585b48629a8a7c9a88d4;p=cython.git CEP 516 in pure mode --- diff --git a/Cython/Shadow.py b/Cython/Shadow.py index c6c1a777..1fe9dc19 100644 --- a/Cython/Shadow.py +++ b/Cython/Shadow.py @@ -6,6 +6,19 @@ def empty_decorator(x): def locals(**arg_types): return empty_decorator +# Special functions + +def cdiv(a, b): + q = a / b + if q < 0: + q += 1 + +def cmod(a, b): + r = a % b + if (a*b) < 0: + r -= b + return r + # Emulated language constructs