Changeset 37039 for trunk/Ohana/src/libfits/table/F_table_format.c
- Timestamp:
- Jul 17, 2014, 10:14:43 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libfits/table/F_table_format.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/table/F_table_format.c
r28241 r37039 19 19 if ((Nv == 0) && (Fchar == format)) Nv = 1; 20 20 21 // NOTE: X, L, B all are stored in 1-byte columns (X by default has at least room for 8 bits) 22 // I report these as type 'byte' as opposed to 'char', which is interpreted as a string 23 21 24 *Nbytes = 0; 22 25 switch (*Fchar) { 23 26 case 'X': 24 { *Nbytes = 1; strcpy (type, " char"); *Nval = 1 + (int) Nv / 8; }27 { *Nbytes = 1; strcpy (type, "byte"); *Nval = 1 + (int) Nv / 8; } 25 28 break; 26 29 case 'L': 27 { *Nbytes = 1; strcpy (type, " char"); *Nval = Nv; }30 { *Nbytes = 1; strcpy (type, "byte"); *Nval = Nv; } 28 31 break; 29 32 case 'A': … … 31 34 break; 32 35 case 'B': 33 { *Nbytes = 1; strcpy (type, " char"); *Nval = Nv; }36 { *Nbytes = 1; strcpy (type, "byte"); *Nval = Nv; } 34 37 break; 35 38 case 'I': … … 268 271 } 269 272 273 // Does it make sense to scale 'char' data (as opposed to 'byte')? 270 274 if (!strcmp (type, "char")) { 275 for (j = 0; j < Ny; j++) { 276 for (n = 0; n < Nval; n++) { 277 tmpChar = (char *)&ftable[0].buffer[j*Nx + n*Nbytes + off]; 278 *tmpChar = *tmpChar * tscale + tzero; 279 } 280 } 281 } 282 if (!strcmp (type, "byte")) { 271 283 for (j = 0; j < Ny; j++) { 272 284 for (n = 0; n < Nval; n++) { … … 352 364 } 353 365 366 // does this make sense? (see note above) 354 367 if (!strcmp (type, "char")) { 355 368 for (j = 0; j < Ny; j++) { … … 360 373 } 361 374 } 375 if (!strcmp (type, "byte")) { 376 for (j = 0; j < Ny; j++) { 377 for (n = 0; n < Nval; n++) { 378 tmpChar = (char *)&ftable[0].buffer[j*Nx + n*Nbytes + off]; 379 *tmpChar = (*tmpChar - tzero) / tscale; 380 } 381 } 382 } 362 383 if (!strcmp (type, "short")) { 363 384 for (j = 0; j < Ny; j++) {
Note:
See TracChangeset
for help on using the changeset viewer.
