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
a8cef1d9
Commit
a8cef1d9
authored
Jul 26, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FormatDecimal -> format_decimal (
https://github.com/cppformat/cppformat/issues/50
)
parent
1a6cdb53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
format.h
format.h
+8
-8
No files found.
format.h
View file @
a8cef1d9
...
@@ -469,7 +469,7 @@ extern const char DIGITS[];
...
@@ -469,7 +469,7 @@ extern const char DIGITS[];
// Formats a decimal unsigned integer value writing into buffer.
// Formats a decimal unsigned integer value writing into buffer.
template
<
typename
UInt
,
typename
Char
>
template
<
typename
UInt
,
typename
Char
>
void
FormatD
ecimal
(
Char
*
buffer
,
UInt
value
,
unsigned
num_digits
)
{
void
format_d
ecimal
(
Char
*
buffer
,
UInt
value
,
unsigned
num_digits
)
{
--
num_digits
;
--
num_digits
;
while
(
value
>=
100
)
{
while
(
value
>=
100
)
{
// 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
...
@@ -1619,7 +1619,7 @@ void BasicWriter<Char>::write_int(T value, const Spec &spec) {
...
@@ -1619,7 +1619,7 @@ void BasicWriter<Char>::write_int(T value, const Spec &spec) {
unsigned
num_digits
=
internal
::
count_digits
(
abs_value
);
unsigned
num_digits
=
internal
::
count_digits
(
abs_value
);
CharPtr
p
=
PrepareBufferForInt
(
CharPtr
p
=
PrepareBufferForInt
(
num_digits
,
spec
,
prefix
,
prefix_size
)
+
1
-
num_digits
;
num_digits
,
spec
,
prefix
,
prefix_size
)
+
1
-
num_digits
;
internal
::
FormatD
ecimal
(
GetBase
(
p
),
abs_value
,
num_digits
);
internal
::
format_d
ecimal
(
GetBase
(
p
),
abs_value
,
num_digits
);
break
;
break
;
}
}
case
'x'
:
case
'X'
:
{
case
'x'
:
case
'X'
:
{
...
@@ -1826,7 +1826,7 @@ class FormatInt {
...
@@ -1826,7 +1826,7 @@ class FormatInt {
char
*
str_
;
char
*
str_
;
// Formats value in reverse and returns the number of digits.
// Formats value in reverse and returns the number of digits.
char
*
FormatD
ecimal
(
ULongLong
value
)
{
char
*
format_d
ecimal
(
ULongLong
value
)
{
char
*
buffer_end
=
buffer_
+
BUFFER_SIZE
-
1
;
char
*
buffer_end
=
buffer_
+
BUFFER_SIZE
-
1
;
while
(
value
>=
100
)
{
while
(
value
>=
100
)
{
// 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
...
@@ -1852,7 +1852,7 @@ class FormatInt {
...
@@ -1852,7 +1852,7 @@ class FormatInt {
bool
negative
=
value
<
0
;
bool
negative
=
value
<
0
;
if
(
negative
)
if
(
negative
)
abs_value
=
0
-
value
;
abs_value
=
0
-
value
;
str_
=
FormatD
ecimal
(
abs_value
);
str_
=
format_d
ecimal
(
abs_value
);
if
(
negative
)
if
(
negative
)
*--
str_
=
'-'
;
*--
str_
=
'-'
;
}
}
...
@@ -1861,9 +1861,9 @@ class FormatInt {
...
@@ -1861,9 +1861,9 @@ class FormatInt {
explicit
FormatInt
(
int
value
)
{
FormatSigned
(
value
);
}
explicit
FormatInt
(
int
value
)
{
FormatSigned
(
value
);
}
explicit
FormatInt
(
long
value
)
{
FormatSigned
(
value
);
}
explicit
FormatInt
(
long
value
)
{
FormatSigned
(
value
);
}
explicit
FormatInt
(
LongLong
value
)
{
FormatSigned
(
value
);
}
explicit
FormatInt
(
LongLong
value
)
{
FormatSigned
(
value
);
}
explicit
FormatInt
(
unsigned
value
)
:
str_
(
FormatD
ecimal
(
value
))
{}
explicit
FormatInt
(
unsigned
value
)
:
str_
(
format_d
ecimal
(
value
))
{}
explicit
FormatInt
(
unsigned
long
value
)
:
str_
(
FormatD
ecimal
(
value
))
{}
explicit
FormatInt
(
unsigned
long
value
)
:
str_
(
format_d
ecimal
(
value
))
{}
explicit
FormatInt
(
ULongLong
value
)
:
str_
(
FormatD
ecimal
(
value
))
{}
explicit
FormatInt
(
ULongLong
value
)
:
str_
(
format_d
ecimal
(
value
))
{}
/**
/**
Returns the number of characters written to the output buffer.
Returns the number of characters written to the output buffer.
...
@@ -1912,7 +1912,7 @@ inline void FormatDec(char *&buffer, T value) {
...
@@ -1912,7 +1912,7 @@ inline void FormatDec(char *&buffer, T value) {
return
;
return
;
}
}
unsigned
num_digits
=
internal
::
count_digits
(
abs_value
);
unsigned
num_digits
=
internal
::
count_digits
(
abs_value
);
internal
::
FormatD
ecimal
(
buffer
,
abs_value
,
num_digits
);
internal
::
format_d
ecimal
(
buffer
,
abs_value
,
num_digits
);
buffer
+=
num_digits
;
buffer
+=
num_digits
;
}
}
}
}
...
...
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