prefetchheap.h

来自「hoard内存管理器」· C头文件 代码 · 共 32 行

H
32
字号
/* -*- C++ -*- */#ifndef _PREFETCHHEAP_H_#define _PREFETCHHEAP_H_#define prefetcht0					  __asm _emit 0x0f __asm _emit 0x18 __asm _emit 0x08template <class Super>class PrefetchHeap : public Super {public:    inline void * malloc (size_t sz) {    void * Address = Super::malloc (sz);#ifdef _M_IX86      // Prefetch this ptr before we return.      __asm	{	  mov   eax,Address    // Load Address.	  prefetcht0    // Prefetch into the L1.	}#endif    return Address;  }    inline void free (void * ptr) {    Super::free (ptr);  }};#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?