octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MSVC compiler support [patch 22]: mx-op-defs additional macros


From: Michael Goffioul
Subject: MSVC compiler support [patch 22]: mx-op-defs additional macros
Date: Tue, 17 Oct 2006 21:54:58 +0200
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

Additional macros to "help" MSVC compiler when trying to find the correct
template (and avoid compiler crash)

Index: liboctave/mx-op-defs.h
===================================================================
RCS file: /cvs/octave/liboctave/mx-op-defs.h,v
retrieving revision 1.12
diff -p -c -r1.12 mx-op-defs.h
*** liboctave/mx-op-defs.h      26 Apr 2005 19:24:29 -0000      1.12
--- liboctave/mx-op-defs.h      17 Oct 2006 11:07:42 -0000
*************** class boolNDArray;
*** 541,546 ****
--- 541,594 ----
    NDS_CMP_OP (mx_el_eq, ==, ND,    , S,   ) \
    NDS_CMP_OP (mx_el_ne, !=, ND,    , S,   )
  
+ #define NDS_CMP_OP1(F, OP, ND, NDC, S, SC, SPEC) \
+   boolNDArray \
+   F (const ND& m, const S& s) \
+   { \
+     boolNDArray r; \
+  \
+     int len = m.length (); \
+  \
+     r.resize (m.dims ()); \
+  \
+     for (int i = 0; i < len; i++) \
+       r.elem(i) = operator OP <SPEC> (NDC (m.elem(i)), SC (s)); \
+  \
+     return r; \
+   }
+ 
+ #define NDS_CMP_OPS1(ND, NDC, S, SC, SPEC) \
+   NDS_CMP_OP1 (mx_el_lt, <,  ND, NDC, S, SC, SPEC) \
+   NDS_CMP_OP1 (mx_el_le, <=, ND, NDC, S, SC, SPEC) \
+   NDS_CMP_OP1 (mx_el_ge, >=, ND, NDC, S, SC, SPEC) \
+   NDS_CMP_OP1 (mx_el_gt, >,  ND, NDC, S, SC, SPEC) \
+   NDS_CMP_OP1 (mx_el_eq, ==, ND,    , S,   , SPEC) \
+   NDS_CMP_OP1 (mx_el_ne, !=, ND,    , S,   , SPEC)
+ 
+ #define NDS_CMP_OP2(F, OP, ND, NDC, S, SC, SPEC1, SPEC2) \
+   boolNDArray \
+   F (const ND& m, const S& s) \
+   { \
+     boolNDArray r; \
+  \
+     int len = m.length (); \
+  \
+     r.resize (m.dims ()); \
+  \
+     for (int i = 0; i < len; i++) \
+       r.elem(i) = operator OP <SPEC1,SPEC2> (NDC (m.elem(i)), SC (s)); \
+  \
+     return r; \
+   }
+ 
+ #define NDS_CMP_OPS2(ND, NDC, S, SC, SPEC1, SPEC2) \
+   NDS_CMP_OP2 (mx_el_lt, <,  ND, NDC, S, SC, SPEC1, SPEC2) \
+   NDS_CMP_OP2 (mx_el_le, <=, ND, NDC, S, SC, SPEC1, SPEC2) \
+   NDS_CMP_OP2 (mx_el_ge, >=, ND, NDC, S, SC, SPEC1, SPEC2) \
+   NDS_CMP_OP2 (mx_el_gt, >,  ND, NDC, S, SC, SPEC1, SPEC2) \
+   NDS_CMP_OP2 (mx_el_eq, ==, ND,    , S,   , SPEC1, SPEC2) \
+   NDS_CMP_OP2 (mx_el_ne, !=, ND,    , S,   , SPEC1, SPEC2)
+ 
  #define NDS_BOOL_OP_DECLS(ND, S) \
    NDBOOL_OP_DECL (mx_el_and, ND, S); \
    NDBOOL_OP_DECL (mx_el_or,  ND, S);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]