source: trunk/WRF.COMMON/WRFV2/external/io_grib1/MEL_grib1/swap.c @ 2756

Last change on this file since 2756 was 11, checked in by aslmd, 14 years ago

spiga@svn-planeto:ajoute le modele meso-echelle martien

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.