SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
rtpendian.h
Go to the documentation of this file.
1 /*
2  * rtpendian.h
3  *
4  * Created on: Feb 27, 2018
5  * Author: f4exb
6  */
7 
8 #ifndef QRTPLIB_RTPENDIAN_H_
9 #define QRTPLIB_RTPENDIAN_H_
10 
11 #include <QtEndian>
12 
13 namespace qrtplib
14 {
15 
16 class RTPEndian
17 {
18 public:
20  {
21  uint32_t endianTest32 = 1;
22  uint8_t *ptr = (uint8_t*) &endianTest32;
23  m_isLittleEndian = (*ptr == 1);
24  }
25 
26  template<typename T>
27  T qToHost(const T& x) const
28  {
29  return m_isLittleEndian ? qToLittleEndian(x) : qToBigEndian(x);
30  }
31 
32 private:
34 };
35 
36 }
37 
38 #endif /* QRTPLIB_RTPENDIAN_H_ */
T qToHost(const T &x) const
Definition: rtpendian.h:27
unsigned int uint32_t
Definition: rtptypes_win.h:46
unsigned char uint8_t
Definition: rtptypes_win.h:42