Index: /branches/eam_branches/20091201/Ohana/src/libfits/table/F_define_column.c
===================================================================
--- /branches/eam_branches/20091201/Ohana/src/libfits/table/F_define_column.c	(revision 26712)
+++ /branches/eam_branches/20091201/Ohana/src/libfits/table/F_define_column.c	(revision 26713)
@@ -23,8 +23,12 @@
   sprintf (field, "TFORM%d", Nfields);
   gfits_modify (header, field, "%s", 1, format);
-  sprintf (field, "TSCAL%d", Nfields);
-  gfits_modify (header, field, "%lf", 1, bscale);
-  sprintf (field, "TZERO%d", Nfields);
-  gfits_modify (header, field, "%lf", 1, bzero);
+
+  // add scaling parameters unless they amount to a noop
+  if ((bscale != 1.0) || (bzero != 0.0)) {
+      sprintf (field, "TSCAL%d", Nfields);
+      gfits_modify (header, field, "%lf", 1, bscale);
+      sprintf (field, "TZERO%d", Nfields);
+      gfits_modify (header, field, "%lf", 1, bzero);
+  }
 
   /* update TFIELDS & NAXIS1 */
Index: /branches/eam_branches/20091201/Ohana/src/libfits/table/F_get_column.c
===================================================================
--- /branches/eam_branches/20091201/Ohana/src/libfits/table/F_get_column.c	(revision 26712)
+++ /branches/eam_branches/20091201/Ohana/src/libfits/table/F_get_column.c	(revision 26713)
@@ -1,4 +1,5 @@
 # include <ohana.h>
 # include <gfitsio.h>
+#include <inttypes.h>
 # define SWAP_BYTE { \
   char tmp; \
@@ -93,4 +94,12 @@
     }
   }
+  if (!strcmp (type, "int64_t")) {
+    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
+# ifdef BYTE_SWAP
+      SWAP_DBLE;
+# endif
+      *(int64_t *)Pout = *(int64_t *)Pin*Bscale + Bzero;
+    }
+  }
   if (!strcmp (type, "float")) {
     for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
@@ -218,4 +227,12 @@
 # endif
       *(int *)Pout = *(int *)Pin*Bscale + Bzero;
+    }
+  }
+  if (!strcmp (type, "int64_t")) {
+    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
+# ifdef BYTE_SWAP
+      SWAP_DBLE;
+# endif
+      *(int64_t *)Pout = *(int64_t *)Pin*Bscale + Bzero;
     }
   }
@@ -349,4 +366,12 @@
     }
   }
