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
35c0286c
Commit
35c0286c
authored
Feb 02, 2022
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify byte handling
parent
c7173a36
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
14 deletions
+8
-14
include/fmt/core.h
include/fmt/core.h
+0
-11
include/fmt/format.h
include/fmt/format.h
+8
-3
No files found.
include/fmt/core.h
View file @
35c0286c
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
#ifndef FMT_CORE_H_
#ifndef FMT_CORE_H_
#define FMT_CORE_H_
#define FMT_CORE_H_
#include <cstddef> // std::byte
#include <cstdio> // std::FILE
#include <cstdio> // std::FILE
#include <cstring>
#include <cstring>
#include <iterator>
#include <iterator>
...
@@ -367,12 +366,6 @@ FMT_NORETURN FMT_API void assert_fail(const char* file, int line,
...
@@ -367,12 +366,6 @@ FMT_NORETURN FMT_API void assert_fail(const char* file, int line,
# endif
# endif
#endif
#endif
#ifdef __cpp_lib_byte
using
byte
=
std
::
byte
;
#else
enum
class
byte
:
unsigned
char
{};
#endif
#if defined(FMT_USE_STRING_VIEW)
#if defined(FMT_USE_STRING_VIEW)
template
<
typename
Char
>
using
std_string_view
=
std
::
basic_string_view
<
Char
>
;
template
<
typename
Char
>
using
std_string_view
=
std
::
basic_string_view
<
Char
>
;
#elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW)
#elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW)
...
@@ -1429,10 +1422,6 @@ template <typename Context> struct arg_mapper {
...
@@ -1429,10 +1422,6 @@ template <typename Context> struct arg_mapper {
return
map
(
format_as
(
val
));
return
map
(
format_as
(
val
));
}
}
FMT_CONSTEXPR
FMT_INLINE
auto
map
(
detail
::
byte
val
)
->
unsigned
{
return
map
(
static_cast
<
unsigned
char
>
(
val
));
}
template
<
typename
T
,
typename
U
=
remove_cvref_t
<
T
>
>
template
<
typename
T
,
typename
U
=
remove_cvref_t
<
T
>
>
struct
formattable
struct
formattable
:
bool_constant
<
has_const_formatter
<
U
,
Context
>
()
||
:
bool_constant
<
has_const_formatter
<
U
,
Context
>
()
||
...
...
include/fmt/format.h
View file @
35c0286c
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#define FMT_FORMAT_H_
#define FMT_FORMAT_H_
#include <cmath> // std::signbit
#include <cmath> // std::signbit
#include <cstddef> // std::byte
#include <cstdint> // uint32_t
#include <cstdint> // uint32_t
#include <cstring> // std::memcpy
#include <cstring> // std::memcpy
#include <limits> // std::numeric_limits
#include <limits> // std::numeric_limits
...
@@ -159,8 +160,8 @@ FMT_END_NAMESPACE
...
@@ -159,8 +160,8 @@ FMT_END_NAMESPACE
// __builtin_ctz is broken in Intel Compiler Classic on Windows:
// __builtin_ctz is broken in Intel Compiler Classic on Windows:
// https://github.com/fmtlib/fmt/issues/2510.
// https://github.com/fmtlib/fmt/issues/2510.
#ifndef __ICL
#ifndef __ICL
# if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION || \
# if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION ||
FMT_ICC_VERSION ||
\
FMT_
ICC_VERSION || FMT_
NVCOMPILER_VERSION
FMT_NVCOMPILER_VERSION
# define FMT_BUILTIN_CTZ(n) __builtin_ctz(n)
# define FMT_BUILTIN_CTZ(n) __builtin_ctz(n)
# endif
# endif
# if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || \
# if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || \
...
@@ -2767,7 +2768,6 @@ FMT_FORMAT_AS(unsigned long, unsigned long long);
...
@@ -2767,7 +2768,6 @@ FMT_FORMAT_AS(unsigned long, unsigned long long);
FMT_FORMAT_AS
(
Char
*
,
const
Char
*
);
FMT_FORMAT_AS
(
Char
*
,
const
Char
*
);
FMT_FORMAT_AS
(
std
::
basic_string
<
Char
>
,
basic_string_view
<
Char
>
);
FMT_FORMAT_AS
(
std
::
basic_string
<
Char
>
,
basic_string_view
<
Char
>
);
FMT_FORMAT_AS
(
std
::
nullptr_t
,
const
void
*
);
FMT_FORMAT_AS
(
std
::
nullptr_t
,
const
void
*
);
FMT_FORMAT_AS
(
detail
::
byte
,
unsigned
char
);
FMT_FORMAT_AS
(
detail
::
std_string_view
<
Char
>
,
basic_string_view
<
Char
>
);
FMT_FORMAT_AS
(
detail
::
std_string_view
<
Char
>
,
basic_string_view
<
Char
>
);
template
<
typename
Char
>
template
<
typename
Char
>
...
@@ -2875,6 +2875,11 @@ constexpr auto underlying(Enum e) noexcept ->
...
@@ -2875,6 +2875,11 @@ constexpr auto underlying(Enum e) noexcept ->
return
static_cast
<
typename
std
::
underlying_type
<
Enum
>::
type
>
(
e
);
return
static_cast
<
typename
std
::
underlying_type
<
Enum
>::
type
>
(
e
);
}
}
#ifdef __cpp_lib_byte
inline
auto
format_as
(
std
::
byte
b
)
->
unsigned
char
{
return
underlying
(
b
);
}
FMT_FORMAT_AS
(
std
::
byte
,
unsigned
char
);
#endif
class
bytes
{
class
bytes
{
private:
private:
string_view
data_
;
string_view
data_
;
...
...
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