Tim Allen c9f7c6c4be Update to v106r76 release.
byuu says:

I added some useful new functions to nall/primitives:

    auto Natural<T>::integer() const -> Integer<T>;
    auto Integer<T>::natural() const -> Natural<T>;

These let you cast between signed and unsigned representation without
having to care about the value of T (eg if you take a Natural<T> as a
template parameter.) So for instance when you're given an unsigned type
but it's supposed to be a sign-extended type (example: signed
multiplication), eg Natural<T> → Integer<T>, you can just say:

    x = y.integer() * z.integer();

The TLCS900H core gained some more pesky instructions such as DAA, BS1F,
BS1B.

I stole an optimization from RACE for calculating the overflow flag on
addition. Assuming: z = x + y + c;

    Before: ~(x ^ y) & (x ^ z) & signBit;
    After: (x ^ z) & (y ^ z) & signBit;

Subtraction stays the same. Assuming: z = x - y - c;

    Same: (x ^ y) & (x ^ z) & signBit;

However, taking a speed penalty, I've implemented the carry computation
in a way that doesn't require an extra bit.

Adding before:

    uint9 z = x + y + c;
    c = z & 0x100;

Subtracting before:

    uint9 z = x - y - c;
    c = z & 0x100;

Adding after:

    uint8 z = x + y + c;
    c = z < x || z == x && c;

Subtracting after:

    uint8 z = x - y - c;
    c = z > x || z == x && c;

I haven't been able to code golf the new carry computation to be any
shorter, unless I include an extra bit, eg for adding:

    c = z < x + c;

But that defeats the entire point of the change. I want the computation
to work even when T is uintmax_t.

If anyone can come up with a faster method, please let me know.

Anyway ... I also had to split off INC and DEC because they compute
flags differently (word and long modes don't set flags at all, byte mode
doesn't set carry at all.)

I also added division by zero support, although I don't know if it's
actually hardware accurate. It's what other emulators do, though.
2019-01-11 12:51:18 +11:00
..
2018-10-04 20:12:11 +10:00
2018-10-04 20:12:11 +10:00
2018-09-03 00:06:41 +10:00
2018-10-04 20:12:11 +10:00
2018-12-21 11:01:14 +11:00
2018-10-04 20:12:11 +10:00
2018-10-04 20:12:11 +10:00
2018-10-04 20:12:11 +10:00
2018-08-26 16:49:54 +10:00
2018-07-14 13:59:29 +10:00
2018-08-08 18:46:58 +10:00
2018-10-04 20:12:11 +10:00
2018-07-02 11:57:04 +10:00
2018-05-28 11:16:27 +10:00
2019-01-02 10:52:08 +11:00
2018-12-22 21:28:15 +11:00
2018-10-04 20:12:11 +10:00
2019-01-07 18:59:04 +11:00
2016-10-28 08:16:58 +11:00
2018-08-21 13:17:12 +10:00
2016-10-28 08:16:58 +11:00
2018-10-04 20:12:11 +10:00
2018-10-04 20:12:11 +10:00
2018-10-04 20:12:11 +10:00
2018-10-04 20:12:11 +10:00
2018-08-26 16:49:54 +10:00
2016-08-09 21:07:18 +10:00
2016-07-04 21:48:17 +10:00
2018-05-28 11:16:27 +10:00
2016-08-09 21:07:18 +10:00
2016-08-03 22:32:40 +10:00
2018-08-21 13:17:12 +10:00
2018-10-04 20:12:11 +10:00
2018-08-21 13:17:12 +10:00
2019-01-05 11:35:26 +11:00
2018-10-04 20:12:11 +10:00
2018-12-20 11:55:47 +11:00
2018-10-04 20:12:11 +10:00
2018-08-04 21:44:00 +10:00
2018-12-20 11:55:47 +11:00
2016-05-25 21:13:02 +10:00
2018-07-28 21:25:42 +10:00
2018-10-04 20:12:11 +10:00
2018-08-26 16:49:54 +10:00
2018-10-04 20:12:11 +10:00
2016-06-01 21:23:22 +10:00
2018-12-20 11:55:47 +11:00
2018-12-22 21:28:15 +11:00
2018-08-21 13:17:12 +10:00
2018-10-04 20:12:11 +10:00
2018-10-04 20:12:11 +10:00
2018-08-21 13:17:12 +10:00
2018-08-21 13:17:12 +10:00
2018-08-21 13:17:12 +10:00
2018-08-21 13:17:12 +10:00
2018-10-04 20:12:11 +10:00
2018-10-04 20:12:11 +10:00
2019-01-07 18:59:04 +11:00
2018-06-04 12:44:57 +10:00
2019-01-11 12:51:18 +11:00
2016-06-25 18:53:11 +10:00
2018-08-09 14:16:46 +10:00
2019-01-02 10:52:08 +11:00
2018-12-22 21:28:15 +11:00
2018-07-25 22:24:03 +10:00
2016-05-02 19:57:04 +10:00
2018-10-04 20:12:11 +10:00
2016-05-25 21:13:02 +10:00
2018-08-26 16:49:54 +10:00
2018-08-01 19:07:28 +10:00
2018-08-21 13:17:12 +10:00
2016-10-28 08:16:58 +11:00
2019-01-02 10:52:08 +11:00
2018-09-03 00:06:41 +10:00
2018-10-04 20:12:11 +10:00
2016-08-09 21:07:18 +10:00
2018-10-04 20:12:11 +10:00
2016-01-25 22:27:18 +11:00
2016-09-04 23:51:27 +10:00
2016-08-09 21:07:18 +10:00
2018-12-22 21:28:15 +11:00
2016-06-20 21:00:32 +10:00
2018-07-25 22:24:03 +10:00