Common: Use unlikely() to optimise for the common path in GetUserPath().

This commit is contained in:
Emmanuel Gil Peyrot 2016-09-11 13:08:41 +09:00
parent d909f18195
commit 71bb787798

View File

@ -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))
{