Skip to content

Commit

Permalink
Use attributes to minimize branch prediction misses
Browse files Browse the repository at this point in the history
  • Loading branch information
eschan145 authored Jan 28, 2025
1 parent 64b4e72 commit d4c6911
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ DK_API uint64_t dyknow_size(const std::string& directory) {

std::string filename = data.cFileName;

if ((filename == ".") || (filename == "..")) {
if ((filename == ".") || (filename == "..")) [[unlikely]] {
continue;
}

Expand Down Expand Up @@ -400,7 +400,7 @@ DK_API bool taskkill(DWORD identifier, KillMethod method) {
case KillMethod::WIN32_API: {
HANDLE process = OpenProcess(PROCESS_TERMINATE, FALSE, identifier);

if (process) {
if (process) [[likely]] {
// Bam, terminated!
TerminateProcess(process, static_cast<UINT>(-1));
// -1 is the exit code for the process - in this case,
Expand Down

0 comments on commit d4c6911

Please sign in to comment.