Skip to content

Commit

Permalink
apply const to prefetch parameter
Browse files Browse the repository at this point in the history
closes #5296

No functional change
  • Loading branch information
Disservin authored and vondele committed May 28, 2024
1 parent d0b9411 commit b0287dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,14 @@ void start_logger(const std::string& fname) { Logger::start(fname); }

#ifdef NO_PREFETCH

void prefetch(void*) {}
void prefetch(const void*) {}

#else

void prefetch(void* addr) {
void prefetch(const void* addr) {

#if defined(_MSC_VER)
_mm_prefetch((char*) addr, _MM_HINT_T0);
_mm_prefetch((char const*) addr, _MM_HINT_T0);
#else
__builtin_prefetch(addr);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ std::string compiler_info();
// Preloads the given address in L1/L2 cache. This is a non-blocking
// function that doesn't stall the CPU waiting for data to be loaded from memory,
// which can be quite slow.
void prefetch(void* addr);
void prefetch(const void* addr);

void start_logger(const std::string& fname);
void* std_aligned_alloc(size_t alignment, size_t size);
Expand Down

0 comments on commit b0287dc

Please sign in to comment.