+  if (!strcmp (type, "int64_t")) {
+    ALLOCATE (array, char, Ny*8);
+    Pout = array;
+    for (i = 0; i < Ny; i++, Pin+=Nx, Pout+=8) {
+      memcpy (line, Pin, Nval*Nbytes);
+      sscanf (line, "%" PRId64, (int64_t *)Pout);
+    }
+  }
   if (!strcmp (type, "float")) {
     ALLOCATE (array, char, Ny*4);
Index: /branches/eam_branches/20091201/Ohana/src/libfits/table/F_table_format.c
===================================================================
--- /branches/eam_branches/20091201/Ohana/src/libfits/table/F_table_format.c	(revision 26712)
+++ /branches/eam_branches/20091201/Ohana/src/libfits/table/F_table_format.c	(revision 26713)
@@ -17,16 +17,44 @@
 
   *Nbytes = 0;
-  if (*Fchar == 'X') { *Nbytes = 1;  strcpy (type, "char");   *Nval = 1 + (int) Nv / 8; }
-  if (*Fchar == 'L') { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
-  if (*Fchar == 'A') { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
-  if (*Fchar == 'B') { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
-  if (*Fchar == 'I') { *Nbytes = 2;  strcpy (type, "short");  *Nval = Nv;               }
-  if (*Fchar == 'J') { *Nbytes = 4;  strcpy (type, "int");    *Nval = Nv;               }
-  if (*Fchar == 'E') { *Nbytes = 4;  strcpy (type, "float");  *Nval = Nv;               }
-  if (*Fchar == 'D') { *Nbytes = 8;  strcpy (type, "double"); *Nval = Nv;               }
-  if (*Fchar == 'P') { *Nbytes = 8;  strcpy (type, "var");    *Nval = 2*Nv;             }
-  if (*Fchar == 'C') { *Nbytes = 8;  strcpy (type, "float");  *Nval = 2*Nv;             }
-  if (*Fchar == 'M') { *Nbytes = 16; strcpy (type, "double"); *Nval = 2*Nv;             }
-  if (!*Nbytes) { return (FALSE); }
+  switch (*Fchar) {
+  case  'X':
+    { *Nbytes = 1;  strcpy (type, "char");   *Nval = 1 + (int) Nv / 8; }
+    break;
+  case  'L':
+    { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
+    break;
+  case  'A':
+    { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
+    break;
+  case  'B':
+    { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
+    break;
+  case  'I':
+    { *Nbytes = 2;  strcpy (type, "short");  *Nval = Nv;               }
+    break;
+  case  'J':
+    { *Nbytes = 4;  strcpy (type, "int");    *Nval = Nv;               }
+    break;
+  case  'K':
+    { *Nbytes = 8;  strcpy (type, "int64_t"); *Nval = Nv;              }
+    break;
+  case  'E':
+    { *Nbytes = 4;  strcpy (type, "float");  *Nval = Nv;               }
+    break;
+  case  'D':
+    { *Nbytes = 8;  strcpy (type, "double"); *Nval = Nv;               }
+    break;
+  case  'P':
+    { *Nbytes = 8;  strcpy (type, "var");    *Nval = 2*Nv;             }
+    break;
+  case  'C':
+    { *Nbytes = 8;  strcpy (type, "float");  *Nval = 2*Nv;             }
+    break;
+  case  'M':
+    { *Nbytes = 16; strcpy (type, "double"); *Nval = 2*Nv;             }
+    break;
+  default:
+    return (FALSE);
+  }
 
   return (TRUE);
@@ -39,4 +67,5 @@
    I - 16 bit int
    J - 32 bit int
+   K - 64 bit int
    A - char
    E - float 
@@ -199,4 +228,5 @@
   short *tmpShort;
   int *tmpInt;
+  int64_t *tmpInt64;
 
   off = 0;
@@ -229,4 +259,8 @@
 	continue;
     }
+    if ((tscale == 1.0) && (tzero == 0.0)) {
+	off += Nchar; 
+	continue;
+    }
 
     if (!strcmp (type, "char"))   { 
@@ -252,4 +286,12 @@
 	  *tmpInt = *tmpInt * tscale + tzero;
 	}
+      }
+    }
+    if (!strcmp (type, "int64_t"))   { 
+      for (j = 0; j < Ny; j++) {
+        for (n = 0; n < Nval; n++) {
+          tmpInt64 = (int64_t *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
+          *tmpInt64 = *tmpInt64 * tscale + tzero;
+        }
       }
     }
@@ -269,4 +311,5 @@
   short *tmpShort;
   int *tmpInt;
+  int64_t *tmpInt64;
 
   off = 0;
@@ -299,4 +342,8 @@
 	continue;
     }
+    if ((tscale == 1.0) && (tzero == 0.0)) {
+	off += Nchar; 
+	continue;
+    }
 
     if (!strcmp (type, "char"))   { 
@@ -324,4 +371,12 @@
       }
     }
+    if (!strcmp (type, "int64_t"))   { 
+      for (j = 0; j < Ny; j++) {
+	for (n = 0; n < Nval; n++) {
+	  tmpInt64 = (int64_t *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
+	  *tmpInt64 = *tmpInt64 * tscale + tzero;
+	}
+      }
+    }
     off += Nchar;
   }
