summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-26 00:25:10 +0200
committerLioncash <mathew1800@gmail.com>2018-09-26 02:06:21 +0200
commit4654f896184fa1b97df5920ef775f033c2b2fcbb (patch)
treeec4de57719d35ff3350f2a82ce67649e3444d134 /src/core
parentfsmitm_romfsbuild: Remove unnecessary constructors and initializers for RomFSBuildFileContext and RomFSBuildDirectoryContext (diff)
downloadyuzu-4654f896184fa1b97df5920ef775f033c2b2fcbb.tar
yuzu-4654f896184fa1b97df5920ef775f033c2b2fcbb.tar.gz
yuzu-4654f896184fa1b97df5920ef775f033c2b2fcbb.tar.bz2
yuzu-4654f896184fa1b97df5920ef775f033c2b2fcbb.tar.lz
yuzu-4654f896184fa1b97df5920ef775f033c2b2fcbb.tar.xz
yuzu-4654f896184fa1b97df5920ef775f033c2b2fcbb.tar.zst
yuzu-4654f896184fa1b97df5920ef775f033c2b2fcbb.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/fsmitm_romfsbuild.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/core/file_sys/fsmitm_romfsbuild.cpp b/src/core/file_sys/fsmitm_romfsbuild.cpp
index 20dd69570..07b074817 100644
--- a/src/core/file_sys/fsmitm_romfsbuild.cpp
+++ b/src/core/file_sys/fsmitm_romfsbuild.cpp
@@ -105,13 +105,16 @@ static u32 romfs_calc_path_hash(u32 parent, std::string path, u32 start, std::si
return hash;
}
-static u32 romfs_get_hash_table_count(u32 num_entries) {
+static u64 romfs_get_hash_table_count(u64 num_entries) {
if (num_entries < 3) {
return 3;
- } else if (num_entries < 19) {
+ }
+
+ if (num_entries < 19) {
return num_entries | 1;
}
- u32 count = num_entries;
+
+ u64 count = num_entries;
while (count % 2 == 0 || count % 3 == 0 || count % 5 == 0 || count % 7 == 0 ||
count % 11 == 0 || count % 13 == 0 || count % 17 == 0) {
count++;
@@ -137,7 +140,7 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs,
const auto child = std::make_shared<RomFSBuildDirectoryContext>();
// Set child's path.
child->cur_path_ofs = parent->path_len + 1;
- child->path_len = child->cur_path_ofs + kv.first.size();
+ child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
child->path = parent->path + "/" + kv.first;
// Sanity check on path_len
@@ -150,7 +153,7 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs,
const auto child = std::make_shared<RomFSBuildFileContext>();
// Set child's path.
child->cur_path_ofs = parent->path_len + 1;
- child->path_len = child->cur_path_ofs + kv.first.size();
+ child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
child->path = parent->path + "/" + kv.first;
// Sanity check on path_len
@@ -217,8 +220,8 @@ RomFSBuildContext::RomFSBuildContext(VirtualDir base_) : base(std::move(base_))
RomFSBuildContext::~RomFSBuildContext() = default;
std::map<u64, VirtualFile> RomFSBuildContext::Build() {
- const auto dir_hash_table_entry_count = romfs_get_hash_table_count(num_dirs);
- const auto file_hash_table_entry_count = romfs_get_hash_table_count(num_files);
+ const u64 dir_hash_table_entry_count = romfs_get_hash_table_count(num_dirs);
+ const u64 file_hash_table_entry_count = romfs_get_hash_table_count(num_files);
dir_hash_table_size = 4 * dir_hash_table_entry_count;
file_hash_table_size = 4 * file_hash_table_entry_count;