CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
msvc_cpu.h
1#pragma once
2
3#include <cx/platform/base.h>
4#include <intrin.h>
5
6#define _CPU_PAUSE _mm_pause()
7#define _CPU_BREAK __debugbreak()
8
9#define _CPU_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0)
10
11_meta_inline int ctz32(unsigned long mask)
12{
13 unsigned long idx;
14 _BitScanForward(&idx, mask);
15 return (int)idx;
16}
17
18#ifdef _ARCH_X64
19
20_meta_inline int ctz64(unsigned long long mask)
21{
22 unsigned long idx;
23 _BitScanForward64(&idx, mask);
24 return (int)idx;
25}
26
27#endif
Compiler and platform detection macros.