Skip to contentSkip to conversation

drivers/net/depca.c tidyup

PATCH Peter Denison 2 participants 2 messages May 6, 2002 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines · Dave Jones
Quoted 1 line · Peter Denison

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?

Signature · 2 lines
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>
#2 lore raw
In reply to a message not in the archive
Quoted 9 lines · Peter Denison
(quoted diff) +1 -1
-	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.

Signature · 2 lines
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs