/usr/include/x86_64-linux-gnu/winpr/endian.h is in libwinpr-dev 1.1.0~git20140921.1.440916e+dfsg1-13+deb9u3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | /*
* WinPR: Windows Portable Runtime
* Endianness Macros
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_ENDIAN_H
#define WINPR_ENDIAN_H
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/platform.h>
#ifdef __cplusplus
extern "C" {
#endif
#define Data_Read_UINT8_NE(_d, _v) do { _v = \
*_d; } while (0)
#define Data_Read_UINT8(_d, _v) do { _v = \
*_d; } while (0)
#define Data_Read_UINT16_NE(_d, _v) do { _v = \
*((UINT16*) _d); } while (0)
#define Data_Read_UINT16(_d, _v) do { _v = \
(UINT16)(*_d) + \
(((UINT16)(*(_d))) << 8); \
} while (0)
#define Data_Read_UINT16_BE(_d, _v) do { _v = \
(((UINT16)(*_d)) << 8) + \
(UINT16)(*(_d + 1)); \
} while (0)
#define Data_Read_UINT32_NE(_d, _v) do { _v = \
*((UINT32*) _d); } while (0)
#define Data_Read_UINT32(_d, _v) do { _v = \
(UINT32)(*_d) + \
(((UINT32)(*(_d + 1))) << 8) + \
(((UINT32)(*(_d + 2))) << 16) + \
(((UINT32)(*(_d + 3))) << 24); \
} while (0)
#define Data_Read_UINT32_BE(_d, _v) do { _v = \
(((UINT32)(*(_d))) << 24) + \
(((UINT32)(*(_d + 1))) << 16) + \
(((UINT32)(*(_d + 2))) << 8) + \
(((UINT32)(*(_d + 3)))); \
} while (0)
#define Data_Read_UINT64_NE(_d, _v) do { _v = \
*((UINT64*) _d); } while (0)
#define Data_Read_UINT64(_d, _v) do { _v = \
(UINT64)(*_d) + \
(((UINT64)(*(_d + 1))) << 8) + \
(((UINT64)(*(_d + 2))) << 16) + \
(((UINT64)(*(_d + 3))) << 24) + \
(((UINT64)(*(_d + 4))) << 32) + \
(((UINT64)(*(_d + 5))) << 40) + \
(((UINT64)(*(_d + 6))) << 48) + \
(((UINT64)(*(_d + 7))) << 56); \
} while (0)
#define Data_Write_UINT8_NE(_d, _v) do { \
*((UINT8*) _d) = v; } while (0)
#define Data_Write_UINT8(_d, _v) do { \
*_d = (UINT8)(_v); } while (0)
#define Data_Write_UINT16_NE(_d, _v) do { \
*((UINT16*) _d) = _v; } while (0)
#define Data_Write_UINT16(_d, _v) do { \
*(_d) = (_v) & 0xFF; \
*(_d + 1) = ((_v) >> 8) & 0xFF; \
} while (0)
#define Data_Write_UINT16_BE(_d, _v) do { \
*(_d) = ((_v) >> 8) & 0xFF; \
*(_d + 1) = (_v) & 0xFF; \
} while (0)
#define Data_Write_UINT32_NE(_d, _v) do { \
*((UINT32*) _d) = _v; } while (0)
#define Data_Write_UINT32(_d, _v) do { \
*((BYTE *) _d) = (_v) & 0xFF; \
*((BYTE *) _d + 1) = ((_v) >> 8) & 0xFF; \
*((BYTE *) _d + 2) = ((_v) >> 16) & 0xFF; \
*((BYTE *) _d + 3) = ((_v) >> 24) & 0xFF; \
} while (0)
#define Data_Write_UINT32_BE(_d, _v) do { \
Data_Write_UINT16_BE(_d, ((_v) >> 16 & 0xFFFF)); \
Data_Write_UINT16_BE(_d + 2, ((_v) & 0xFFFF)); \
} while (0)
#define Data_Write_UINT64_NE(_d, _v) do { \
*((UINT64*) _d) = _v; } while (0)
#define Data_Write_UINT64(_d, _v) do { \
*(_d) = (UINT64)(_v) & 0xFF; \
*(_d + 1) = ((UINT64)(_v) >> 8) & 0xFF; \
*(_d + 2) = ((UINT64)(_v) >> 16) & 0xFF; \
*(_d + 3) = ((UINT64)(_v) >> 24) & 0xFF; \
*(_d + 4) = ((UINT64)(_v) >> 32) & 0xFF; \
*(_d + 5) = ((UINT64)(_v) >> 40) & 0xFF; \
*(_d + 6) = ((UINT64)(_v) >> 48) & 0xFF; \
*(_d + 7) = ((UINT64)(_v) >> 56) & 0xFF; \
} while (0)
#ifdef __cplusplus
}
#endif
#endif /* WINPR_ENDIAN_H */
|