Commit 48a2981a authored by Jack Andersen's avatar Jack Andersen

Shared NFS data class not necessary

parent 19604b2a
......@@ -54,14 +54,21 @@
namespace nod {
/* define our own min/max to avoid MSVC BS */
template <typename T>
inline T min(T a, T b) {
constexpr T min(T a, T b) {
return a < b ? a : b;
}
template <typename T>
inline T max(T a, T b) {
constexpr T max(T a, T b) {
return a > b ? a : b;
}
/* template-based div for flexible typing and avoiding a library call */
template <typename T>
constexpr auto div(T a, T b) {
struct DivTp { T quot, rem; };
return DivTp{a / b, a % b};
}
/* Log Module */
extern logvisor::Module LogModule;
......
This diff is collapsed.
......@@ -373,7 +373,7 @@ public:
}
uint64_t position() const override { return m_offset; }
uint64_t read(void* buf, uint64_t length) override {
auto blockAndRemOff = std::lldiv(m_offset, 0x7c00);
auto blockAndRemOff = nod::div(m_offset, uint64_t(0x7c00));
uint64_t rem = length;
uint8_t* dst = (uint8_t*)buf;
......@@ -1239,7 +1239,7 @@ std::optional<uint64_t> DiscBuilderWii::CalculateTotalSizeRequired(SystemStringV
std::optional<uint64_t> sz = DiscBuilderBase::PartitionBuilderBase::CalculateTotalSizeBuild(dirIn, PartitionKind::Data, true);
if (!sz)
return sz;
auto szDiv = std::lldiv(*sz, 0x1F0000);
auto szDiv = nod::div(*sz, uint64_t(0x1F0000));
if (szDiv.rem)
++szDiv.quot;
sz = szDiv.quot * 0x200000;
......@@ -1346,7 +1346,7 @@ std::optional<uint64_t> DiscMergerWii::CalculateTotalSizeRequired(DiscWii& sourc
std::optional<uint64_t> sz = DiscBuilderBase::PartitionBuilderBase::CalculateTotalSizeMerge(sourceDisc.getDataPartition(), dirIn);
if (!sz)
return std::nullopt;
auto szDiv = std::lldiv(*sz, 0x1F0000);
auto szDiv = nod::div(*sz, uint64_t(0x1F0000));
if (szDiv.rem)
++szDiv.quot;
sz = szDiv.quot * 0x200000;
......
......@@ -68,16 +68,14 @@ std::unique_ptr<DiscBase> OpenDiscFromImage(SystemStringView path, bool& isWii)
std::unique_ptr<DiscBase> ret;
if (isWii) {
ret = std::make_unique<DiscWii>(std::move(discIO), err);
if (err) {
return nullptr;
}
if (err)
return {};
return ret;
}
ret = std::make_unique<DiscGCN>(std::move(discIO), err);
if (err) {
return nullptr;
}
if (err)
return {};
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment