MRPT  1.9.9
reverse_bytes.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <cstdint>
12 
13 namespace mrpt
14 {
15 /** \addtogroup mrpt_core_grp
16  * @{ */
17 
18 /** Reverse the order of the bytes of a given type (useful for transforming btw
19  * little/big endian) */
20 void reverseBytesInPlace(bool& v_in_out);
21 void reverseBytesInPlace(uint8_t& v_in_out);
22 void reverseBytesInPlace(int8_t& v_in_out);
23 void reverseBytesInPlace(uint16_t& v_in_out);
24 void reverseBytesInPlace(int16_t& v_in_out);
25 void reverseBytesInPlace(uint32_t& v_in_out);
26 void reverseBytesInPlace(int32_t& v_in_out);
27 void reverseBytesInPlace(uint64_t& v_in_out);
28 void reverseBytesInPlace(int64_t& v_in_out);
29 void reverseBytesInPlace(float& v_in_out);
30 void reverseBytesInPlace(double& v_in_out);
31 void reverseBytesInPlace(long double& v_in_out);
32 
33 /** Reverse the order of the bytes of a given type (useful for transforming btw
34  * little/big endian) */
35 template <class T>
36 inline void reverseBytes(const T& v_in, T& v_out)
37 {
38  v_out = v_in;
39  reverseBytesInPlace(v_out);
40 }
41 /** @} */
42 } // namespace mrpt
unsigned __int16 uint16_t
Definition: rptypes.h:47
void reverseBytes(const T &v_in, T &v_out)
Reverse the order of the bytes of a given type (useful for transforming btw little/big endian) ...
Definition: reverse_bytes.h:36
signed char int8_t
Definition: rptypes.h:43
void reverseBytesInPlace(bool &v_in_out)
Reverse the order of the bytes of a given type (useful for transforming btw little/big endian) ...
unsigned char uint8_t
Definition: rptypes.h:44
__int16 int16_t
Definition: rptypes.h:46
__int64 int64_t
Definition: rptypes.h:52
__int32 int32_t
Definition: rptypes.h:49
unsigned __int64 uint64_t
Definition: rptypes.h:53
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
Definition: rptypes.h:50



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019