Index: trunk/Ohana/src/opihi/cmd.data/vbin.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/vbin.c	(revision 7917)
+++ trunk/Ohana/src/opihi/cmd.data/vbin.c	(revision 20936)
@@ -5,5 +5,5 @@
   int i, j, n, N, Nin, Nout;
   int Normalize, Ignore;
-  float *Vout, *Vin, IgnoreValue;
+  opihi_flt *Vout, IgnoreValue;
   double scale;
   Vector *in, *out;
@@ -42,22 +42,43 @@
   Nout = Nin / scale;
 
-  REALLOCATE (out[0].elements, float, Nout);
-  out[0].Nelements = Nout;
+  // re-binning creates a float vector
+  ResetVector (out, OPIHI_FLT, in[0].Nelements);
 
-  Vin  = in[0].elements;
-  Vout = out[0].elements;
-  for (n = j = 0; j < Nout; j++, Vout++) {
-    *Vout = 0;
-    for (N = i = 0; (i < scale) && (n < Nin); n++, i++, Vin++) {
-      if (!finite (*Vin)) continue;
-      if (Ignore && (*Vin == IgnoreValue)) continue;
-      *Vout += *Vin;
-      N ++;
-    } 
-    if (Normalize) {
-      if (N > 0) { 
-	*Vout /= (float) N; 
-      } else {
-	*Vout = 0;
+  Vout = out[0].elements.Flt;
+
+  if (in[0].type == OPIHI_FLT) {
+    opihi_flt *Vin  = in[0].elements.Flt;
+    for (n = j = 0; j < Nout; j++, Vout++) {
+      *Vout = 0;
+      for (N = i = 0; (i < scale) && (n < Nin); n++, i++, Vin++) {
+	if (!finite (*Vin)) continue;
+	if (Ignore && (*Vin == IgnoreValue)) continue;
+	*Vout += *Vin;
+	N ++;
+      } 
+      if (Normalize) {
+	if (N > 0) { 
+	  *Vout /= (opihi_flt) N; 
+	} else {
+	  *Vout = 0;
+	}
+      }
+    }
+  } else {
+    opihi_int *Vin  = in[0].elements.Int;
+    for (n = j = 0; j < Nout; j++, Vout++) {
+      *Vout = 0;
+      for (N = i = 0; (i < scale) && (n < Nin); n++, i++, Vin++) {
+	if (!finite (*Vin)) continue;
+	if (Ignore && (*Vin == IgnoreValue)) continue;
+	*Vout += *Vin;
+	N ++;
+      } 
+      if (Normalize) {
+	if (N > 0) { 
+	  *Vout /= (opihi_flt) N; 
+	} else {
+	  *Vout = 0;
+	}
       }
     }
