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_load_M.c

    r28241 r33648  
    3838  }
    3939
     40# define DOSWAP(A,B) { char tmp = A; A = B; B = tmp; }
     41
    4042# ifdef BYTE_SWAP 
    4143 {
    4244  int perpix;
    43   unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
     45  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7;
    4446
    4547  perpix = abs(header[0].bitpix) / 8;
     
    5557    if (perpix == 2) {
    5658      for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
    57         tmp = *byte0;
    58         *byte0 = *byte1;
    59         *byte1 = tmp;
     59        DOSWAP(*byte0, *byte1);
    6060      }
    6161    }
    6262    if (perpix == 4) {
    6363      for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
    64         tmp = *byte0;
    65         *byte0 = *byte3;
    66         *byte3 = tmp;
    67         tmp = *byte1;
    68         *byte1 = *byte2;
    69         *byte2 = tmp;
     64        DOSWAP (*byte0, *byte3);
     65        DOSWAP (*byte1, *byte2);
    7066      }
    7167    }
    7268    if (perpix == 8) {
    7369      for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
    74         tmp = *byte0;
    75         *byte0 = *byte7;
    76         *byte7 = tmp;
    77         tmp = *byte1;
    78         *byte1 = *byte6;
    79         *byte6 = tmp;
    80         tmp = *byte1;
    81         *byte2 = *byte5;
    82         *byte5 = tmp;
    83         tmp = *byte1;
    84         *byte3 = *byte4;
    85         *byte4 = tmp;
     70        DOSWAP (*byte0, *byte7);
     71        DOSWAP (*byte1, *byte6);
     72        DOSWAP (*byte2, *byte5);
     73        DOSWAP (*byte3, *byte4);
    8674      }
    8775    }
Note: See TracChangeset for help on using the changeset viewer.