Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
e29708ee
Commit
e29708ee
authored
Jun 14, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uintptr -> fallback_uintptr to avoid confusion with uintptr_t
parent
f03a6c53
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
include/fmt/format-inl.h
include/fmt/format-inl.h
+1
-1
include/fmt/format.h
include/fmt/format.h
+4
-4
test/format-impl-test.cc
test/format-impl-test.cc
+1
-1
No files found.
include/fmt/format-inl.h
View file @
e29708ee
...
...
@@ -229,7 +229,7 @@ FMT_FUNC void system_error::init(int err_code, string_view format_str,
namespace
internal
{
template
<
>
FMT_FUNC
int
count_digits
<
4
>
(
internal
::
uintptr
n
)
{
template
<
>
FMT_FUNC
int
count_digits
<
4
>
(
internal
::
fallback_
uintptr
n
)
{
// Assume little endian; pointer formatting is implementation-defined anyway.
int
i
=
static_cast
<
int
>
(
sizeof
(
void
*
))
-
1
;
while
(
i
>
0
&&
n
.
value
[
i
]
==
0
)
--
i
;
...
...
include/fmt/format.h
View file @
e29708ee
...
...
@@ -232,13 +232,13 @@ namespace internal {
#endif
// A fallback implementation of uintptr_t for systems that lack it.
struct
uintptr
{
struct
fallback_
uintptr
{
unsigned
char
value
[
sizeof
(
void
*
)];
};
#ifdef UINTPTR_MAX
using
uintptr_t
=
::
uintptr_t
;
#else
using
uintptr_t
=
uintptr
;
using
uintptr_t
=
fallback_
uintptr
;
#endif
template
<
typename
T
>
inline
bool
use_grisu
()
{
...
...
@@ -700,7 +700,7 @@ template <unsigned BITS, typename UInt> inline int count_digits(UInt n) {
return
num_digits
;
}
template
<
>
int
count_digits
<
4
>
(
internal
::
uintptr
n
);
template
<
>
int
count_digits
<
4
>
(
internal
::
fallback_
uintptr
n
);
template
<
typename
Char
>
inline
size_t
count_code_points
(
basic_string_view
<
Char
>
s
)
{
...
...
@@ -929,7 +929,7 @@ inline Char* format_uint(Char* buffer, UInt value, int num_digits,
}
template
<
unsigned
BASE_BITS
,
typename
Char
>
Char
*
format_uint
(
Char
*
buffer
,
internal
::
uintptr
n
,
int
num_digits
,
Char
*
format_uint
(
Char
*
buffer
,
internal
::
fallback_
uintptr
n
,
int
num_digits
,
bool
=
false
)
{
auto
char_digits
=
std
::
numeric_limits
<
unsigned
char
>::
digits
/
4
;
int
start
=
(
num_digits
+
char_digits
-
1
)
/
char_digits
-
1
;
...
...
test/format-impl-test.cc
View file @
e29708ee
...
...
@@ -259,7 +259,7 @@ TEST(UtilTest, CountDigits) {
TEST
(
UtilTest
,
WriteUIntPtr
)
{
fmt
::
memory_buffer
buf
;
fmt
::
writer
writer
(
buf
);
writer
.
write_pointer
(
fmt
::
internal
::
bit_cast
<
fmt
::
internal
::
uintptr
>
(
writer
.
write_pointer
(
fmt
::
internal
::
bit_cast
<
fmt
::
internal
::
fallback_
uintptr
>
(
reinterpret_cast
<
void
*>
(
0xface
)),
nullptr
);
EXPECT_EQ
(
"0xface"
,
to_string
(
buf
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment