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
ae9bbe11
Unverified
Commit
ae9bbe11
authored
Sep 30, 2021
by
Jonathan W
Committed by
GitHub
Sep 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppress warning C4127 in chrono.h (conditional expression is constant) (#2518)
parent
927dbd13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
include/fmt/chrono.h
include/fmt/chrono.h
+5
-5
No files found.
include/fmt/chrono.h
View file @
ae9bbe11
...
...
@@ -44,7 +44,7 @@ FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) {
static_assert
(
T
::
is_integer
,
"To must be integral"
);
// A and B are both signed, or both unsigned.
if
(
F
::
digits
<=
T
::
digits
)
{
if
(
detail
::
const_check
(
F
::
digits
<=
T
::
digits
)
)
{
// From fits in To without any problem.
}
else
{
// From does not always fit in To, resort to a dynamic check.
...
...
@@ -79,14 +79,14 @@ FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) {
return
{};
}
// From is positive. Can it always fit in To?
if
(
F
::
digits
>
T
::
digits
&&
if
(
detail
::
const_check
(
F
::
digits
>
T
::
digits
)
&&
from
>
static_cast
<
From
>
(
detail
::
max_value
<
To
>
()))
{
ec
=
1
;
return
{};
}
}
if
(
!
F
::
is_signed
&&
T
::
is_signed
&&
F
::
digits
>=
T
::
digits
&&
if
(
detail
::
const_check
(
!
F
::
is_signed
&&
T
::
is_signed
&&
F
::
digits
>=
T
::
digits
)
&&
from
>
static_cast
<
From
>
(
detail
::
max_value
<
To
>
()))
{
ec
=
1
;
return
{};
...
...
@@ -243,7 +243,7 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
}
// multiply with Factor::num without overflow or underflow
if
(
Factor
::
num
!=
1
)
{
if
(
detail
::
const_check
(
Factor
::
num
!=
1
)
)
{
constexpr
auto
max1
=
detail
::
max_value
<
IntermediateRep
>
()
/
static_cast
<
IntermediateRep
>
(
Factor
::
num
);
if
(
count
>
max1
)
{
...
...
@@ -260,7 +260,7 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
}
// this can't go wrong, right? den>0 is checked earlier.
if
(
Factor
::
den
!=
1
)
{
if
(
detail
::
const_check
(
Factor
::
den
!=
1
)
)
{
using
common_t
=
typename
std
::
common_type
<
IntermediateRep
,
intmax_t
>::
type
;
count
/=
static_cast
<
common_t
>
(
Factor
::
den
);
}
...
...
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