Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Prefetch.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
8
10template <typename T>
11inline void PrefetchL1(const T *inAddress)
12{
13#ifdef JPH_USE_SSE
14 _mm_prefetch(reinterpret_cast<const char *>(inAddress), _MM_HINT_T0);
15#elif defined(JPH_COMPILER_GCC) || defined(JPH_COMPILER_CLANG)
16 __builtin_prefetch(inAddress, 0, 3);
17#endif
18}
19
#define JPH_NAMESPACE_END
Definition Core.h:428
#define JPH_NAMESPACE_BEGIN
Definition Core.h:422
JPH_NAMESPACE_BEGIN void PrefetchL1(const T *inAddress)
Prefetch the given address to L1 cache. Can be used to avoid cache misses, but should be used with ca...
Definition Prefetch.h:11