mbed_chrono: restore asserts

Now that we've got a workaround for ARMC6, asserts can be restored.
pull/12906/head
Kevin Bracey 2020-04-03 15:56:45 +03:00
parent ff2a928091
commit fd933b4c72
1 changed files with 3 additions and 8 deletions

View File

@ -19,6 +19,7 @@
#ifndef __MBED_CHRONO_H__ #ifndef __MBED_CHRONO_H__
#define __MBED_CHRONO_H__ #define __MBED_CHRONO_H__
#include "mbed_toolchain.h"
#include <cstdint> #include <cstdint>
#include <cassert> #include <cassert>
#include <ratio> #include <ratio>
@ -85,10 +86,7 @@ inline namespace chrono_literals {
constexpr chrono::deciseconds operator "" _ds(unsigned long long x) constexpr chrono::deciseconds operator "" _ds(unsigned long long x)
{ {
chrono::deciseconds::rep val = static_cast<chrono::deciseconds::rep>(x); chrono::deciseconds::rep val = static_cast<chrono::deciseconds::rep>(x);
if (val < 0) { assert(val >= 0 && static_cast<unsigned long long>(val) == x);
assert(false);
}
assert(static_cast<unsigned long long>(val) == x);
return chrono::deciseconds(val); return chrono::deciseconds(val);
} }
@ -106,10 +104,7 @@ constexpr chrono::deciseconds operator "" _ds(unsigned long long x)
constexpr chrono::centiseconds operator "" _cs(unsigned long long x) constexpr chrono::centiseconds operator "" _cs(unsigned long long x)
{ {
chrono::centiseconds::rep val = static_cast<chrono::centiseconds::rep>(x); chrono::centiseconds::rep val = static_cast<chrono::centiseconds::rep>(x);
if (val < 0) { assert(val >= 0 && static_cast<unsigned long long>(val) == x);
assert(false);
}
assert(static_cast<unsigned long long>(val) == x);
return chrono::centiseconds(val); return chrono::centiseconds(val);
} }