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
f4d8884a
Commit
f4d8884a
authored
Nov 02, 2015
by
Ingo van Lil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add casts to fix warnings with -Wconversion
parent
fe34b2f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
format.cc
format.cc
+1
-1
format.h
format.h
+4
-4
No files found.
format.cc
View file @
f4d8884a
...
...
@@ -1265,7 +1265,7 @@ FMT_FUNC void fmt::print(std::ostream &os, CStringRef format_str, ArgList args)
FMT_FUNC
void
fmt
::
print_colored
(
Color
c
,
CStringRef
format
,
ArgList
args
)
{
char
escape
[]
=
"
\x1b
[30m"
;
escape
[
3
]
=
'0'
+
static_cast
<
char
>
(
c
);
escape
[
3
]
=
static_cast
<
char
>
(
'0'
+
c
);
std
::
fputs
(
escape
,
stdout
);
print
(
format
,
args
);
std
::
fputs
(
RESET_COLOR
,
stdout
);
...
...
format.h
View file @
f4d8884a
...
...
@@ -778,7 +778,7 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits) {
// 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
// "Three Optimization Tips for C++". See speed-test for a comparison.
unsigned
index
=
(
value
%
100
)
*
2
;
unsigned
index
=
static_cast
<
unsigned
>
((
value
%
100
)
*
2
)
;
value
/=
100
;
*--
buffer
=
Data
::
DIGITS
[
index
+
1
];
*--
buffer
=
Data
::
DIGITS
[
index
];
...
...
@@ -2330,7 +2330,7 @@ void BasicWriter<Char>::write_int(T value, Spec spec) {
Char
*
p
=
get
(
prepare_int_buffer
(
num_digits
,
spec
,
prefix
,
prefix_size
));
n
=
abs_value
;
do
{
*
p
--
=
'0'
+
(
n
&
1
);
*
p
--
=
static_cast
<
Char
>
(
'0'
+
(
n
&
1
)
);
}
while
((
n
>>=
1
)
!=
0
);
break
;
}
...
...
@@ -2345,7 +2345,7 @@ void BasicWriter<Char>::write_int(T value, Spec spec) {
Char
*
p
=
get
(
prepare_int_buffer
(
num_digits
,
spec
,
prefix
,
prefix_size
));
n
=
abs_value
;
do
{
*
p
--
=
'0'
+
(
n
&
7
);
*
p
--
=
static_cast
<
Char
>
(
'0'
+
(
n
&
7
)
);
}
while
((
n
>>=
3
)
!=
0
);
break
;
}
...
...
@@ -2810,7 +2810,7 @@ class FormatInt {
// 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
// "Three Optimization Tips for C++". See speed-test for a comparison.
unsigned
index
=
(
value
%
100
)
*
2
;
unsigned
index
=
static_cast
<
unsigned
>
((
value
%
100
)
*
2
)
;
value
/=
100
;
*--
buffer_end
=
internal
::
Data
::
DIGITS
[
index
+
1
];
*--
buffer_end
=
internal
::
Data
::
DIGITS
[
index
];
...
...
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