Aufgrund einer Wartung wird GitLab am 19.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 19.10. between 8:00 and 9:00 am.

ITAEndianness.h 2.44 KB
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
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
/*
* ----------------------------------------------------------------
*
*		ITA core libs
*		(c) Copyright Institute of Technical Acoustics (ITA)
*		RWTH Aachen University, Germany, 2015-2016
*
* ----------------------------------------------------------------
*				    ____  __________  _______
*				   //  / //__   ___/ //  _   |
*				  //  /    //  /    //  /_|  |
*				 //  /    //  /    //  ___   |
*				//__/    //__/    //__/   |__|
*
* ----------------------------------------------------------------
*
*/
// $Id: ITAEndianness.h 3828 2014-11-27 10:43:43Z fwefers $

#ifndef INCLUDE_WATCHER_ITA_ENDIANNESS
#define INCLUDE_WATCHER_ITA_ENDIANNESS

// ITABase
#include <ITABaseDefinitions.h>

js908001's avatar
js908001 committed
26
27
#include <stddef.h>

Jonas Stienen's avatar
Jonas Stienen committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! Literals for Endianness
enum ITA_BASE_API
{
	ITA_LITTLE_ENDIAN = 0,
	ITA_BIG_ENDIAN = 1
};

int ITA_BASE_API GetEndianness();

/**
 * Byte-Swapping functions, swaping order of bytes to convert between endianness
 */

//! Byte-order swap for 2-Byte (16-Bit) fields
void ITA_BASE_API byteswap_2byte(void* src, size_t count);

//! Byte-order swap for 4-Byte (32-Bit) fields
void ITA_BASE_API byteswap_4byte(void* src, size_t count);

//! Byte-order swap for 8-Byte (64-Bit) fields
void ITA_BASE_API byteswap_8byte(void* src, size_t count);

//! Byte-order swap for 16-Byte (128-Bit) fields
void ITA_BASE_API byteswap_16byte(void* src, size_t count);

/**
 * Endianness-Converter
 */

//! Little endian -> System endianness for 2-Byte (16-Bit) fields
ITA_BASE_API extern void(*le2se_2byte)(void* src, size_t count);

//! Little endian -> System endianness for 4-Byte (32-Bit) fields
ITA_BASE_API extern void(*le2se_4byte)(void* src, size_t count);

//! Little endian -> System endianness for 8-Byte (64-Bit) fields
ITA_BASE_API extern void(*le2se_8byte)(void* src, size_t count);

//! Little endian -> System endianness for 16-Byte (128-Bit) fields
ITA_BASE_API extern void(*le2se_16byte)(void* src, size_t count);

//! Big endian -> System endianness for 2-Byte (16-Bit) fields
ITA_BASE_API extern void(*be2se_2byte)(void* src, size_t count);

//! Big endian -> System endianness f�r 4-Byte (32-Bit) fields
ITA_BASE_API extern void(*be2se_4byte)(void* src, size_t count);

//! Big endian -> System endianness f�r 8-Byte (64-Bit) fields
ITA_BASE_API extern void(*be2se_8byte)(void* src, size_t count);

//! Big endian -> System endianness f�r 16-Byte (128-Bit) fields
ITA_BASE_API extern void(*be2se_16byte)(void* src, size_t count);

#endif // INCLUDE_WATCHER_ITA_ENDIANNESS