bsnes/nall
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
..
arithmetic Update to v106r65 release. 2018-10-04 20:12:11 +10:00
beat Update to v106r65 release. 2018-10-04 20:12:11 +10:00
cipher Update to v106r60 release. 2018-09-03 00:06:41 +10:00
database Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
decode Update to v106r65 release. 2018-10-04 20:12:11 +10:00
dsp Update to v106r67 release. 2018-12-21 11:01:14 +11:00
elliptic-curve Update to v106r65 release. 2018-10-04 20:12:11 +10:00
emulation Update to v106r65 release. 2018-10-04 20:12:11 +10:00
encode Update to v106r65 release. 2018-10-04 20:12:11 +10:00
hash Update to v106r59 release. 2018-08-26 16:49:54 +10:00
http Update to v106r47 release. 2018-07-14 13:59:29 +10:00
image Update to v106r57 release. 2018-08-08 18:46:58 +10:00
mac Update to v106r65 release. 2018-10-04 20:12:11 +10:00
macos Update to v106r45 release. 2018-07-02 11:57:04 +10:00
posix Update to v106r30 release. 2018-05-28 11:16:27 +10:00
string Update to v106r69 release. 2019-01-02 10:52:08 +11:00
vector Update to v106r68 release. 2018-12-22 21:28:15 +11:00
vfs Update to v106r65 release. 2018-10-04 20:12:11 +10:00
windows Update to v106r73 release. 2019-01-07 18:59:04 +11:00
xorg Update to v101r19 release. 2016-10-28 08:16:58 +11:00
GNUmakefile Update to v106r66 release. 2018-12-20 11:55:47 +11:00
adaptive-array.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
algorithm.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
any.hpp Update to v101r19 release. 2016-10-28 08:16:58 +11:00
arguments.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
arithmetic.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
array-span.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
array-view.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
array.hpp Update to v106r59 release. 2018-08-26 16:49:54 +10:00
atoi.hpp Update to v101r02 release. 2016-08-09 21:07:18 +10:00
bit-field.hpp Update to v099r15 release. 2016-07-04 21:48:17 +10:00
bit-vector.hpp Update to v106r30 release. 2018-05-28 11:16:27 +10:00
bit.hpp Update to v101r02 release. 2016-08-09 21:07:18 +10:00
chrono.hpp Update to v100r16 release. 2016-08-03 22:32:40 +10:00
counting-sort.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
directory.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
dl.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
endian.hpp Update to v106r71 release. 2019-01-05 11:35:26 +11:00
file-buffer.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
file-map.hpp Update to v106r66 release. 2018-12-20 11:55:47 +11:00
file.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
function.hpp Update to v106r54 release. 2018-08-04 21:44:00 +10:00
hashset.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
hid.hpp Update to 20180728 release. 2018-07-28 21:25:42 +10:00
image.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
induced-sort.hpp Update to v106r59 release. 2018-08-26 16:49:54 +10:00
inode.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
interpolation.hpp Update to v098r14 release. 2016-06-01 21:23:22 +10:00
intrinsics.hpp Update to v106r66 release. 2018-12-20 11:55:47 +11:00
iterator.hpp Update to v106r68 release. 2018-12-22 21:28:15 +11:00
locale.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
location.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
main.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
map.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
matrix.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
maybe.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
memory.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
merge-sort.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
nall.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
path.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
platform.hpp Update to v106r73 release. 2019-01-07 18:59:04 +11:00
pointer.hpp Update to v106r36 release. 2018-06-04 12:44:57 +10:00
primitives.hpp Update to v106r76 release. 2019-01-11 12:51:18 +11:00
property.hpp Update to v099r09 release. 2016-06-25 18:53:11 +10:00
queue.hpp Update to 20180808 release. 2018-08-09 14:16:46 +10:00
random.hpp Update to v106r69 release. 2019-01-02 10:52:08 +11:00
range.hpp Update to v106r68 release. 2018-12-22 21:28:15 +11:00
run.hpp Update to v106r52 release. 2018-07-25 22:24:03 +10:00
serial.hpp Update to v098r08 release. 2016-05-02 19:57:04 +10:00
serializer.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
service.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
set.hpp Update to v098r11 release. 2016-05-25 21:13:02 +10:00
shared-memory.hpp Update to 20160106 OS X Preview for Developers release. 2016-01-07 19:17:15 +11:00
shared-pointer.hpp Update to v106r59 release. 2018-08-26 16:49:54 +10:00
simd.hpp Update to v106r53 release. 2018-08-01 19:07:28 +10:00
smtp.hpp Update to v106r58 release. 2018-08-21 13:17:12 +10:00
stdint.hpp Update to v101r19 release. 2016-10-28 08:16:58 +11:00
string.hpp Update to v106r69 release. 2019-01-02 10:52:08 +11:00
suffix-array.hpp Update to v106r60 release. 2018-09-03 00:06:41 +10:00
terminal.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
thread.hpp Update to v101r02 release. 2016-08-09 21:07:18 +10:00
traits.hpp Update to v106r65 release. 2018-10-04 20:12:11 +10:00
unique-pointer.hpp Update to v097r02 release. 2016-01-25 22:27:18 +11:00
utility.hpp Update to v101r15 release. 2016-09-04 23:51:27 +10:00
varint.hpp Update to v101r02 release. 2016-08-09 21:07:18 +10:00
vector.hpp Update to v106r68 release. 2018-12-22 21:28:15 +11:00
vfs.hpp Update to v099r05 release. 2016-06-20 21:00:32 +10:00
view.hpp Update to v106r52 release. 2018-07-25 22:24:03 +10:00