mirror of https://github.com/ARMmbed/mbed-os.git
mbed_chrono: restore asserts
Now that we've got a workaround for ARMC6, asserts can be restored.pull/12906/head
parent
ff2a928091
commit
fd933b4c72
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue