merge from gcc
authorDJ Delorie <dj@redhat.com>
Mon, 7 May 2001 16:21:15 +0000 (16:21 +0000)
committerDJ Delorie <dj@redhat.com>
Mon, 7 May 2001 16:21:15 +0000 (16:21 +0000)
include/ChangeLog
include/splay-tree.h
libiberty/ChangeLog
libiberty/splay-tree.c

index 5c48a64841958f7cbb4db3202f833311e7db2f49..24fb134d9025e95a724421c8033d9b7ff2b9c90f 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-07  Mark Mitchell  <mark@codesourcery.com>
+
+       * splay-tree.h (splay_tree_max): New function.
+       (splay_tree_min): Likewise.
+
 2001-04-27  Johan Rydberg  <jrydberg@opencores.org>
 
         * dis-asm.h (print_insn_openrisc): Add prototype.
index e43d4b62eaa09780f22bac0bb8e0d0f8e13c02e0..37e9a35937f4f03b21ecefa674da355adcfe1ee4 100644 (file)
@@ -110,6 +110,10 @@ extern splay_tree_node splay_tree_predecessor
 extern splay_tree_node splay_tree_successor
                                         PARAMS((splay_tree,
                                                splay_tree_key));
+extern splay_tree_node splay_tree_max
+                                        PARAMS((splay_tree));
+extern splay_tree_node splay_tree_min
+                                        PARAMS((splay_tree));
 extern int splay_tree_foreach           PARAMS((splay_tree,
                                                splay_tree_foreach_fn,
                                                void*));
index 8494e573731dd2e81ae8a9a16d1df6104e232c1d..29f8856cb288de6db76c197391e43a94f21e0e6e 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-07  Mark Mitchell  <mark@codesourcery.com>
+
+       * splay-tree.h (splay_tree_max): New function.
+       (splay_tree_min): Likewise.
+
 2001-04-15  Daniel Berlin  <dan@cgsoftware.com>
 
        * ternary.c: New file - Ternary search tree implementation.
index 52b57c088a79b638274320766e001b4c08b7446c..a71239526717aee4feadbf6432ac15aa8ec58918 100644 (file)
@@ -1,5 +1,5 @@
 /* A splay-tree datatype.  
-   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
    Contributed by Mark Mitchell (mark@markmitchell.com).
 
 This file is part of GNU CC.
@@ -368,6 +368,40 @@ splay_tree_lookup (sp, key)
     return 0;
 }
 
+/* Return the node in SP with the greatest key.  */
+
+splay_tree_node
+splay_tree_max (sp)
+     splay_tree sp;
+{
+  splay_tree_node n = sp->root;
+
+  if (!n)
+    return NULL;
+
+  while (n->right)
+    n = n->right;
+
+  return n;
+}
+
+/* Return the node in SP with the smallest key.  */
+
+splay_tree_node
+splay_tree_min (sp)
+     splay_tree sp;
+{
+  splay_tree_node n = sp->root;
+
+  if (!n)
+    return NULL;
+
+  while (n->left)
+    n = n->left;
+
+  return n;
+}
+
 /* Return the immediate predecessor KEY, or NULL if there is no
    predecessor.  KEY need not be present in the tree.  */