The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH] drivers/net/depca.c tidyup
       [not found] <20020506193247.C22215@suse.de>
@ 2002-05-06 19:01 ` Peter Denison
  2002-05-06 19:41   ` Dave Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Denison @ 2002-05-06 19:01 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux-kernel

On Mon, 6 May 2002, Dave Jones wrote:

> On Mon, May 06, 2002 at 06:17:00PM +0100, Peter Denison wrote:
>  > The ALIGN macro is defined centrally - remove the local version
> 
> They aren't functionally equivalent though are they?

Eek. I thought they were.

-#define ALIGN4      ((u_long)4 - 1)       /* 1 longword align */
-#define ALIGN8      ((u_long)8 - 1)       /* 2 longword (quadword) align */
-#define ALIGN         ALIGN8              /* Keep the LANCE happy... */

-	offset = (offset + ALIGN) & ~ALIGN;
+	offset = ALIGN(offset, 8);

And from include/linux/cache.h:

#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))

So, we're replacing (offset + 8 - 1) & ~(8-1) = (offset + 7) & ~7
with (((offset)+(8)-1)&~((8)-1)) = ((offset+7)&~7)

I think they're the same, aren't they, except for the promotion to u_long, 
which is probably bogus anyway?

-- 
Peter Denison <peterd at marshadder dot uklinux dot net>
Please note that my address is changing from <peterd at pnd-pc dot demon.co.uk>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/net/depca.c tidyup
  2002-05-06 19:01 ` [PATCH] drivers/net/depca.c tidyup Peter Denison
@ 2002-05-06 19:41   ` Dave Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jones @ 2002-05-06 19:41 UTC (permalink / raw)
  To: Peter Denison; +Cc: linux-kernel

On Mon, May 06, 2002 at 08:01:01PM +0100, Peter Denison wrote:

 > -	offset = (offset + ALIGN) & ~ALIGN;
 > +	offset = ALIGN(offset, 8);
 > 
 > And from include/linux/cache.h:
 > 
 > #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
 > 
 > So, we're replacing (offset + 8 - 1) & ~(8-1) = (offset + 7) & ~7
 > with (((offset)+(8)-1)&~((8)-1)) = ((offset+7)&~7)

Argh, I was looking at the definition in linkage.h
Cursed ctags.

-- 
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-06 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20020506193247.C22215@suse.de>
2002-05-06 19:01 ` [PATCH] drivers/net/depca.c tidyup Peter Denison
2002-05-06 19:41   ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox