Changes imported from Abseil "staging" branch:
- 1320147f7597a9490562d439ecea46faa1793a24 Support Hex formatting of pointers without forcing a cast... by Jorg Brown <jorg@google.com> - 13c793d6e14a52063c2d4ee327b6c976631b690e Add support for native WebAssembly llvm backend. by Abseil Team <absl-team@google.com> GitOrigin-RevId: 1320147f7597a9490562d439ecea46faa1793a24 Change-Id: Ibd4dbf288903ab45387932e5b11a28f5accdf166
This commit is contained in:
parent
506fb4b56a
commit
4e2e6c5c00
7 changed files with 45 additions and 15 deletions
|
|
@ -127,21 +127,32 @@ struct Hex {
|
|||
char fill;
|
||||
|
||||
template <typename Int>
|
||||
explicit Hex(Int v, PadSpec spec = absl::kNoPad,
|
||||
typename std::enable_if<sizeof(Int) == 1>::type* = nullptr)
|
||||
explicit Hex(
|
||||
Int v, PadSpec spec = absl::kNoPad,
|
||||
typename std::enable_if<sizeof(Int) == 1 &&
|
||||
!std::is_pointer<Int>::value>::type* = nullptr)
|
||||
: Hex(spec, static_cast<uint8_t>(v)) {}
|
||||
template <typename Int>
|
||||
explicit Hex(Int v, PadSpec spec = absl::kNoPad,
|
||||
typename std::enable_if<sizeof(Int) == 2>::type* = nullptr)
|
||||
explicit Hex(
|
||||
Int v, PadSpec spec = absl::kNoPad,
|
||||
typename std::enable_if<sizeof(Int) == 2 &&
|
||||
!std::is_pointer<Int>::value>::type* = nullptr)
|
||||
: Hex(spec, static_cast<uint16_t>(v)) {}
|
||||
template <typename Int>
|
||||
explicit Hex(Int v, PadSpec spec = absl::kNoPad,
|
||||
typename std::enable_if<sizeof(Int) == 4>::type* = nullptr)
|
||||
explicit Hex(
|
||||
Int v, PadSpec spec = absl::kNoPad,
|
||||
typename std::enable_if<sizeof(Int) == 4 &&
|
||||
!std::is_pointer<Int>::value>::type* = nullptr)
|
||||
: Hex(spec, static_cast<uint32_t>(v)) {}
|
||||
template <typename Int>
|
||||
explicit Hex(Int v, PadSpec spec = absl::kNoPad,
|
||||
typename std::enable_if<sizeof(Int) == 8>::type* = nullptr)
|
||||
explicit Hex(
|
||||
Int v, PadSpec spec = absl::kNoPad,
|
||||
typename std::enable_if<sizeof(Int) == 8 &&
|
||||
!std::is_pointer<Int>::value>::type* = nullptr)
|
||||
: Hex(spec, static_cast<uint64_t>(v)) {}
|
||||
template <typename Pointee>
|
||||
explicit Hex(Pointee* v, PadSpec spec = absl::kNoPad)
|
||||
: Hex(spec, reinterpret_cast<uintptr_t>(v)) {}
|
||||
|
||||
private:
|
||||
Hex(PadSpec spec, uint64_t v)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue