Update to v106r80 release.

byuu says:

Any usage of natural and integer cast to 64-bit math operations now.
Hopefully this will be the last of the major changes for a bit on
nall/primitives, at least until serious work begins on removing implicit
conversion to primitive types.

I also completed the initial TLCS900H core, sans SWI (kind of a ways off
from support interrupts.) I really shouldn't say completed, though. The
micro DMA unit is missing, interrupt priority handling is missing,
there's no debugger, and, of course, there's surely dozens of absolutely
critical CPU bugs that are going to be an absolute hellscape nightmare
to track down.

It was a damn shame, right up until the very last eight instructions,
[CP|LD][I|D](R), the instruction encoding was consistent. Of course,
there could be other inconsistencies that I missed. In fact, that's
somewhat likely ... sigh.
This commit is contained in:
Tim Allen
2019-01-16 00:09:50 +11:00
parent 17fc6d8d51
commit 25145f59cc
11 changed files with 314 additions and 116 deletions

View File

@@ -2,18 +2,20 @@
namespace nall {
template<int Requested> struct Real {
enum : uint { Precision = Requested <= 32 ? 32 : 64 };
template<int Precision> struct Real {
static_assert(Precision == 32 || Precision == 64);
static inline constexpr auto bits() -> uint { return Precision; }
using type =
using ftype =
typename conditional<bits() == 32, float32_t,
typename conditional<bits() == 64, float64_t,
void>::type>::type;
inline Real() : data(0.0) {}
template<typename T> inline Real(const T& value) : data((type)value) {}
template<int Bits> inline Real(Real<Bits> value) : data((ftype)value) {}
template<typename T> inline Real(const T& value) : data((ftype)value) {}
inline operator type() const { return data; }
explicit inline operator bool() const { return data; }
inline operator float64_t() const { return data; }
inline auto operator++(int) { auto value = *this; ++data; return value; }
inline auto operator--(int) { auto value = *this; --data; return value; }
@@ -31,10 +33,10 @@ template<int Requested> struct Real {
inline auto serialize(serializer& s) { s(data); }
private:
type data;
ftype data;
};
#define lhs (long double)(typename Real<LHS>::type)l
#define lhs (float64_t)(typename Real<LHS>::type)l
#define rhs (typename Real<RHS>::type)r
template<int LHS, int RHS> inline auto operator*(Real<LHS> l, Real<RHS> r) { return Real<64>{lhs * rhs}; }
template<int LHS, int RHS> inline auto operator/(Real<LHS> l, Real<RHS> r) { return Real<64>{lhs / rhs}; }