Common: Use fmt where applicable

Begins the transition to using fmt for string formatting where
applicable. Given fmt supports formatting std::string instances out of
the box, we can remove now-unnecessary calls to .c_str() and .data().

Note that this change does not touch the actual logging subsystem aside
from converting the final StringFromFormat call in the process over to
fmt::format. Given our logging system is heavily used throughout the
entire codebase, and converting that over will be quite a large change
by itself, this will be tackled near the end of the conversion process.
This commit is contained in:
Lioncash
2019-06-14 10:53:46 -04:00
parent 925afcae3b
commit 5b92d5076a
13 changed files with 287 additions and 263 deletions

View File

@ -93,42 +93,6 @@ private:
static u32* DoDisassembly(bool big_endian);
static u32 HelperRotateMask(int r, int mb, int me)
{
// first make 001111111111111 part
unsigned int begin = 0xFFFFFFFF >> mb;
// then make 000000000001111 part, which is used to flip the bits of the first one
unsigned int end = me < 31 ? (0xFFFFFFFF >> (me + 1)) : 0;
// do the bitflip
unsigned int mask = begin ^ end;
// and invert if backwards
if (me < mb)
mask = ~mask;
// rotate the mask so it can be applied to source reg
// return _rotl(mask, 32 - r);
return (mask << (32 - r)) | (mask >> r);
}
static std::string ldst_offs(u32 val)
{
if (val == 0)
{
return "0";
}
else
{
if (val & 0x8000)
{
return StringFromFormat("-0x%.4X", ((~val) & 0xffff) + 1);
}
else
{
return StringFromFormat("0x%.4X", val);
}
}
}
static int SEX12(u32 x) { return x & 0x800 ? (x | 0xFFFFF000) : x; }
enum InstructionType
{
PPCINSTR_OTHER = 0, // No additional info for other instr.