SectrPrototype/code/ui_rjf.odin
Ed_ 12aa6b4870 Mostly exploring hashtables, some new files...
I made the files for the ast but they're not populated yet.
I made some initial implementation for raddbg flavored linked-lists.
2024-02-29 19:37:37 -05:00

44 lines
991 B
Odin

package sectr
when false {
ui_box_cache_insert :: proc( using cache : HMap_RJF( ^ UI_Box ), key : u64, value : ^ UI_Box ) -> ^ UI_Box {
slot := rjf_hmap_get_slot( cache, key )
// dll_insert_raw( nil, slot.first, slot.last, slot.last, value )
{
new_links := & new.hash_links
// Empty Case
if first == null {
first = new
last = new
new_links.next = null
new_links.prev = null
}
else if position == null {
// Position is not set, insert at beginning
new_links.next = first
first.first = new
first = new
new_links.prev = null
}
else if position == last {
// Positin is set to last, insert at end
last.last = new
new_links.prev = last
last = new
new_links.next = null
}
else {
// Insert around position
if position.next != null {
position.next.prev = new
}
new.next = position.next
position.next = new
new.prev = position
}
}
}
}