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
12f9437e
Commit
12f9437e
authored
Nov 07, 2019
by
Rosen Penev
Committed by
Victor Zverovich
Nov 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[clang-tidy] Use auto
Found with hicpp-use-auto Signed-off-by:
Rosen Penev
<
rosenp@gmail.com
>
parent
bb0c8bfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
include/fmt/format-inl.h
include/fmt/format-inl.h
+1
-1
include/fmt/format.h
include/fmt/format.h
+6
-6
No files found.
include/fmt/format-inl.h
View file @
12f9437e
...
@@ -800,7 +800,7 @@ FMT_ALWAYS_INLINE digits::result grisu_gen_digits(fp value, uint64_t error,
...
@@ -800,7 +800,7 @@ FMT_ALWAYS_INLINE digits::result grisu_gen_digits(fp value, uint64_t error,
// The integral part of scaled value (p1 in Grisu) = value / one. It cannot be
// The integral part of scaled value (p1 in Grisu) = value / one. It cannot be
// zero because it contains a product of two 64-bit numbers with MSB set (due
// zero because it contains a product of two 64-bit numbers with MSB set (due
// to normalization) - 1, shifted right by at most 60 bits.
// to normalization) - 1, shifted right by at most 60 bits.
uint32_t
integral
=
static_cast
<
uint32_t
>
(
value
.
f
>>
-
one
.
e
);
auto
integral
=
static_cast
<
uint32_t
>
(
value
.
f
>>
-
one
.
e
);
FMT_ASSERT
(
integral
!=
0
,
""
);
FMT_ASSERT
(
integral
!=
0
,
""
);
FMT_ASSERT
(
integral
==
value
.
f
>>
-
one
.
e
,
""
);
FMT_ASSERT
(
integral
==
value
.
f
>>
-
one
.
e
,
""
);
// The fractional part of scaled value (p2 in Grisu) c = value % one.
// The fractional part of scaled value (p2 in Grisu) c = value % one.
...
...
include/fmt/format.h
View file @
12f9437e
...
@@ -862,7 +862,7 @@ inline Char* format_decimal(Char* buffer, UInt value, int num_digits,
...
@@ -862,7 +862,7 @@ inline Char* format_decimal(Char* buffer, UInt value, int num_digits,
// Integer division is slow so do it for a group of two digits instead
// Integer division is slow so do it for a group of two digits instead
// of for every digit. The idea comes from the talk by Alexandrescu
// of for every digit. The idea comes from the talk by Alexandrescu
// "Three Optimization Tips for C++". See speed-test for a comparison.
// "Three Optimization Tips for C++". See speed-test for a comparison.
unsigned
index
=
static_cast
<
unsigned
>
((
value
%
100
)
*
2
);
auto
index
=
static_cast
<
unsigned
>
((
value
%
100
)
*
2
);
value
/=
100
;
value
/=
100
;
*--
buffer
=
static_cast
<
Char
>
(
data
::
digits
[
index
+
1
]);
*--
buffer
=
static_cast
<
Char
>
(
data
::
digits
[
index
+
1
]);
add_thousands_sep
(
buffer
);
add_thousands_sep
(
buffer
);
...
@@ -873,7 +873,7 @@ inline Char* format_decimal(Char* buffer, UInt value, int num_digits,
...
@@ -873,7 +873,7 @@ inline Char* format_decimal(Char* buffer, UInt value, int num_digits,
*--
buffer
=
static_cast
<
Char
>
(
'0'
+
value
);
*--
buffer
=
static_cast
<
Char
>
(
'0'
+
value
);
return
end
;
return
end
;
}
}
unsigned
index
=
static_cast
<
unsigned
>
(
value
*
2
);
auto
index
=
static_cast
<
unsigned
>
(
value
*
2
);
*--
buffer
=
static_cast
<
Char
>
(
data
::
digits
[
index
+
1
]);
*--
buffer
=
static_cast
<
Char
>
(
data
::
digits
[
index
+
1
]);
add_thousands_sep
(
buffer
);
add_thousands_sep
(
buffer
);
*--
buffer
=
static_cast
<
Char
>
(
data
::
digits
[
index
]);
*--
buffer
=
static_cast
<
Char
>
(
data
::
digits
[
index
]);
...
@@ -1568,7 +1568,7 @@ template <typename Range> class basic_writer {
...
@@ -1568,7 +1568,7 @@ template <typename Range> class basic_writer {
void
on_num
()
{
void
on_num
()
{
std
::
string
groups
=
internal
::
grouping
<
char_type
>
(
writer
.
locale_
);
std
::
string
groups
=
internal
::
grouping
<
char_type
>
(
writer
.
locale_
);
if
(
groups
.
empty
())
return
on_dec
();
if
(
groups
.
empty
())
return
on_dec
();
char_type
sep
=
internal
::
thousands_sep
<
char_type
>
(
writer
.
locale_
);
auto
sep
=
internal
::
thousands_sep
<
char_type
>
(
writer
.
locale_
);
if
(
!
sep
)
return
on_dec
();
if
(
!
sep
)
return
on_dec
();
int
num_digits
=
internal
::
count_digits
(
abs_value
);
int
num_digits
=
internal
::
count_digits
(
abs_value
);
int
size
=
num_digits
;
int
size
=
num_digits
;
...
@@ -2965,7 +2965,7 @@ class format_int {
...
@@ -2965,7 +2965,7 @@ class format_int {
// Integer division is slow so do it for a group of two digits instead
// Integer division is slow so do it for a group of two digits instead
// of for every digit. The idea comes from the talk by Alexandrescu
// of for every digit. The idea comes from the talk by Alexandrescu
// "Three Optimization Tips for C++". See speed-test for a comparison.
// "Three Optimization Tips for C++". See speed-test for a comparison.
unsigned
index
=
static_cast
<
unsigned
>
((
value
%
100
)
*
2
);
auto
index
=
static_cast
<
unsigned
>
((
value
%
100
)
*
2
);
value
/=
100
;
value
/=
100
;
*--
ptr
=
internal
::
data
::
digits
[
index
+
1
];
*--
ptr
=
internal
::
data
::
digits
[
index
+
1
];
*--
ptr
=
internal
::
data
::
digits
[
index
];
*--
ptr
=
internal
::
data
::
digits
[
index
];
...
@@ -2974,14 +2974,14 @@ class format_int {
...
@@ -2974,14 +2974,14 @@ class format_int {
*--
ptr
=
static_cast
<
char
>
(
'0'
+
value
);
*--
ptr
=
static_cast
<
char
>
(
'0'
+
value
);
return
ptr
;
return
ptr
;
}
}
unsigned
index
=
static_cast
<
unsigned
>
(
value
*
2
);
auto
index
=
static_cast
<
unsigned
>
(
value
*
2
);
*--
ptr
=
internal
::
data
::
digits
[
index
+
1
];
*--
ptr
=
internal
::
data
::
digits
[
index
+
1
];
*--
ptr
=
internal
::
data
::
digits
[
index
];
*--
ptr
=
internal
::
data
::
digits
[
index
];
return
ptr
;
return
ptr
;
}
}
void
format_signed
(
long
long
value
)
{
void
format_signed
(
long
long
value
)
{
unsigned
long
long
abs_value
=
static_cast
<
unsigned
long
long
>
(
value
);
auto
abs_value
=
static_cast
<
unsigned
long
long
>
(
value
);
bool
negative
=
value
<
0
;
bool
negative
=
value
<
0
;
if
(
negative
)
abs_value
=
0
-
abs_value
;
if
(
negative
)
abs_value
=
0
-
abs_value
;
str_
=
format_decimal
(
abs_value
);
str_
=
format_decimal
(
abs_value
);
...
...
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