As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option.
Alternatively you can here view or download the uninterpreted source code file.
For more information about "Endian.c" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.21_Source_vs_1.22_Source.

1 /* 2 Legal Notice: Some portions of the source code contained in this file were 3 derived from the source code of TrueCrypt 7.1a, which is 4 Copyright (c) 2003-2012 TrueCrypt Developers Association and which is 5 governed by the TrueCrypt License 3.0, also from the source code of 6 Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux 7 and which is governed by the 'License Agreement for Encryption for the Masses' 8 Modifications and additions to the original source code (contained in this file) 9 and all other portions of this file are Copyright (c) 2013-2017 IDRIX 10 and are governed by the Apache License 2.0 the full text of which is 11 contained in the file License.txt included in VeraCrypt binary and source 12 code distribution packages. */ 13 14 #include "Tcdefs.h" 15 #include "Common/Endian.h" 16 17 18 unsigned __int16 MirrorBytes16 (unsigned __int16 x) 19 { 20 return (x << 8) | (x >> 8); 21 } 22 23 24 unsigned __int32 MirrorBytes32 (unsigned __int32 x) 25 { 26 unsigned __int32 n = (unsigned __int8) x; 27 n <<= 8; n |= (unsigned __int8) (x >> 8); 28 n <<= 8; n |= (unsigned __int8) (x >> 16); 29 return (n << 8) | (unsigned __int8) (x >> 24); 30 } 31 32 #ifndef TC_NO_COMPILER_INT64 33 uint64 MirrorBytes64 (uint64 x) 34 { 35 uint64 n = (unsigned __int8) x; 36 n <<= 8; n |= (unsigned __int8) (x >> 8); 37 n <<= 8; n |= (unsigned __int8) (x >> 16); 38 n <<= 8; n |= (unsigned __int8) (x >> 24); 39 n <<= 8; n |= (unsigned __int8) (x >> 32); 40 n <<= 8; n |= (unsigned __int8) (x >> 40); 41 n <<= 8; n |= (unsigned __int8) (x >> 48); 42 return (n << 8) | (unsigned __int8) (x >> 56); 43 } 44 #endif 45