Browse Source
Merge pull request #2340 from lioncash/view
file_sys/fsmitm_romfsbuild: Utilize a string_view in romfs_calc_path_hash
pull/15/merge
bunnei
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
1 deletions
-
src/core/file_sys/fsmitm_romfsbuild.cpp
|
|
|
@ -23,6 +23,7 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
#include <string_view>
|
|
|
|
#include "common/alignment.h"
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include "core/file_sys/fsmitm_romfsbuild.h"
|
|
|
|
@ -97,7 +98,8 @@ struct RomFSBuildFileContext { |
|
|
|
VirtualFile source; |
|
|
|
}; |
|
|
|
|
|
|
|
static u32 romfs_calc_path_hash(u32 parent, std::string path, u32 start, std::size_t path_len) { |
|
|
|
static u32 romfs_calc_path_hash(u32 parent, std::string_view path, u32 start, |
|
|
|
std::size_t path_len) { |
|
|
|
u32 hash = parent ^ 123456789; |
|
|
|
for (u32 i = 0; i < path_len; i++) { |
|
|
|
hash = (hash >> 5) | (hash << 27); |
|
|
|
|