diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2011-11-11 15:25:25 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-11-12 23:23:35 +0100 |
commit | 0395c6e7c4baceae4539e4a7ede9a4473c57a350 (patch) | |
tree | 89921ffbfcb772100d358c2b7bc570c9894c7f0d /include/osmocom/vty/misc.h | |
parent | 2179f402e062f40a357759ad28717a79df062697 (diff) |
core/rbtree: optimize rb_erase()
See kernel commit 55a63998b8967615a15e2211ba0ff3a84a565824
----
Tfour 4 redundant if-conditions in function __rb_erase_color() in
lib/rbtree.c are removed.
In pseudo-source-code, the structure of the code is as follows:
if ((!A || B) && (!C || D)) {
.
.
.
} else {
if (!C || D) {//if this is true, it implies: (A == true) && (B == false)
if (A) {//hence this always evaluates to 'true'...
.
}
.
//at this point, C always becomes true, because of:
__rb_rotate_right/left();
//and:
other = parent->rb_right/left;
}
.
.
if (C) {//...and this too !
.
}
}
Signed-off-by: Wolfram Strepp <wstrepp@gmx.de>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrea Arcangeli <andrea@qumranet.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
----
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'include/osmocom/vty/misc.h')
0 files changed, 0 insertions, 0 deletions