forked from paparazzi/paparazzi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.c
36 lines (29 loc) · 781 Bytes
/
utils.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "utils.h"
#include <netinet/in.h>
//#include <simgear/io/lowlevel.hxx> // endian tests
void htond (double *x)
{
// if ( sgIsLittleEndian() ) {
int *Double_Overlay;
int Holding_Buffer;
Double_Overlay = (int *) x;
Holding_Buffer = Double_Overlay [0];
Double_Overlay [0] = htonl (Double_Overlay [1]);
Double_Overlay [1] = htonl (Holding_Buffer);
// } else {
// return;
// }
}
// Float version
void htonf (float *x)
{
// if ( sgIsLittleEndian() ) {
int *Float_Overlay;
int Holding_Buffer;
Float_Overlay = (int *) x;
Holding_Buffer = Float_Overlay [0];
Float_Overlay [0] = htonl (Holding_Buffer);
// } else {
// return;
// }
}