Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net use ALIGNED_POINTER() instead of ALIGN().



details:   https://anonhg.NetBSD.org/src/rev/dc9d423d3f7d
branches:  trunk
changeset: 515437:dc9d423d3f7d
user:      onoe <onoe%NetBSD.org@localhost>
date:      Tue Sep 25 01:07:53 2001 +0000

description:
use ALIGNED_POINTER() instead of ALIGN().
The type of ALIGN() is vary on architecture and casting pointer to u_int
is incorrect for MI code.
Since the code is to make sure aligned access to IP header and requires
bcopy if the test fails.  So the performance implication is not necessary
and we can use ALIGNED_POINTER() here.
pointed out by nathanw.

diffstat:

 sys/net/if_ieee80211subr.c |  5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diffs (19 lines):

diff -r bd66a548740a -r dc9d423d3f7d sys/net/if_ieee80211subr.c
--- a/sys/net/if_ieee80211subr.c        Tue Sep 25 01:04:35 2001 +0000
+++ b/sys/net/if_ieee80211subr.c        Tue Sep 25 01:07:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ieee80211subr.c,v 1.4 2001/09/24 21:47:57 reinoud Exp $     */
+/*     $NetBSD: if_ieee80211subr.c,v 1.5 2001/09/25 01:07:53 onoe Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -435,8 +435,7 @@
                m_freem(m);
                return NULL;
        }
-       if (ALIGN(mtod(m, uintptr_t) + sizeof(*eh)) !=
-           (mtod(m, uintptr_t) + sizeof(*eh))) {
+       if (!ALIGNED_POINTER(mtod(m, caddr_t) + sizeof(*eh), u_int32_t)) {
                struct mbuf *n, *n0, **np;
                caddr_t newdata;
                int off;



Home | Main Index | Thread Index | Old Index