OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
swapc_bytes.c
Go to the documentation of this file.
1 #include <string.h>
2 #include <stdlib.h>
3 
4 int swapc_bytes(char *in, int nbyte, int ntime) {
5  char *tmpbuf, *ptr;
6  int i, j, k;
7 
8  tmpbuf = (char *) malloc(nbyte);
9  ptr = in;
10 
11  for (j = 0; j < ntime; j++) {
12  for (i = 0, k = nbyte - 1; i < nbyte; i++, k--)
13  tmpbuf[i] = ptr[k];
14 
15  memcpy(ptr, tmpbuf, nbyte);
16 
17  ptr += nbyte;
18  }
19  free(tmpbuf);
20 
21  return 0;
22 }
23 
24 int swapc_bytes2(const char *in, char *out, int nbyte, int ntime) {
25  const char *ptr;
26  char *ptr2;
27  int i, j, k;
28 
29  ptr = in;
30  ptr2 = out;
31 
32  for (j = 0; j < ntime; j++) {
33  for (i = 0, k = nbyte - 1; i < nbyte; i++, k--)
34  ptr2[i] = ptr[k];
35 
36  ptr += nbyte;
37  ptr2 += nbyte;
38  }
39 
40  return 0;
41 }
int j
Definition: decode_rs.h:73
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed as required for compatibility with version of the SDP toolkit Corrected test output file names to end in out
Definition: HISTORY.txt:422
int swapc_bytes2(const char *in, char *out, int nbyte, int ntime)
Definition: swapc_bytes.c:24
int swapc_bytes(char *in, int nbyte, int ntime)
Definition: swapc_bytes.c:4
int i
Definition: decode_rs.h:71
int k
Definition: decode_rs.h:73