This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

__black_count inlining fix



Here is a fix to allow inlining of __black_count.  The same trick can be done
without using a standard argument, but it doesn't optimize away as well.

-nick


Index: ChangeLog
===================================================================
RCS file: /cvs/libstdc++/libstdc++/ChangeLog,v
retrieving revision 1.242
diff -c -3 -p -r1.242 ChangeLog
*** ChangeLog	1999/07/02 16:07:10	1.242
--- ChangeLog	1999/07/05 08:38:55
***************
*** 1,3 ****
--- 1,7 ----
+ 1999-07-05  Nick Rasmussen  <nick@jive.org>
+ 
+ 	* stl/bits/stl_tree.h (__black_count): Modified to permit inlining.
+ 
  1999-07-02  Ryszard Kabatek <kabatek@chemie.uni-halle.de>
  
          * bits/string.tcc: Check the __res_arg for a length error.
Index: stl/bits/stl_tree.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/stl/bits/stl_tree.h,v
retrieving revision 1.11
diff -c -3 -p -r1.11 stl_tree.h
*** stl_tree.h	1999/06/25 12:32:37	1.11
--- stl_tree.h	1999/07/05 08:39:03
*************** _Rb_tree<_Key, _Value, _KoV, _Compare, _
*** 1286,1302 ****
                                               upper_bound(__k));
  }
  
! inline int 
! __black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root)
  {
    if (__node == 0)
!     return 0;
    else {
!     int __bc = __node->_M_color == _S_rb_tree_black ? 1 : 0;
      if (__node == __root)
        return __bc;
      else
!       return __bc + __black_count(__node->_M_parent, __root);
    }
  }
  
--- 1286,1303 ----
                                               upper_bound(__k));
  }
  
! inline int
! __black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root,
!               int __bc = 0)
  {
    if (__node == 0)
!     return __bc;
    else {
!     __bc += __node->_M_color == _S_rb_tree_black ? 1 : 0;
      if (__node == __root)
        return __bc;
      else
!       return __black_count(__node->_M_parent, __root, __bc);
    }
  }
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]