Skip to content
Snippets Groups Projects
Commit 82427685 authored by Mark de Wever's avatar Mark de Wever
Browse files

[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.
parent 4048aad8
No related branches found
No related tags found
No related merge requests found
......@@ -46,10 +46,12 @@ public:
// but that code isn't public. Making that code public requires some
// refactoring.
// 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[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;
if (__size >= this->__width)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment