OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #ifndef CRASHPAD_UTIL_NUMERIC_INT128_H_ | 15 #ifndef CRASHPAD_UTIL_NUMERIC_INT128_H_ |
16 #define CRASHPAD_UTIL_NUMERIC_INT128_H_ | 16 #define CRASHPAD_UTIL_NUMERIC_INT128_H_ |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 | 19 |
20 #include "base/basictypes.h" | |
21 #include "build/build_config.h" | 20 #include "build/build_config.h" |
22 | 21 |
23 namespace crashpad { | 22 namespace crashpad { |
24 | 23 |
25 //! \brief Stores a 128-bit quantity. | 24 //! \brief Stores a 128-bit quantity. |
26 //! | 25 //! |
27 //! This structure is organized so that 128-bit quantities are laid out in | 26 //! This structure is organized so that 128-bit quantities are laid out in |
28 //! memory according to the system’s natural byte order. If a system offers a | 27 //! memory according to the system’s natural byte order. If a system offers a |
29 //! native 128-bit type, it should be possible to bit_cast<> between that type | 28 //! native 128-bit type, it should be possible to bit_cast<> between that type |
30 //! and this one. | 29 //! and this one. |
31 //! | 30 //! |
32 //! This structure is designed to have the same layout, although not the same | 31 //! This structure is designed to have the same layout, although not the same |
33 //! field names, as the Windows SDK’s `M128A` type from `<winnt.h>`. It is | 32 //! field names, as the Windows SDK’s `M128A` type from `<winnt.h>`. It is |
34 //! provided here instead of in `compat` because it is useful outside of the | 33 //! provided here instead of in `compat` because it is useful outside of the |
35 //! scope of data structures defined by the Windows SDK. | 34 //! scope of data structures defined by the Windows SDK. |
36 struct uint128_struct { | 35 struct uint128_struct { |
37 #if defined(ARCH_CPU_LITTLE_ENDIAN) || DOXYGEN | 36 #if defined(ARCH_CPU_LITTLE_ENDIAN) || DOXYGEN |
38 //! \brief The low 64 bits of the 128-bit quantity. | 37 //! \brief The low 64 bits of the 128-bit quantity. |
39 uint64_t lo; | 38 uint64_t lo; |
40 | 39 |
41 //! \brief The high 64 bits of the 128-bit quantity. | 40 //! \brief The high 64 bits of the 128-bit quantity. |
42 uint64_t hi; | 41 uint64_t hi; |
43 #else | 42 #else |
44 uint64_t hi; | 43 uint64_t hi; |
45 uint64_t lo; | 44 uint64_t lo; |
46 #endif | 45 #endif |
47 }; | 46 }; |
48 | 47 |
49 COMPILE_ASSERT(sizeof(uint128_struct) == 16, uint128_must_be_16_bytes); | 48 static_assert(sizeof(uint128_struct) == 16, "uint128 must be 16 bytes"); |
50 | 49 |
51 } // namespace crashpad | 50 } // namespace crashpad |
52 | 51 |
53 #endif // CRASHPAD_UTIL_NUMERIC_INT128_H_ | 52 #endif // CRASHPAD_UTIL_NUMERIC_INT128_H_ |
OLD | NEW |