From 28e36de56f6c04c7f3b9db0cf78d781093a819a1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 5 Apr 2019 15:11:12 -0400 Subject: [PATCH] file_sys/fsmitm_romfsbuild: Utilize a string_view in romfs_calc_path_hash() The given string instance doesn't need to be copied entirely, we can just use a view instead. --- src/core/file_sys/fsmitm_romfsbuild.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/file_sys/fsmitm_romfsbuild.cpp b/src/core/file_sys/fsmitm_romfsbuild.cpp index 47b7526c7d..d126ae8dd0 100644 --- a/src/core/file_sys/fsmitm_romfsbuild.cpp +++ b/src/core/file_sys/fsmitm_romfsbuild.cpp @@ -23,6 +23,7 @@ */ #include +#include #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);