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
3d0c7ae3
Commit
3d0c7ae3
authored
Sep 12, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move data to format.cc
parent
04e3a79f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
46 deletions
+46
-46
include/fmt/format-inl.h
include/fmt/format-inl.h
+0
-46
src/format.cc
src/format.cc
+46
-0
No files found.
include/fmt/format-inl.h
View file @
3d0c7ae3
...
@@ -152,52 +152,6 @@ template <> FMT_FUNC int count_digits<4>(detail::fallback_uintptr n) {
...
@@ -152,52 +152,6 @@ template <> FMT_FUNC int count_digits<4>(detail::fallback_uintptr n) {
// log10(2) = 0x0.4d104d427de7fbcc...
// log10(2) = 0x0.4d104d427de7fbcc...
static
constexpr
uint64_t
log10_2_significand
=
0x4d104d427de7fbcc
;
static
constexpr
uint64_t
log10_2_significand
=
0x4d104d427de7fbcc
;
// DEPRECATED!
template
<
typename
T
=
void
>
struct
basic_data
{
FMT_API
static
constexpr
const
char
digits
[
100
][
2
]
=
{
{
'0'
,
'0'
},
{
'0'
,
'1'
},
{
'0'
,
'2'
},
{
'0'
,
'3'
},
{
'0'
,
'4'
},
{
'0'
,
'5'
},
{
'0'
,
'6'
},
{
'0'
,
'7'
},
{
'0'
,
'8'
},
{
'0'
,
'9'
},
{
'1'
,
'0'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
{
'8'
,
'4'
},
{
'8'
,
'5'
},
{
'8'
,
'6'
},
{
'8'
,
'7'
},
{
'8'
,
'8'
},
{
'8'
,
'9'
},
{
'9'
,
'0'
},
{
'9'
,
'1'
},
{
'9'
,
'2'
},
{
'9'
,
'3'
},
{
'9'
,
'4'
},
{
'9'
,
'5'
},
{
'9'
,
'6'
},
{
'9'
,
'7'
},
{
'9'
,
'8'
},
{
'9'
,
'9'
}};
FMT_API
static
constexpr
const
char
hex_digits
[]
=
"0123456789abcdef"
;
FMT_API
static
constexpr
const
char
signs
[
4
]
=
{
0
,
'-'
,
'+'
,
' '
};
FMT_API
static
constexpr
const
char
left_padding_shifts
[
5
]
=
{
31
,
31
,
0
,
1
,
0
};
FMT_API
static
constexpr
const
char
right_padding_shifts
[
5
]
=
{
0
,
31
,
0
,
1
,
0
};
FMT_API
static
constexpr
const
unsigned
prefixes
[
4
]
=
{
0
,
0
,
0x1000000u
|
'+'
,
0x1000000u
|
' '
};
};
#ifdef FMT_SHARED
// Required for -flto, -fivisibility=hidden and -shared to work
extern
template
struct
basic_data
<
void
>;
#endif
#if __cplusplus < 201703L
// DEPRECATED! These are here only for ABI compatiblity.
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
digits
[][
2
];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
hex_digits
[];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
signs
[];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
left_padding_shifts
[];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
right_padding_shifts
[];
template
<
typename
T
>
constexpr
const
unsigned
basic_data
<
T
>::
prefixes
[];
#endif
template
<
typename
T
>
struct
bits
{
template
<
typename
T
>
struct
bits
{
static
FMT_CONSTEXPR_DECL
const
int
value
=
static
FMT_CONSTEXPR_DECL
const
int
value
=
static_cast
<
int
>
(
sizeof
(
T
)
*
std
::
numeric_limits
<
unsigned
char
>::
digits
);
static_cast
<
int
>
(
sizeof
(
T
)
*
std
::
numeric_limits
<
unsigned
char
>::
digits
);
...
...
src/format.cc
View file @
3d0c7ae3
...
@@ -10,6 +10,52 @@
...
@@ -10,6 +10,52 @@
FMT_BEGIN_NAMESPACE
FMT_BEGIN_NAMESPACE
namespace
detail
{
namespace
detail
{
// DEPRECATED!
template
<
typename
T
=
void
>
struct
basic_data
{
FMT_API
static
constexpr
const
char
digits
[
100
][
2
]
=
{
{
'0'
,
'0'
},
{
'0'
,
'1'
},
{
'0'
,
'2'
},
{
'0'
,
'3'
},
{
'0'
,
'4'
},
{
'0'
,
'5'
},
{
'0'
,
'6'
},
{
'0'
,
'7'
},
{
'0'
,
'8'
},
{
'0'
,
'9'
},
{
'1'
,
'0'
},
{
'1'
,
'1'
},
{
'1'
,
'2'
},
{
'1'
,
'3'
},
{
'1'
,
'4'
},
{
'1'
,
'5'
},
{
'1'
,
'6'
},
{
'1'
,
'7'
},
{
'1'
,
'8'
},
{
'1'
,
'9'
},
{
'2'
,
'0'
},
{
'2'
,
'1'
},
{
'2'
,
'2'
},
{
'2'
,
'3'
},
{
'2'
,
'4'
},
{
'2'
,
'5'
},
{
'2'
,
'6'
},
{
'2'
,
'7'
},
{
'2'
,
'8'
},
{
'2'
,
'9'
},
{
'3'
,
'0'
},
{
'3'
,
'1'
},
{
'3'
,
'2'
},
{
'3'
,
'3'
},
{
'3'
,
'4'
},
{
'3'
,
'5'
},
{
'3'
,
'6'
},
{
'3'
,
'7'
},
{
'3'
,
'8'
},
{
'3'
,
'9'
},
{
'4'
,
'0'
},
{
'4'
,
'1'
},
{
'4'
,
'2'
},
{
'4'
,
'3'
},
{
'4'
,
'4'
},
{
'4'
,
'5'
},
{
'4'
,
'6'
},
{
'4'
,
'7'
},
{
'4'
,
'8'
},
{
'4'
,
'9'
},
{
'5'
,
'0'
},
{
'5'
,
'1'
},
{
'5'
,
'2'
},
{
'5'
,
'3'
},
{
'5'
,
'4'
},
{
'5'
,
'5'
},
{
'5'
,
'6'
},
{
'5'
,
'7'
},
{
'5'
,
'8'
},
{
'5'
,
'9'
},
{
'6'
,
'0'
},
{
'6'
,
'1'
},
{
'6'
,
'2'
},
{
'6'
,
'3'
},
{
'6'
,
'4'
},
{
'6'
,
'5'
},
{
'6'
,
'6'
},
{
'6'
,
'7'
},
{
'6'
,
'8'
},
{
'6'
,
'9'
},
{
'7'
,
'0'
},
{
'7'
,
'1'
},
{
'7'
,
'2'
},
{
'7'
,
'3'
},
{
'7'
,
'4'
},
{
'7'
,
'5'
},
{
'7'
,
'6'
},
{
'7'
,
'7'
},
{
'7'
,
'8'
},
{
'7'
,
'9'
},
{
'8'
,
'0'
},
{
'8'
,
'1'
},
{
'8'
,
'2'
},
{
'8'
,
'3'
},
{
'8'
,
'4'
},
{
'8'
,
'5'
},
{
'8'
,
'6'
},
{
'8'
,
'7'
},
{
'8'
,
'8'
},
{
'8'
,
'9'
},
{
'9'
,
'0'
},
{
'9'
,
'1'
},
{
'9'
,
'2'
},
{
'9'
,
'3'
},
{
'9'
,
'4'
},
{
'9'
,
'5'
},
{
'9'
,
'6'
},
{
'9'
,
'7'
},
{
'9'
,
'8'
},
{
'9'
,
'9'
}};
FMT_API
static
constexpr
const
char
hex_digits
[]
=
"0123456789abcdef"
;
FMT_API
static
constexpr
const
char
signs
[
4
]
=
{
0
,
'-'
,
'+'
,
' '
};
FMT_API
static
constexpr
const
char
left_padding_shifts
[
5
]
=
{
31
,
31
,
0
,
1
,
0
};
FMT_API
static
constexpr
const
char
right_padding_shifts
[
5
]
=
{
0
,
31
,
0
,
1
,
0
};
FMT_API
static
constexpr
const
unsigned
prefixes
[
4
]
=
{
0
,
0
,
0x1000000u
|
'+'
,
0x1000000u
|
' '
};
};
#ifdef FMT_SHARED
// Required for -flto, -fivisibility=hidden and -shared to work
extern
template
struct
basic_data
<
void
>;
#endif
#if __cplusplus < 201703L
// DEPRECATED! These are here only for ABI compatiblity.
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
digits
[][
2
];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
hex_digits
[];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
signs
[];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
left_padding_shifts
[];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
right_padding_shifts
[];
template
<
typename
T
>
constexpr
const
unsigned
basic_data
<
T
>::
prefixes
[];
#endif
template
<
typename
T
>
template
<
typename
T
>
int
format_float
(
char
*
buf
,
std
::
size_t
size
,
const
char
*
format
,
int
precision
,
int
format_float
(
char
*
buf
,
std
::
size_t
size
,
const
char
*
format
,
int
precision
,
T
value
)
{
T
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