From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Cc: alan@lxorguk.ukuu.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] include/asm-ARCH/page.h:get_order() Reorganize and optimize
Date: 13 Nov 2002 12:45:33 +0100 [thread overview]
Message-ID: <87y97xhew2.fsf@student.uni-tuebingen.de> (raw)
In-Reply-To: <E18BmqO-0000Za-00@milikk>
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> writes:
> s = --s >> PAGE_SHIFT;
This code has undefined behaviour.
> if (likely (s) < s)
What is that supposed to do?
BTW, I just noticed
#define likely(x) __builtin_expect((x),1)
I think this should rather be
#define likely(x) __builtin_expect((x)!=0,1)
So people can write
if (likely(pointer))
and indeed some people seem to assume that already.
--- linux-2.5.47/include/linux/compiler.h~ 2002-11-11 04:28:25.000000000 +0100
+++ linux-2.5.47/include/linux/compiler.h 2002-11-13 12:44:05.000000000 +0100
@@ -10,7 +10,7 @@
#define __builtin_expect(x, expected_value) (x)
#endif
-#define likely(x) __builtin_expect((x),1)
+#define likely(x) __builtin_expect((x)!=0,1)
#define unlikely(x) __builtin_expect((x),0)
/* This macro obfuscates arithmetic on a variable address so that gcc
--
Falk
prev parent reply other threads:[~2002-11-13 11:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-13 2:01 [PATCH] include/asm-ARCH/page.h:get_order() Reorganize and optimize Inaky Perez-Gonzalez
2002-11-13 11:45 ` Falk Hueffner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y97xhew2.fsf@student.uni-tuebingen.de \
--to=falk.hueffner@student.uni-tuebingen.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=inaky.perez-gonzalez@intel.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.