summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/mathop.h
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/mathop.h')
-rw-r--r--Build/source/utils/asymptote/mathop.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/mathop.h b/Build/source/utils/asymptote/mathop.h
index 572a9f7ee1b..1fda216e592 100644
--- a/Build/source/utils/asymptote/mathop.h
+++ b/Build/source/utils/asymptote/mathop.h
@@ -247,6 +247,16 @@ struct mod {
};
template <typename T>
+struct quotient {
+ T operator() (T x, T y, size_t i=0) {
+ if(y == 0) dividebyzero(i);
+ if(y == -1) return Negate(x);
+// Implementation-independent definition of integer division: round down
+ return (x-portableMod(x,y))/y;
+ }
+};
+
+template <typename T>
struct min {
T operator() (T x, T y, size_t=0) {return x < y ? x : y;}
};