- replaced MIN/MAX in common code.

This commit is contained in:
Christoph Oelckers 2021-10-30 10:46:17 +02:00
commit eb69bbcae0
63 changed files with 200 additions and 236 deletions

View file

@ -8896,7 +8896,7 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build)
ArgList.ShrinkToFit();
if (!staticcall) emitters.SetVirtualReg(selfemit.RegNum);
int resultcount = vmfunc->Proto->ReturnTypes.Size() == 0 ? 0 : std::max(AssignCount, 1);
int resultcount = vmfunc->Proto->ReturnTypes.Size() == 0 ? 0 : max(AssignCount, 1);
assert((unsigned)resultcount <= vmfunc->Proto->ReturnTypes.Size());
for (int i = 0; i < resultcount; i++)

View file

@ -345,7 +345,7 @@ PField *PSymbolTable::AddField(FName name, PType *type, uint32_t flags, unsigned
// its fields.
if (Align != nullptr)
{
*Align = MAX(*Align, type->Align);
*Align = max(*Align, type->Align);
}
if (AddSymbol(field) == nullptr)

View file

@ -1702,7 +1702,7 @@ bool PArray::ReadValue(FSerializer &ar, const char *key, void *addr) const
{
bool readsomething = false;
unsigned count = ar.ArraySize();
unsigned loop = std::min(count, ElementCount);
unsigned loop = min(count, ElementCount);
uint8_t *addrb = (uint8_t *)addr;
for(unsigned i=0;i<loop;i++)
{

View file

@ -677,7 +677,7 @@ static int print_reg(FILE *out, int col, int arg, int mode, int immshift, const
void DumpFunction(FILE *dump, VMScriptFunction *sfunc, const char *label, int labellen)
{
const char *marks = "=======================================================";
fprintf(dump, "\n%.*s %s %.*s", MAX(3, 38 - labellen / 2), marks, label, MAX(3, 38 - labellen / 2), marks);
fprintf(dump, "\n%.*s %s %.*s", max(3, 38 - labellen / 2), marks, label, max(3, 38 - labellen / 2), marks);
fprintf(dump, "\nInteger regs: %-3d Float regs: %-3d Address regs: %-3d String regs: %-3d\nStack size: %d\n",
sfunc->NumRegD, sfunc->NumRegF, sfunc->NumRegA, sfunc->NumRegS, sfunc->MaxParam);
VMDumpConstants(dump, sfunc);

View file

@ -80,7 +80,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, StatusbarToRealCoords, StatusbarTo
if (numret > 1) ret[1].SetFloat(y);
if (numret > 2) ret[2].SetFloat(w);
if (numret > 3) ret[3].SetFloat(h);
return MIN(4, numret);
return min(4, numret);
}
void SBar_DrawTexture(DStatusBarCore* self, int texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY, int style, int color, int translation, double clipwidth)
@ -228,7 +228,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, TransformRect, SBar_TransformRect)
if (numret > 1) ret[1].SetFloat(y);
if (numret > 2) ret[2].SetFloat(w);
if (numret > 3) ret[3].SetFloat(h);
return MIN(4, numret);
return min(4, numret);
}
static void SBar_Fill(DStatusBarCore* self, int color, double x, double y, double w, double h, int flags)
@ -437,7 +437,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, GetSize, GetTextureSize)
x = GetTextureSize(texid, &y);
if (numret > 0) ret[0].SetInt(x);
if (numret > 1) ret[1].SetInt(y);
return MIN(numret, 2);
return min(numret, 2);
}
//==========================================================================
@ -941,7 +941,7 @@ DEFINE_ACTION_FUNCTION(FKeyBindings, GetKeysForCommand)
self->GetKeysForCommand(cmd.GetChars(), &k1, &k2);
if (numret > 0) ret[0].SetInt(k1);
if (numret > 1) ret[1].SetInt(k2);
return MIN(numret, 2);
return min(numret, 2);
}
DEFINE_ACTION_FUNCTION(FKeyBindings, GetAllKeysForCommand)

View file

@ -56,7 +56,7 @@ static void *AllocJitMemory(size_t size)
}
else
{
const size_t bytesToAllocate = std::max(size_t(1024 * 1024), size);
const size_t bytesToAllocate = max(size_t(1024 * 1024), size);
size_t allocatedSize = 0;
void *p = OSUtils::allocVirtualMemory(bytesToAllocate, &allocatedSize, OSUtils::kVMWritable | OSUtils::kVMExecutable);
if (!p)
@ -803,7 +803,7 @@ static int CaptureStackTrace(int max_frames, void **out_frames)
#elif defined(WIN32)
// JIT isn't supported here, so just do nothing.
return 0;//return RtlCaptureStackBackTrace(0, MIN(max_frames, 32), out_frames, nullptr);
return 0;//return RtlCaptureStackBackTrace(0, min(max_frames, 32), out_frames, nullptr);
#else
return backtrace(out_frames, max_frames);
#endif

View file

@ -746,7 +746,7 @@ ADD_STAT(VM)
for (auto d : VMCycles)
{
added += d.TimeMS();
peak = MAX<double>(peak, d.TimeMS());
peak = max<double>(peak, d.TimeMS());
}
for (auto d : VMCalls) addedc += d;
memmove(&VMCycles[1], &VMCycles[0], 9 * sizeof(cycle_t));