summaryrefslogtreecommitdiff
path: root/trunk/users/metalab/GCode_Interpreter_SD/byteordering.cpp
blob: fd99225b5723a6cc3a3d75fb768689b514da8c8d (plain)
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
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

/*
 * Copyright (c) 2006-2008 by Roland Riegel <feedback@roland-riegel.de>
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of either the GNU General Public License version 2
 * or the GNU Lesser General Public License version 2.1, both as
 * published by the Free Software Foundation.
 */

#include "byteordering.h"

/**
 * \addtogroup byteordering
 *
 * Architecture-dependent handling of byte-ordering.
 *
 * @{
 */
/**
 * \file
 * Byte-order handling implementation (license: GPLv2 or LGPLv2.1)
 *
 * \author Roland Riegel
 */

#if DOXYGEN || !(LITTLE_ENDIAN || __AVR__)
/**
 * Converts a 16-bit integer to little-endian byte order.
 *
 * Use this function on variable values instead of the
 * macro HTOL16(). This saves code size.
 *
 * \param[in] h A 16-bit integer in host byte order.
 * \returns The given 16-bit integer converted to little-endian byte order.
 */
uint16_t htol16(uint16_t h)
{
    return HTOL16(h);
}
#endif

#if DOXYGEN || !(LITTLE_ENDIAN || __AVR__)
/**
 * Converts a 32-bit integer to little-endian byte order.
 *
 * Use this function on variable values instead of the
 * macro HTOL32(). This saves code size.
 *
 * \param[in] h A 32-bit integer in host byte order.
 * \returns The given 32-bit integer converted to little-endian byte order.
 */
uint32_t htol32(uint32_t h)
{
    return HTOL32(h);
}
#endif

/**
 * @}
 */