Index: trunk/psLib/src/math/psBinaryOp.c
===================================================================
--- trunk/psLib/src/math/psBinaryOp.c	(revision 6885)
+++ trunk/psLib/src/math/psBinaryOp.c	(revision 7189)
@@ -30,6 +30,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-04-18 22:04:28 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-05-23 23:43:18 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -325,4 +325,44 @@
 }
 
+
+// Preprocessor macro function to create arithmetic function based on input type for integers only
+#define BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,OP,IN2)                                                        \
+switch (IN1->type) {                                                                                         \
+case PS_TYPE_U8:                                                                                             \
+    DIM1##_##DIM2(OUT,IN1,OP,IN2,U8);                                                                        \
+    break;                                                                                                   \
+case PS_TYPE_U16:                                                                                            \
+    DIM1##_##DIM2(OUT,IN1,OP,IN2,U16);                                                                       \
+    break;                                                                                                   \
+case PS_TYPE_U32:                                                                                            \
+    DIM1##_##DIM2(OUT,IN1,OP,IN2,U32);                                                                       \
+    break;                                                                                                   \
+case PS_TYPE_U64:                                                                                            \
+    DIM1##_##DIM2(OUT,IN1,OP,IN2,U64);                                                                       \
+    break;                                                                                                   \
+case PS_TYPE_S8:                                                                                             \
+    DIM1##_##DIM2(OUT,IN1,OP,IN2,S8);                                                                        \
+    break;                                                                                                   \
+case PS_TYPE_S16:                                                                                            \
+    DIM1##_##DIM2(OUT,IN1,OP,IN2,S16);                                                                       \
+    break;                                                                                                   \
+case PS_TYPE_S32:                                                                                            \
+    DIM1##_##DIM2(OUT,IN1,OP,IN2,S32);                                                                       \
+    break;                                                                                                   \
+case PS_TYPE_S64:                                                                                            \
+    DIM1##_##DIM2(OUT,IN1,OP,IN2,S64);                                                                       \
+    break;                                                                                                   \
+default:                                                                                                     \
+    /* char* strType;                                                                                        \
+    PS_TYPE_NAME(strType,IN1->type);                                                                         \
+    psError(PS_ERR_BAD_PARAMETER_TYPE, true,                                                                 \
+            PS_ERRORTEXT_psMatrix_TYPE_MISMATCH,                                                             \
+            strType);  */                                                                                    \
+    if (OUT != IN1 && OUT != IN2) {                                                                          \
+        psFree(OUT);                                                                                         \
+    }                                                                                                        \
+    return NULL;                                                                                             \
+}
+
 // Preprocessor macro function to create arithmetic function based on input type
 #define BINARY_TYPE(DIM1,DIM2,OUT,IN1,OP,IN2)                                                                \
@@ -365,9 +405,9 @@
     break;                                                                                                   \
 default:                                                                                                     \
-    /* char* strType; \
+    /* char* strType;                                                                                        \
     PS_TYPE_NAME(strType,IN1->type);                                                                         \
     psError(PS_ERR_BAD_PARAMETER_TYPE, true,                                                                 \
             PS_ERRORTEXT_psMatrix_TYPE_MISMATCH,                                                             \
-            strType);  */                                                                                      \
+            strType);  */                                                                                    \
     if (OUT != IN1 && OUT != IN2) {                                                                          \
         psFree(OUT);                                                                                         \
@@ -388,4 +428,20 @@
 } else if(!strncmp(OP, "/", 1)) {                                                                            \
     BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 / *i2,IN2);                                                            \
+} else if(!strncmp(OP, "&", 1)) {                                                                            \
+    if (PS_IS_PSELEMTYPE_INT(IN1->type) && PS_IS_PSELEMTYPE_INT(IN2->type)) {                                \
+        BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,(*i1) & (*i2),IN2);                                            \
+    } else {                                                                                                 \
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,                                                            \
+                "Types (%x,%x) are not appropriate for logical AND.\n", IN1->type, IN2->type);               \
+        return NULL;                                                                                         \
+    }                                                                                                        \
+} else if(!strncmp(OP, "|", 1)) {                                                                            \
+    if (PS_IS_PSELEMTYPE_INT(IN1->type) && PS_IS_PSELEMTYPE_INT(IN2->type)) {                                \
+        BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,(*i1) | (*i2),IN2);                                            \
+    } else {                                                                                                 \
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,                                                            \
+                "Types (%x,%x) are not appropriate for logical OR.\n", IN1->type, IN2->type);                \
+        return NULL;                                                                                         \
+    }                                                                                                        \
 } else if(!strncmp(OP, "^", 1)) {                                                                            \
     if(PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) {                                                                \
