IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2012, 2:22:08 PM (14 years ago)
Author:
eugene
Message:

fix byteswap error for 64bit tables (simplify byteswap code generally to clean up); add function to get type of specified column by seq number; defaults for Bzero and Bscale in tables without temp (0.0,1.0); function to set a bintable column from a vector of different type; better error handling for F_print,F_modify

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/matrix/F_read_segment.c

    r28241 r33648  
    9595  matrix[0].datasize = Nbytes;
    9696
     97# define DOSWAP(A,B) { char tmp = A; A = B; B = tmp; }
     98
    9799# ifdef BYTE_SWAP 
    98100 {
    99   unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
     101  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7;
    100102  int perpix;
    101103
     
    112114    if (perpix == 2) {
    113115      for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
    114         ctmp = *byte0;
    115         *byte0 = *byte1;
    116         *byte1 = ctmp;
     116        DOSWAP(*byte0, *byte1);
    117117      }
    118118    }
    119119    if (perpix == 4) {
    120120      for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
    121         ctmp = *byte0;
    122         *byte0 = *byte3;
    123         *byte3 = ctmp;
    124         ctmp = *byte1;
    125         *byte1 = *byte2;
    126         *byte2 = ctmp;
     121        DOSWAP (*byte0, *byte3);
     122        DOSWAP (*byte1, *byte2);
    127123      }
    128124    }
    129125    if (perpix == 8) {
    130126      for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
    131         ctmp = *byte0;
    132         *byte0 = *byte7;
    133         *byte7 = ctmp;
    134         ctmp = *byte1;
    135         *byte1 = *byte6;
    136         *byte6 = ctmp;
    137         ctmp = *byte1;
    138         *byte2 = *byte5;
    139         *byte5 = ctmp;
    140         ctmp = *byte1;
    141         *byte3 = *byte4;
    142         *byte4 = ctmp;
     127        DOSWAP (*byte0, *byte7);
     128        DOSWAP (*byte1, *byte6);
     129        DOSWAP (*byte2, *byte5);
     130        DOSWAP (*byte3, *byte4);
    143131      }
    144132    }
Note: See TracChangeset for help on using the changeset viewer.