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

    r28241 r33648  
    5252  fclose (f);
    5353
     54# define DOSWAP(A,B) { char tmp = A; A = B; B = tmp; }
     55
    5456# ifdef BYTE_SWAP 
    5557  {
    5658    off_t i;
    5759    int perpix;
    58     unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
    59 
     60    unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7;
     61   
    6062    perpix = abs(header.bitpix) / 8;
    6163    if (perpix > 1) {
     
    7072      if (perpix == 2) {
    7173        for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
    72           ctmp = *byte0;
    73           *byte0 = *byte1;
    74           *byte1 = ctmp;
     74          DOSWAP(*byte0, *byte1);
    7575        }
    7676      }
    7777      if (perpix == 4) {
    7878        for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
    79           ctmp = *byte0;
    80           *byte0 = *byte3;
    81           *byte3 = ctmp;
    82           ctmp = *byte1;
    83           *byte1 = *byte2;
    84           *byte2 = ctmp;
     79          DOSWAP (*byte0, *byte3);
     80          DOSWAP (*byte1, *byte2);
    8581        }
    8682      }
    8783      if (perpix == 8) {
    8884        for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
    89           ctmp = *byte0;
    90           *byte0 = *byte7;
    91           *byte7 = ctmp;
    92           ctmp = *byte1;
    93           *byte1 = *byte6;
    94           *byte6 = ctmp;
    95           ctmp = *byte1;
    96           *byte2 = *byte5;
    97           *byte5 = ctmp;
    98           ctmp = *byte1;
    99           *byte3 = *byte4;
    100           *byte4 = ctmp;
     85          DOSWAP (*byte0, *byte7);
     86          DOSWAP (*byte1, *byte6);
     87          DOSWAP (*byte2, *byte5);
     88          DOSWAP (*byte3, *byte4);
    10189        }
    10290      }
Note: See TracChangeset for help on using the changeset viewer.