Add list_min(), list_max().
[pintos-anon] / src / lib / kernel / list.h
index 88ed5952650a033de6d36a84e171eb79dc502f3b..262d5b5c8ef78bb4d3fefe7f808f550591d1ab38 100644 (file)
@@ -143,16 +143,16 @@ list_elem *list_back (struct list *);
 size_t list_size (struct list *);
 bool list_empty (struct list *);
 
-/* Weirdness. */
+/* Miscellaneous. */
 void list_reverse (struct list *);
 \f
-/* Operations on lists with ordered elements. */
-
 /* Compares the value of two list elements A and B, given
    auxiliary data AUX.  Returns true if A is less than B, or
    false if A is greater than or equal to B. */
 typedef bool list_less_func (const list_elem *a, const list_elem *b,
                              void *aux);
+
+/* Operations on lists with ordered elements. */
 void list_merge (struct list *, struct list *,
                  list_less_func *, void *aux);
 void list_sort (struct list *,
@@ -162,4 +162,8 @@ void list_insert_ordered (struct list *, list_elem *,
 void list_unique (struct list *, struct list *duplicates,
                   list_less_func *, void *aux);
 
+/* Max and min. */
+list_elem *list_max (struct list *, list_less_func *, void *aux);
+list_elem *list_min (struct list *, list_less_func *, void *aux);
+
 #endif /* lib/kernel/list.h */