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
9bde8268
Commit
9bde8268
authored
Apr 23, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use prefix FMT_ for all macros.
parent
269c3bab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
format.h
format.h
+20
-17
No files found.
format.h
View file @
9bde8268
...
...
@@ -25,8 +25,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FORMAT_H_
#define FORMAT_H_
#ifndef F
MT_F
ORMAT_H_
#define F
MT_F
ORMAT_H_
#include <stdint.h>
...
...
@@ -56,19 +56,22 @@
#endif
// Compatibility with compilers other than clang.
#ifndef __has_feature
# define __has_feature(x) 0
# define __has_builtin(x) 0
#ifdef __has_feature
# define FMT_HAS_FEATURE(x) __has_feature(x)
# define FMT_HAS_BUILTIN(x) __has_builtin(x)
#else
# define FMT_HAS_FEATURE(x) 0
# define FMT_HAS_BUILTIN(x) 0
#endif
#ifndef FMT_USE_VARIADIC_TEMPLATES
# define FMT_USE_VARIADIC_TEMPLATES \
(
__has_feature
(cxx_variadic_templates) || \
(
FMT_HAS_FEATURE
(cxx_variadic_templates) || \
(FMT_GCC_VERSION >= 404 && __cplusplus >= 201103) || _MSC_VER >= 1800)
#endif
// Define FMT_USE_NOEXCEPT to make format use noexcept (C++11 feature).
#if FMT_USE_NOEXCEPT ||
__has_feature
(cxx_noexcept) || \
#if FMT_USE_NOEXCEPT ||
FMT_HAS_FEATURE
(cxx_noexcept) || \
(FMT_GCC_VERSION >= 408 && __cplusplus >= 201103)
# define FMT_NOEXCEPT(expr) noexcept(expr)
#else
...
...
@@ -271,7 +274,7 @@ void ReportUnknownType(char code, const char *type);
extern
const
uint32_t
POWERS_OF_10_32
[];
extern
const
uint64_t
POWERS_OF_10_64
[];
#if FMT_GCC_VERSION >= 400 ||
__has_builtin
(__builtin_clzll)
#if FMT_GCC_VERSION >= 400 ||
FMT_HAS_BUILTIN
(__builtin_clzll)
// Returns the number of decimal digits in n. Leading zeros are not counted
// except for n == 0 in which case CountDigits returns 1.
inline
unsigned
CountDigits
(
uint64_t
n
)
{
...
...
@@ -280,7 +283,7 @@ inline unsigned CountDigits(uint64_t n) {
uint64_t
t
=
(
64
-
__builtin_clzll
(
n
|
1
))
*
1233
>>
12
;
return
t
-
(
n
<
POWERS_OF_10_64
[
t
])
+
1
;
}
# if FMT_GCC_VERSION >= 400 ||
__has_builtin
(__builtin_clz)
# if FMT_GCC_VERSION >= 400 ||
FMT_HAS_BUILTIN
(__builtin_clz)
// Optional version of CountDigits for better performance on 32-bit platforms.
inline
unsigned
CountDigits
(
uint32_t
n
)
{
uint32_t
t
=
(
32
-
__builtin_clz
(
n
|
1
))
*
1233
>>
12
;
...
...
@@ -540,7 +543,7 @@ template <char TYPE_CODE, typename Char>
IntFormatSpec
<
int
,
AlignTypeSpec
<
TYPE_CODE
>
,
Char
>
pad
(
int
value
,
unsigned
width
,
Char
fill
=
' '
);
#define DEFINE_INT_FORMATTERS(TYPE) \
#define
FMT_
DEFINE_INT_FORMATTERS(TYPE) \
inline IntFormatSpec<TYPE, TypeSpec<'b'> > bin(TYPE value) { \
return IntFormatSpec<TYPE, TypeSpec<'b'> >(value, TypeSpec<'b'>()); \
} \
...
...
@@ -589,12 +592,12 @@ inline IntFormatSpec<TYPE, AlignTypeSpec<0>, Char> pad( \
value, AlignTypeSpec<0>(width, fill)); \
}
DEFINE_INT_FORMATTERS
(
int
)
DEFINE_INT_FORMATTERS
(
long
)
DEFINE_INT_FORMATTERS
(
unsigned
)
DEFINE_INT_FORMATTERS
(
unsigned
long
)
DEFINE_INT_FORMATTERS
(
LongLong
)
DEFINE_INT_FORMATTERS
(
ULongLong
)
FMT_
DEFINE_INT_FORMATTERS
(
int
)
FMT_
DEFINE_INT_FORMATTERS
(
long
)
FMT_
DEFINE_INT_FORMATTERS
(
unsigned
)
FMT_
DEFINE_INT_FORMATTERS
(
unsigned
long
)
FMT_
DEFINE_INT_FORMATTERS
(
LongLong
)
FMT_
DEFINE_INT_FORMATTERS
(
ULongLong
)
/**
\rst
...
...
@@ -1575,4 +1578,4 @@ inline std::wstring Format(const WStringRef &format, const Args & ... args) {
# pragma warning(pop)
#endif
#endif // FORMAT_H_
#endif // F
MT_F
ORMAT_H_
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