summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/arrayop.h
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-07-03 00:02:22 +0000
committerKarl Berry <karl@freefriends.org>2009-07-03 00:02:22 +0000
commitc20b61928150008d080bab09e967fcaebc93da81 (patch)
treebffa7c8765003c0e8f2a40c72479e5caa6f748bd /Build/source/utils/asymptote/arrayop.h
parent9ec802a431dfe1b27063bac2f8dd9bc58cf997b0 (diff)
asy 1.79
git-svn-id: svn://tug.org/texlive/trunk@14078 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/arrayop.h')
-rw-r--r--Build/source/utils/asymptote/arrayop.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/arrayop.h b/Build/source/utils/asymptote/arrayop.h
index eed2d9ed4ab..6500bfbe7f0 100644
--- a/Build/source/utils/asymptote/arrayop.h
+++ b/Build/source/utils/asymptote/arrayop.h
@@ -162,6 +162,40 @@ void binopArray3(vm::stack *s)
}
template<class T>
+bool Array2Equals(vm::stack *s)
+{
+ array *b=pop<array*>(s);
+ array *a=pop<array*>(s);
+ size_t n=checkArray(a);
+ if(n != checkArray(b)) return false;
+ if(n == 0) return true;
+ size_t n0=checkArray(read<array*>(a,0));
+ if(n0 != checkArray(read<array*>(b,0))) return false;
+
+ for(size_t i=0; i < n; ++i) {
+ array *ai=read<array*>(a,i);
+ array *bi=read<array*>(b,i);
+ for(size_t j=0; j < n0; ++j) {
+ if(read<T>(ai,j) != read<T>(bi,j))
+ return false;
+ }
+ }
+ return true;
+}
+
+template<class T>
+void array2Equals(vm::stack *s)
+{
+ s->push(Array2Equals<T>(s));
+}
+
+template<class T>
+void array2NotEquals(vm::stack *s)
+{
+ s->push(!Array2Equals<T>(s));
+}
+
+template<class T>
struct compare {
bool operator() (const vm::item& a, const vm::item& b)
{