source: lmdz_wrf/WRFV3/external/io_grib1/MEL_grib1/swap.c @ 1

Last change on this file since 1 was 1, checked in by lfita, 10 years ago
  • -- --- Opening of the WRF+LMDZ coupling repository --- -- -

WRF: version v3.3
LMDZ: version v1818

More details in:

File size: 389 bytes
Line 
1#include <stdio.h>
2#include <stdlib.h>
3void *swap_byte4(long *theInt)
4{
5  char tmp[4];
6  int i;
7
8  for (i=0; i<sizeof(long); i++) 
9    tmp[i] = *((char*)theInt+(sizeof(long)-1-i));
10
11  *theInt=*((long *)tmp);
12
13}
14
15void *swap_byte2(short *theInt)
16{
17  char tmp[4];
18  int i;
19
20  for (i=0; i<sizeof(short); i++) 
21    tmp[i] = *((char*)theInt+(sizeof(short)-1-i));
22
23  *theInt=*((short *)tmp);
24}
Note: See TracBrowser for help on using the repository browser.