util: add shortcut for range remap inserts
The user of this insert function often just inserts things in a
consecutive manner. So here we add a shortcut for inserting entries
at the tail of the list.
Fixes: bf946bccf2 ("util: add range remap util")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13894
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37386>
This commit is contained in:
committed by
Marge Bot
parent
dd2476a257
commit
57ac68f616
@@ -89,6 +89,15 @@ util_range_insert_remap(unsigned start, unsigned end,
|
||||
goto insert_end;
|
||||
}
|
||||
|
||||
/* Shortcut for consecutive location inserts */
|
||||
struct range_entry *last_entry =
|
||||
list_last_entry(r_list, struct range_entry, node);
|
||||
if (last_entry->end < start) {
|
||||
entry = rzalloc(r_list, struct range_entry);
|
||||
list_addtail(&entry->node, r_list);
|
||||
goto insert_end;
|
||||
}
|
||||
|
||||
unsigned low = 0;
|
||||
unsigned high = list_length(r_list) - 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user