diff options
author | 2016-11-19 05:35:54 +1100 | |
---|---|---|
committer | 2016-11-19 05:38:48 +1100 | |
commit | 8179a84458204a5e767446fcf7d10f032a40fd0c (patch) | |
tree | 16105e1667f811dcb24dbf0fc255166cb06df5c2 /src/emu/attotime.cpp | |
parent | 1b489fe83034072149fb0637b20c7ba57dc72a7a (diff) |
Introduce u8/u16/u32/u64/s8/s16/s32/s64
* New abbreviated types are in osd and util namespaces, and also in global namespace for things that #include "emu.h"
* Get rid of import of cstdint types to global namespace (C99 does this anyway)
* Remove the cstdint types from everything in emu
* Get rid of U64/S64 macros
* Fix a bug in dps16 caused by incorrect use of macro
* Fix debugcon not checking for "do " prefix case-insensitively
* Fix a lot of messed up tabulation
* More constexpr
* Fix up many __names
Diffstat (limited to 'src/emu/attotime.cpp')
-rw-r--r-- | src/emu/attotime.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/emu/attotime.cpp b/src/emu/attotime.cpp index 6df7487dfc7..e756aa9653d 100644 --- a/src/emu/attotime.cpp +++ b/src/emu/attotime.cpp @@ -29,7 +29,7 @@ const attotime attotime::never(ATTOTIME_MAX_SECONDS, 0); // constant //------------------------------------------------- -attotime &attotime::operator*=(uint32_t factor) +attotime &attotime::operator*=(u32 factor) { // if one of the items is attotime::never, return attotime::never if (m_seconds >= ATTOTIME_MAX_SECONDS) @@ -40,17 +40,17 @@ attotime &attotime::operator*=(uint32_t factor) return *this = zero; // split attoseconds into upper and lower halves which fit into 32 bits - uint32_t attolo; - uint32_t attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); + u32 attolo; + u32 attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); // scale the lower half, then split into high/low parts - uint64_t temp = mulu_32x32(attolo, factor); - uint32_t reslo; + u64 temp = mulu_32x32(attolo, factor); + u32 reslo; temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reslo); // scale the upper half, then split into high/low parts temp += mulu_32x32(attohi, factor); - uint32_t reshi; + u32 reshi; temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reshi); // scale the seconds @@ -69,7 +69,7 @@ attotime &attotime::operator*=(uint32_t factor) // operator/= - divide an attotime by a constant //------------------------------------------------- -attotime &attotime::operator/=(uint32_t factor) +attotime &attotime::operator/=(u32 factor) { // if one of the items is attotime::never, return attotime::never if (m_seconds >= ATTOTIME_MAX_SECONDS) @@ -80,20 +80,20 @@ attotime &attotime::operator/=(uint32_t factor) return *this; // split attoseconds into upper and lower halves which fit into 32 bits - uint32_t attolo; - uint32_t attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); + u32 attolo; + u32 attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); // divide the seconds and get the remainder - uint32_t remainder; + u32 remainder; m_seconds = divu_64x32_rem(m_seconds, factor, &remainder); // combine the upper half of attoseconds with the remainder and divide that - uint64_t temp = (int64_t)attohi + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); - uint32_t reshi = divu_64x32_rem(temp, factor, &remainder); + u64 temp = s64(attohi) + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); + u32 reshi = divu_64x32_rem(temp, factor, &remainder); // combine the lower half of attoseconds with the remainder and divide that temp = attolo + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); - uint32_t reslo = divu_64x32_rem(temp, factor, &remainder); + u32 reslo = divu_64x32_rem(temp, factor, &remainder); // round based on the remainder m_attoseconds = (attoseconds_t)reslo + mulu_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); @@ -129,7 +129,7 @@ const char *attotime::as_string(int precision) const // case 2: we want 9 or fewer digits of precision else if (precision <= 9) { - uint32_t upper = m_attoseconds / ATTOSECONDS_PER_SECOND_SQRT; + u32 upper = m_attoseconds / ATTOSECONDS_PER_SECOND_SQRT; int temp = precision; while (temp < 9) { @@ -142,8 +142,8 @@ const char *attotime::as_string(int precision) const // case 3: more than 9 digits of precision else { - uint32_t lower; - uint32_t upper = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); + u32 lower; + u32 upper = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); int temp = precision; while (temp < 18) { |