require g != null
This commit is contained in:
parent
14e0a6ad0a
commit
f533d1f17a
1 changed files with 3 additions and 1 deletions
|
|
@ -107,9 +107,9 @@ fn usz Cache.get_free_spot(&cache)
|
|||
return 0;
|
||||
}
|
||||
|
||||
<* @require g != null *>
|
||||
fn Value*? Cache.insert_at(&cache, Value* g, Key id, usz index)
|
||||
{
|
||||
// TODO: verify index, g and id
|
||||
Value* spot;
|
||||
|
||||
/* Set used and present */
|
||||
|
|
@ -124,12 +124,14 @@ fn Value*? Cache.insert_at(&cache, Value* g, Key id, usz index)
|
|||
}
|
||||
|
||||
// Insert an element in the cache, returns the index
|
||||
<* @require g != null *>
|
||||
fn Value*? Cache.insert_new(&cache, Value* g, Key id)
|
||||
{
|
||||
usz index = cache.get_free_spot();
|
||||
return cache.insert_at(g, id, index);
|
||||
}
|
||||
|
||||
<* @require g != null *>
|
||||
fn Value*? Cache.get_or_insert(&cache, Value* g, Key id, bool *is_new = null)
|
||||
{
|
||||
Value*? c = cache.search(id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue