* [PATCH] rbtree [not found] <200211241225.gAOCP3p05987@Port.imtp.ilyichevsk.odessa.ua> @ 2002-11-24 22:41 ` Érsek László 2002-11-25 21:01 ` Folkert van Heusden 0 siblings, 1 reply; 3+ messages in thread From: Érsek László @ 2002-11-24 22:41 UTC (permalink / raw) To: linux-kernel Hi all, this patch tries to remove those checks for 0 from linux-2.4.19/lib/rbtree.c which are (I think) superfluous. Laszlo Ersek --- linux-2.4.19/lib/rbtree.c Sat Aug 3 02:39:46 2002 +++ linux/lib/rbtree.c Sun Nov 24 22:59:38 2002 @@ -159,17 +159,16 @@ if (!other->rb_right || other->rb_right->rb_color == RB_BLACK) { - register rb_node_t * o_left; - if ((o_left = other->rb_left)) - o_left->rb_color = RB_BLACK; + /* unneeded check-for-0 removed */ + other->rb_left->rb_color = RB_BLACK; other->rb_color = RB_RED; __rb_rotate_right(other, root); other = parent->rb_right; } other->rb_color = parent->rb_color; parent->rb_color = RB_BLACK; - if (other->rb_right) - other->rb_right->rb_color = RB_BLACK; + /* unneeded check-for-0 removed */ + other->rb_right->rb_color = RB_BLACK; __rb_rotate_left(parent, root); node = root->rb_node; break; @@ -199,17 +198,16 @@ if (!other->rb_left || other->rb_left->rb_color == RB_BLACK) { - register rb_node_t * o_right; - if ((o_right = other->rb_right)) - o_right->rb_color = RB_BLACK; + /* unneeded check-for-0 removed */ + other->rb_right->rb_color = RB_BLACK; other->rb_color = RB_RED; __rb_rotate_left(other, root); other = parent->rb_left; } other->rb_color = parent->rb_color; parent->rb_color = RB_BLACK; - if (other->rb_left) - other->rb_left->rb_color = RB_BLACK; + /* unneeded check-for-0 removed */ + other->rb_left->rb_color = RB_BLACK; __rb_rotate_right(parent, root); node = root->rb_node; break; ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] rbtree 2002-11-24 22:41 ` [PATCH] rbtree Érsek László @ 2002-11-25 21:01 ` Folkert van Heusden 2002-11-26 12:13 ` Mike Black 0 siblings, 1 reply; 3+ messages in thread From: Folkert van Heusden @ 2002-11-25 21:01 UTC (permalink / raw) To: 'Ersek Laszlo', linux-kernel Not trying to be negative and also really wondering this: won't the compiler produce the same code for: if (!variable) and if (variable == 0) ? -----Oorspronkelijk bericht----- Van: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-owner@vger.kernel.org]Namens Ersek Laszlo Verzonden: zondag 24 november 2002 23:41 Aan: linux-kernel@vger.kernel.org Onderwerp: [PATCH] rbtree Hi all, this patch tries to remove those checks for 0 from linux-2.4.19/lib/rbtree.c which are (I think) superfluous. Laszlo Ersek --- linux-2.4.19/lib/rbtree.c Sat Aug 3 02:39:46 2002 +++ linux/lib/rbtree.c Sun Nov 24 22:59:38 2002 @@ -159,17 +159,16 @@ if (!other->rb_right || other->rb_right->rb_color == RB_BLACK) { - register rb_node_t * o_left; - if ((o_left = other->rb_left)) - o_left->rb_color = RB_BLACK; + /* unneeded check-for-0 removed */ + other->rb_left->rb_color = RB_BLACK; ... ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rbtree 2002-11-25 21:01 ` Folkert van Heusden @ 2002-11-26 12:13 ` Mike Black 0 siblings, 0 replies; 3+ messages in thread From: Mike Black @ 2002-11-26 12:13 UTC (permalink / raw) To: Folkert van Heusden, 'Ersek Laszlo', linux-kernel Mine produces the same code either way: int main() { int i=0; if (i==0) { i++; } } gcc --version 2.95.3 .file "t1.c" .version "01.01" gcc2_compiled.: .text .align 4 .globl main .type main,@function main: pushl %ebp movl %esp,%ebp subl $24,%esp movl $0,-4(%ebp) cmpl $0,-4(%ebp) jne .L3 incl -4(%ebp) .L3: .L2: movl %ebp,%esp popl %ebp ret .Lfe1: .size main,.Lfe1-main .ident "GCC: (GNU) 2.95.3 20010315 (release)" ----- Original Message ----- From: "Folkert van Heusden" <folkert@vanheusden.com> To: "'Ersek Laszlo'" <erseklaszlo@chello.hu>; <linux-kernel@vger.kernel.org> Sent: Monday, November 25, 2002 4:01 PM Subject: RE: [PATCH] rbtree > Not trying to be negative and also really wondering this: won't > the compiler produce the same code for: > if (!variable) > and > if (variable == 0) > ? > > -----Oorspronkelijk bericht----- > Van: linux-kernel-owner@vger.kernel.org > [mailto:linux-kernel-owner@vger.kernel.org]Namens Ersek Laszlo > Verzonden: zondag 24 november 2002 23:41 > Aan: linux-kernel@vger.kernel.org > Onderwerp: [PATCH] rbtree > > > Hi all, > > this patch tries to remove those checks for 0 from > linux-2.4.19/lib/rbtree.c which are (I think) superfluous. > > Laszlo Ersek > > > --- linux-2.4.19/lib/rbtree.c Sat Aug 3 02:39:46 2002 > +++ linux/lib/rbtree.c Sun Nov 24 22:59:38 2002 > @@ -159,17 +159,16 @@ > if (!other->rb_right || > other->rb_right->rb_color == RB_BLACK) > { > - register rb_node_t * o_left; > - if ((o_left = other->rb_left)) > - o_left->rb_color = RB_BLACK; > + /* unneeded check-for-0 removed */ > + other->rb_left->rb_color = RB_BLACK; > ... > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-11-26 12:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200211241225.gAOCP3p05987@Port.imtp.ilyichevsk.odessa.ua>
2002-11-24 22:41 ` [PATCH] rbtree Érsek László
2002-11-25 21:01 ` Folkert van Heusden
2002-11-26 12:13 ` Mike Black
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®