IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 7, 2015, 11:42:53 AM (11 years ago)
Author:
eugene
Message:

add some more error checking and a timing test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/libfits/matrix/F_matrix.c

    r38329 r38425  
    11# include <ohana.h>
    22# include <gfitsio.h>
    3 
    4 off_t gfits_data_size (Header *header) {
    5  
    6   int i;
    7   off_t Nrec, size;
    8 
    9   if (header[0].Naxes == 0) return (0);
    10 
    11   size = abs(header[0].bitpix / 8);
    12 
    13   for (i = 0; i < header[0].Naxes; i++)
    14     size *= header[0].Naxis[i];
    15 
    16   // XXX do I multiply this times gcount?
    17   size += header[0].pcount;
    18 
    19   /* round up to next complete block */
    20   if (size % FT_RECORD_SIZE) {
    21     Nrec = 1 + (int) (size / FT_RECORD_SIZE);
    22     size = FT_RECORD_SIZE * Nrec;
    23   }
    24 
    25   return (size);
    26 }
    273
    284off_t gfits_heap_start (Header *header) {
     
    4319off_t gfits_data_min_size (Header *header) {
    4420 
    45   int i;
    46   off_t size;
     21  off_t size = gfits_heap_start (header);
     22  size += header[0].pcount;
    4723
    48   if (header[0].Naxes == 0) return (0);
    49 
    50   size = abs(header[0].bitpix / 8);
    51 
    52   for (i = 0; i < header[0].Naxes; i++)
    53     size *= header[0].Naxis[i];
    54 
    55   // XXX do I multiply this times gcount?
    56   size += header[0].pcount;
     24  // XXX what do I do with gcount?
    5725
    5826  return (size);
     
    6129off_t gfits_data_pad_size (off_t rawsize) {
    6230 
    63   off_t Nrec, size;
    64 
    65   size = rawsize;
     31  off_t size = rawsize;
    6632
    6733  /* round up to next complete block */
    6834  if (rawsize % FT_RECORD_SIZE) {
    69     Nrec = 1 + (int) (rawsize / FT_RECORD_SIZE);
     35    off_t Nrec = 1 + (int) (rawsize / FT_RECORD_SIZE);
    7036    size = FT_RECORD_SIZE * Nrec;
    7137  }
     
    7339  return (size);
    7440}
     41
     42off_t gfits_data_size (Header *header) {
     43  off_t rawsize = gfits_data_min_size(header);
     44  off_t size = gfits_data_pad_size (rawsize);
     45
     46  return (size);
     47}
     48
Note: See TracChangeset for help on using the changeset viewer.