summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author RobertoFresca <robbie@mamedev.org>2018-01-26 03:53:22 -0300
committer RobertoFresca <robbie@mamedev.org>2018-01-26 03:53:22 -0300
commitd5bef691cbdcf6d510d01122cbccb58575230399 (patch)
tree0a0149fb5c224e2a355f300b61b44927e0effb9d
parent39b50f52638342d90a3974a51f0d04b114ccff6e (diff)
parenta9a9c45871801d97da9ac751b394f0f8119bd878 (diff)
Merge branch 'master' of https://github.com/mamedev/mame
-rw-r--r--src/emu/attotime.h16
-rw-r--r--src/emu/xtal.h12
2 files changed, 18 insertions, 10 deletions
diff --git a/src/emu/attotime.h b/src/emu/attotime.h
index 2b8f75450f9..414e65d81d2 100644
--- a/src/emu/attotime.h
+++ b/src/emu/attotime.h
@@ -35,6 +35,9 @@
#pragma once
+#include "emucore.h"
+#include "xtal.h"
+
#include <math.h>
#undef min
#undef max
@@ -48,13 +51,13 @@ typedef s64 attoseconds_t;
typedef s32 seconds_t;
// core definitions
-const attoseconds_t ATTOSECONDS_PER_SECOND_SQRT = 1'000'000'000;
-const attoseconds_t ATTOSECONDS_PER_SECOND = ATTOSECONDS_PER_SECOND_SQRT * ATTOSECONDS_PER_SECOND_SQRT;
-const attoseconds_t ATTOSECONDS_PER_MILLISECOND = ATTOSECONDS_PER_SECOND / 1'000;
-const attoseconds_t ATTOSECONDS_PER_MICROSECOND = ATTOSECONDS_PER_SECOND / 1'000'000;
-const attoseconds_t ATTOSECONDS_PER_NANOSECOND = ATTOSECONDS_PER_SECOND / 1'000'000'000;
+constexpr attoseconds_t ATTOSECONDS_PER_SECOND_SQRT = 1'000'000'000;
+constexpr attoseconds_t ATTOSECONDS_PER_SECOND = ATTOSECONDS_PER_SECOND_SQRT * ATTOSECONDS_PER_SECOND_SQRT;
+constexpr attoseconds_t ATTOSECONDS_PER_MILLISECOND = ATTOSECONDS_PER_SECOND / 1'000;
+constexpr attoseconds_t ATTOSECONDS_PER_MICROSECOND = ATTOSECONDS_PER_SECOND / 1'000'000;
+constexpr attoseconds_t ATTOSECONDS_PER_NANOSECOND = ATTOSECONDS_PER_SECOND / 1'000'000'000;
-const seconds_t ATTOTIME_MAX_SECONDS = 1'000'000'000;
+constexpr seconds_t ATTOTIME_MAX_SECONDS = 1'000'000'000;
@@ -70,7 +73,6 @@ inline constexpr attoseconds_t DOUBLE_TO_ATTOSECONDS(double x) { return attoseco
inline constexpr double ATTOSECONDS_TO_HZ(attoseconds_t x) { return double(ATTOSECONDS_PER_SECOND) / double(x); }
template <typename T> inline constexpr attoseconds_t HZ_TO_ATTOSECONDS(T &&x) { return attoseconds_t(ATTOSECONDS_PER_SECOND / x); }
inline constexpr attoseconds_t HZ_TO_ATTOSECONDS(const XTAL &x) { return attoseconds_t(ATTOSECONDS_PER_SECOND / x.dvalue()); }
-inline constexpr attoseconds_t HZ_TO_ATTOSECONDS(XTAL &&x) { return attoseconds_t(ATTOSECONDS_PER_SECOND / x.dvalue()); }
// macros for converting other seconds types to attoseconds
template <typename T> inline constexpr attoseconds_t ATTOSECONDS_IN_SEC(T &&x) { return attoseconds_t(x) * ATTOSECONDS_PER_SECOND; }
diff --git a/src/emu/xtal.h b/src/emu/xtal.h
index 34f4142b37c..6860d38fae6 100644
--- a/src/emu/xtal.h
+++ b/src/emu/xtal.h
@@ -36,8 +36,10 @@ Usage:
***************************************************************************/
-#ifndef MAME_EMU_DRIVERS_XTAL_H
-#define MAME_EMU_DRIVERS_XTAL_H
+#ifndef MAME_EMU_XTAL_H
+#define MAME_EMU_XTAL_H
+
+#include "emucore.h"
#pragma once
@@ -90,4 +92,8 @@ constexpr XTAL operator ""_Hz_XTAL(long double clock) { return XTAL(double(clock
constexpr XTAL operator ""_kHz_XTAL(long double clock) { return XTAL(double(clock * 1e3)); }
constexpr XTAL operator ""_MHz_XTAL(long double clock) { return XTAL(double(clock * 1e6)); }
-#endif // MAME_EMU_DRIVERS_XTAL_H
+constexpr XTAL operator ""_Hz_XTAL(unsigned long long clock) { return XTAL(double(clock)); }
+constexpr XTAL operator ""_kHz_XTAL(unsigned long long clock) { return XTAL(double(clock) * 1e3); }
+constexpr XTAL operator ""_MHz_XTAL(unsigned long long clock) { return XTAL(double(clock) * 1e6); }
+
+#endif // MAME_EMU_XTAL_H