MCPcopy Create free account
hub / github.com/WheretIB/nullc / MemWrite

Function MemWrite

NULLC/CodeGen_X86.cpp:55–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 return ~0u;
54 }
55 void MemWrite(const x86Argument &address, const x86Argument &value)
56 {
57 unsigned int index = MemFind(address);
58 if(index != ~0u)
59 {
60 if(index != 0)
61 {
62 MemCache tmp = mCache[index-1];
63 mCache[index-1] = mCache[index];
64 mCache[index] = tmp;
65 mCache[index-1].value = value;
66 }else{
67 mCache[0].value = value;
68 }
69 }else{
70 unsigned int newIndex = mCacheEntries < MEMORY_STATE_SIZE ? mCacheEntries : MEMORY_STATE_SIZE - 1;
71 if(mCacheEntries < MEMORY_STATE_SIZE)
72 mCacheEntries++;
73 else
74 mCacheEntries = MEMORY_STATE_SIZE >> 1; // Wrap to the middle
75
76 mCache[newIndex].address = address;
77 mCache[newIndex].value = value;
78 }
79 }
80 void MemUpdate(unsigned int index)
81 {
82 (void)index;

Callers 2

EMIT_OP_RPTR_REGFunction · 0.85
EMIT_OP_RPTR_NUMFunction · 0.85

Calls 1

MemFindFunction · 0.85

Tested by

no test coverage detected