types.hpp: implement smin, smax, amin, amax

Rewritten the following global utility constants:
`umax` returns max number, restricted to unsigned.
`smax` returns max signed number, restricted to integrals.
`smin` returns min signed number, restricted to signed.
`amin` returns smin or zero, less restricted.
`amax` returns smax or umax, less restricted.

Fix operators == and <=> for synthesized rel-ops.
This commit is contained in:
Nekotekina 2021-05-22 10:35:15 +03:00
parent 613777afde
commit 160b131de3
38 changed files with 219 additions and 111 deletions

View file

@ -368,7 +368,7 @@ namespace spu
std::array<u32, 2> op_branch_targets(u32 pc, spu_opcode_t op)
{
std::array<u32, 2> res{spu_branch_target(pc + 4), UINT32_MAX};
std::array<u32, 2> res{spu_branch_target(pc + 4), umax};
switch (const auto type = s_spu_itype.decode(op.opcode))
{
@ -396,7 +396,7 @@ std::array<u32, 2> op_branch_targets(u32 pc, spu_opcode_t op)
case spu_itype::UNK:
{
res[0] = UINT32_MAX;
res[0] = umax;
break;
}
default: break;
@ -2728,7 +2728,7 @@ bool spu_thread::do_putllc(const spu_mfc_cmd& args)
{
switch (u64 count = spu_putllc_tx(addr, rtime, rdata, to_write))
{
case UINT64_MAX:
case umax:
{
auto& data = *vm::get_super_ptr<spu_rdata_t>(addr);