forked from OSchip/llvm-project
[libc++][format] Use a helper constant.
The code accidentally uses a hard-coded value. Use a constant to make sure the same value is used at both places.
This commit is contained in:
parent
4048aad85a
commit
82427685ea
|
@ -46,10 +46,12 @@ public:
|
||||||
// but that code isn't public. Making that code public requires some
|
// but that code isn't public. Making that code public requires some
|
||||||
// refactoring.
|
// refactoring.
|
||||||
// TODO FMT Remove code duplication.
|
// TODO FMT Remove code duplication.
|
||||||
char __buffer[2 + 2 * sizeof(uintptr_t)];
|
constexpr size_t __max_hex_digits = 2 * sizeof(uintptr_t);
|
||||||
|
char __buffer[2 + __max_hex_digits];
|
||||||
__buffer[0] = '0';
|
__buffer[0] = '0';
|
||||||
__buffer[1] = 'x';
|
__buffer[1] = 'x';
|
||||||
char* __last = __to_buffer(__buffer + 2, _VSTD::end(__buffer), reinterpret_cast<uintptr_t>(__ptr), 16);
|
char* __last =
|
||||||
|
__to_buffer(__buffer + 2, _VSTD::end(__buffer), reinterpret_cast<uintptr_t>(__ptr), __max_hex_digits);
|
||||||
|
|
||||||
unsigned __size = __last - __buffer;
|
unsigned __size = __last - __buffer;
|
||||||
if (__size >= this->__width)
|
if (__size >= this->__width)
|
||||||
|
|
Loading…
Reference in New Issue