]> icculus.org git repositories - icculus/xz.git/blob - src/liblzma/check/crc_macros.h
Remove lzma_init() and other init functions from liblzma API.
[icculus/xz.git] / src / liblzma / check / crc_macros.h
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       crc_macros
4 /// \brief      Some endian-dependent macros for CRC32 and CRC64
5 //
6 //  This code has been put into the public domain.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #ifdef WORDS_BIGENDIAN
15 #       include "../../common/bswap.h"
16
17 #       define A(x) ((x) >> 24)
18 #       define B(x) (((x) >> 16) & 0xFF)
19 #       define C(x) (((x) >> 8) & 0xFF)
20 #       define D(x) ((x) & 0xFF)
21
22 #       define S8(x) ((x) << 8)
23 #       define S32(x) ((x) << 32)
24
25 #else
26 #       define A(x) ((x) & 0xFF)
27 #       define B(x) (((x) >> 8) & 0xFF)
28 #       define C(x) (((x) >> 16) & 0xFF)
29 #       define D(x) ((x) >> 24)
30
31 #       define S8(x) ((x) >> 8)
32 #       define S32(x) ((x) >> 32)
33 #endif