X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Falgorithm.h;h=10e589a1e4f43eb147062f33e2644c5b1ece38ac;hb=8fa7f3f6640c0eec450149cf5ccfab15d5391f55;hp=5482de1532ae094a896eb94abaa96e7d15532853;hpb=6ccbd384363db2e304ffe8cc51fcd2eac0a5349a;p=pspp diff --git a/src/algorithm.h b/src/algorithm.h index 5482de1532..10e589a1e4 100644 --- a/src/algorithm.h +++ b/src/algorithm.h @@ -107,6 +107,13 @@ void remove_range (void *array, size_t count, size_t size, void remove_element (void *array, size_t count, size_t size, size_t idx); +/* Moves an element in ARRAY, which consists of COUNT elements of + SIZE bytes each, from OLD_IDX to NEW_IDX, shifting around + other elements as needed. Runs in O(abs(OLD_IDX - NEW_IDX)) + time. */ +void move_element (void *array, size_t count, size_t size, + size_t old_idx, size_t new_idx); + /* Removes elements equal to ELEMENT from ARRAY, which consists of COUNT elements of SIZE bytes each. Returns the number of remaining elements. AUX is passed to COMPARE as auxiliary