xfs
[Top] [All Lists]

Re: [Patch] xfs_lowbit64 broken on ia32

To: Alex Elder <aelder@xxxxxxx>
Subject: Re: [Patch] xfs_lowbit64 broken on ia32
From: Timothy Shimmin <tes@xxxxxxx>
Date: Thu, 06 Dec 2007 11:04:26 +1100
Cc: David Chinner <dgc@xxxxxxx>, Lachlan Mcllroy <lachlan@xxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>, xfs-dev <xfs-dev@xxxxxxx>
In-reply-to: <D59801BCA402F5418C040937230AF7E0755AF5@mtv-amer002e--3.americas.sgi.com>
References: <D59801BCA402F5418C040937230AF7E0755AF5@mtv-amer002e--3.americas.sgi.com>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)
Alex Elder wrote:
David Chinner wrote:
. . .
Index: 2.6.x-xfs-new/fs/xfs/xfs_bit.h
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_bit.h 2007-11-02 13:44:45.000000000 +1100
+++ 2.6.x-xfs-new/fs/xfs/xfs_bit.h 2007-12-03
14:43:33.169851481 +1100
@@ -68,8 +68,8 @@ static inline int xfs_lowbit32(__uint32_
/* Get low bit set out of 64-bit argument, -1 if none set */
static inline int xfs_lowbit64(__uint64_t v)
{
-       unsigned long   t = v;
-       return (v) ? find_first_bit(&t, 64) : -1;
+       unsigned long long      t = v;
Why create a local copy? Why not just pass v into find_first_bit()?
Because I thought that taking the address of a function parameter
was a big no-no because the result is undefined (i.e. platform and
compiler dependent)?

I've never heard of this, and it's incorrect--at least with respect to standard C. (But that's not to say in practice some compiler does it wrong.) Unless it's a real (details known) problem you shouldn't try to work around it.

                                        -Alex

I've never heard of that either.
(Then again, I didn't know until recently that they changed C
 to allow "flexible array members" in C99
 http://tigcc.ticalc.org/doc/gnuexts.html#SEC75)

--Tim


<Prev in Thread] Current Thread [Next in Thread>