Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: util/numeric/int128.h

Issue 590283002: uint128_struct: address misunderstood review feedback (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | util/numeric/int128_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 22
22 namespace crashpad { 23 namespace crashpad {
23 24
24 //! \brief Stores a 128-bit quantity. 25 //! \brief Stores a 128-bit quantity.
25 //! 26 //!
26 //! This structure is organized so that 128-bit quantities are laid out in 27 //! This structure is organized so that 128-bit quantities are laid out in
27 //! memory according to the system’s natural byte order. If a system offers a 28 //! memory according to the system’s natural byte order. If a system offers a
28 //! native 128-bit type, it should be possible to bit_cast<> between that type 29 //! native 128-bit type, it should be possible to bit_cast<> between that type
29 //! and this one. 30 //! and this one.
30 //! 31 //!
31 //! This structure is designed to have the same layout, although not the same 32 //! This structure is designed to have the same layout, although not the same
32 //! field names, as the Windows SDK’s `M128A` type from `<winnt.h>`. It is 33 //! field names, as the Windows SDK’s `M128A` type from `<winnt.h>`. It is
33 //! provided here instead of in `compat` because it is useful outside of the 34 //! provided here instead of in `compat` because it is useful outside of the
34 //! scope of data structures defined by the Windows SDK. 35 //! scope of data structures defined by the Windows SDK.
35 struct uint128_struct { 36 struct uint128_struct {
36 #if defined(ARCH_CPU_LITTLE_ENDIAN) || DOXYGEN 37 #if defined(ARCH_CPU_LITTLE_ENDIAN) || DOXYGEN
37 //! \brief The low 64 bits of the 128-bit quantity. 38 //! \brief The low 64 bits of the 128-bit quantity.
38 uint64_t lo; 39 uint64_t lo;
39 40
40 //! \brief The high 64 bits of the 128-bit quantity. 41 //! \brief The high 64 bits of the 128-bit quantity.
41 uint64_t hi; 42 uint64_t hi;
42 #else 43 #else
43 uint64_t hi; 44 uint64_t hi;
44 uint64_t lo; 45 uint64_t lo;
45 #endif 46 #endif
46 }; 47 };
47 48
49 COMPILE_ASSERT(sizeof(uint128_struct) == 16, uint128_must_be_16_bytes);
50
48 } // namespace crashpad 51 } // namespace crashpad
49 52
50 #endif // CRASHPAD_UTIL_NUMERIC_INT128_H_ 53 #endif // CRASHPAD_UTIL_NUMERIC_INT128_H_
OLDNEW
« no previous file with comments | « no previous file | util/numeric/int128_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698