Skip to content

Commit

Permalink
Use std::max in place of MAX macro
Browse files Browse the repository at this point in the history
  • Loading branch information
LoveMHz committed Apr 16, 2024
1 parent d27f9c7 commit b5ddbdf
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tools/cxbe/Xbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <stdlib.h>
#include <time.h>

#define MAX(x, y) (((x) > (y)) ? (x) : (y))

static const char kKernelImageName[] = "xboxkrnl.exe";
static uint32 CountNonKernelImportTableEntries(class Exe *x_Exe, uint32_t *extra_bytes);

Expand Down Expand Up @@ -410,11 +408,14 @@ Xbe::Xbe(class Exe *x_Exe, const char *x_szTitle, bool x_bRetail, const std::vec
m_SectionHeader[v].dwVirtualSize =
x_Exe->m_SectionHeader[v + 1].m_virtual_addr -
x_Exe->m_SectionHeader[v].m_virtual_addr;
else
m_SectionHeader[v].dwVirtualSize = MAX(
RoundUp(x_Exe->m_SectionHeader[v].m_virtual_size, 4),
m_SectionHeader[v].dwSizeofRaw
);
else {
m_SectionHeader[v].dwVirtualSize =
RoundUp(x_Exe->m_SectionHeader[v].m_virtual_size, 4);

// force virtual size to be at least as large as the raw size
m_SectionHeader[v].dwVirtualSize = std::max(m_SectionHeader[v].dwSizeofRaw,
m_SectionHeader[v].dwVirtualSize);
}

SectionCursor += RoundUp(m_SectionHeader[v].dwSizeofRaw, 0x1000);

Expand Down

0 comments on commit b5ddbdf

Please sign in to comment.