MRPT  1.9.9
reverse_bytes.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://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:44
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:40
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:41
__int16 int16_t
Definition: rptypes.h:43
__int64 int64_t
Definition: rptypes.h:49
__int32 int32_t
Definition: rptypes.h:46
unsigned __int64 uint64_t
Definition: rptypes.h:50
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
Definition: rptypes.h:47



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020