From 71bb7877982c91b70a79510b02cbd32281b585e9 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 11 Sep 2016 13:08:41 +0900 Subject: [PATCH] Common: Use unlikely() to optimise for the common path in GetUserPath(). --- src/common/file_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 84fe95c8c..1dc9629c1 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -727,7 +727,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new static std::string paths[NUM_PATH_INDICES]; // Set up all paths and files on the first run - if (paths[D_USER_IDX].empty()) + if (unlikely(paths[D_USER_IDX].empty())) { #ifdef _WIN32 paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; @@ -768,7 +768,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; } - if (!newPath.empty()) + if (unlikely(!newPath.empty())) { if (!FileUtil::IsDirectory(newPath)) {