From 621d7cdbdb8861aade47585b48629a8a7c9a88d4 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 25 Mar 2009 21:56:52 -0700 Subject: [PATCH] CEP 516 in pure mode --- Cython/Shadow.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- 2.26.2