mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 13:01:27 +12:00
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:
parent
613777afde
commit
160b131de3
38 changed files with 219 additions and 111 deletions
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include <climits>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
@ -46,7 +45,7 @@ usz cfmt_append(Dst& out, const Char* fmt, Src&& src)
|
|||
|
||||
const auto read_decimal = [&](uint result) -> uint
|
||||
{
|
||||
while (fmt[0] >= '0' && fmt[0] <= '9' && result <= (UINT_MAX / 10))
|
||||
while (fmt[0] >= '0' && fmt[0] <= '9' && result <= (uint{umax} / 10))
|
||||
{
|
||||
result = result * 10 + (fmt[0] - '0');
|
||||
fmt++, ctx.size++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue