Skip to content

Commit fd933b4

Browse files
committed
mbed_chrono: restore asserts
Now that we've got a workaround for ARMC6, asserts can be restored.
1 parent ff2a928 commit fd933b4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

platform/mbed_chrono.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#ifndef __MBED_CHRONO_H__
2020
#define __MBED_CHRONO_H__
2121

22+
#include "mbed_toolchain.h"
2223
#include <cstdint>
2324
#include <cassert>
2425
#include <ratio>
@@ -85,10 +86,7 @@ inline namespace chrono_literals {
8586
constexpr chrono::deciseconds operator "" _ds(unsigned long long x)
8687
{
8788
chrono::deciseconds::rep val = static_cast<chrono::deciseconds::rep>(x);
88-
if (val < 0) {
89-
assert(false);
90-
}
91-
assert(static_cast<unsigned long long>(val) == x);
89+
assert(val >= 0 && static_cast<unsigned long long>(val) == x);
9290
return chrono::deciseconds(val);
9391
}
9492

@@ -106,10 +104,7 @@ constexpr chrono::deciseconds operator "" _ds(unsigned long long x)
106104
constexpr chrono::centiseconds operator "" _cs(unsigned long long x)
107105
{
108106
chrono::centiseconds::rep val = static_cast<chrono::centiseconds::rep>(x);
109-
if (val < 0) {
110-
assert(false);
111-
}
112-
assert(static_cast<unsigned long long>(val) == x);
107+
assert(val >= 0 && static_cast<unsigned long long>(val) == x);
113108
return chrono::centiseconds(val);
114109
}
115110

0 commit comments

Comments
 (0)