source: trunk/WRF.COMMON/WRFV3/external/io_grib1/MEL_grib1/swap.c @ 2759

Last change on this file since 2759 was 2759, checked in by aslmd, 2 years ago

adding unmodified code from WRFV3.0.1.1, expurged from useless data +1M size

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.