.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | Interval Trees |
---|
3 | 4 | (C) 2012 Michel Lespinasse <walken@google.com> |
---|
4 | 5 | |
---|
5 | | - This program is free software; you can redistribute it and/or modify |
---|
6 | | - it under the terms of the GNU General Public License as published by |
---|
7 | | - the Free Software Foundation; either version 2 of the License, or |
---|
8 | | - (at your option) any later version. |
---|
9 | | - |
---|
10 | | - This program is distributed in the hope that it will be useful, |
---|
11 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - GNU General Public License for more details. |
---|
14 | | - |
---|
15 | | - You should have received a copy of the GNU General Public License |
---|
16 | | - along with this program; if not, write to the Free Software |
---|
17 | | - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
18 | 6 | |
---|
19 | 7 | include/linux/interval_tree_generic.h |
---|
20 | 8 | */ |
---|
.. | .. |
---|
42 | 30 | \ |
---|
43 | 31 | /* Callbacks for augmented rbtree insert and remove */ \ |
---|
44 | 32 | \ |
---|
45 | | -static inline ITTYPE ITPREFIX ## _compute_subtree_last(ITSTRUCT *node) \ |
---|
46 | | -{ \ |
---|
47 | | - ITTYPE max = ITLAST(node), subtree_last; \ |
---|
48 | | - if (node->ITRB.rb_left) { \ |
---|
49 | | - subtree_last = rb_entry(node->ITRB.rb_left, \ |
---|
50 | | - ITSTRUCT, ITRB)->ITSUBTREE; \ |
---|
51 | | - if (max < subtree_last) \ |
---|
52 | | - max = subtree_last; \ |
---|
53 | | - } \ |
---|
54 | | - if (node->ITRB.rb_right) { \ |
---|
55 | | - subtree_last = rb_entry(node->ITRB.rb_right, \ |
---|
56 | | - ITSTRUCT, ITRB)->ITSUBTREE; \ |
---|
57 | | - if (max < subtree_last) \ |
---|
58 | | - max = subtree_last; \ |
---|
59 | | - } \ |
---|
60 | | - return max; \ |
---|
61 | | -} \ |
---|
62 | | - \ |
---|
63 | | -RB_DECLARE_CALLBACKS(static, ITPREFIX ## _augment, ITSTRUCT, ITRB, \ |
---|
64 | | - ITTYPE, ITSUBTREE, ITPREFIX ## _compute_subtree_last) \ |
---|
| 33 | +RB_DECLARE_CALLBACKS_MAX(static, ITPREFIX ## _augment, \ |
---|
| 34 | + ITSTRUCT, ITRB, ITTYPE, ITSUBTREE, ITLAST) \ |
---|
65 | 35 | \ |
---|
66 | 36 | /* Insert / remove interval nodes from the tree */ \ |
---|
67 | 37 | \ |
---|