Skip to content

Commit 9c02fb2

Browse files
committed
Apply chatbot suggestion
1 parent a4265c9 commit 9c02fb2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

libCacheSim/cache/eviction/LHD/LHD_Interface.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ using namespace repl;
1212
extern "C" {
1313
#endif
1414

15+
// NOTE: Since LHD uses internal data struct to reprensent cache_obj_t, to suit
16+
// the interface, we use a dummy pointer to represent the cache_obj_t.
17+
// Specifically, for find and insert, we return a dummy pointer when the object
18+
// is found or inserted and NULL when the object is not found.
19+
static cache_obj_t* const DUMMY_CACHE_OBJ_PTR = reinterpret_cast<cache_obj_t*>(1);
20+
1521
typedef struct {
1622
void *LHD_cache;
1723

@@ -176,7 +182,7 @@ static cache_obj_t *LHD_find(cache_t *cache, const request_t *req,
176182
lhd->update(id, req);
177183
}
178184

179-
return reinterpret_cast<cache_obj_t *>(0x1);
185+
return DUMMY_CACHE_OBJ_PTR;
180186
}
181187

182188
/**
@@ -205,7 +211,7 @@ static cache_obj_t *LHD_insert(cache_t *cache, const request_t *req) {
205211
cache->occupied_byte += req->obj_size + cache->obj_md_size;
206212
cache->n_obj += 1;
207213

208-
return reinterpret_cast<cache_obj_t *>(0x1);
214+
return DUMMY_CACHE_OBJ_PTR;
209215
}
210216

211217
/**

0 commit comments

Comments
 (0)