Stop using typeof() in the bit-twiddling macros, per yamt@'s

suggestion.  This change requires that I use the __PRIuBITS format
string in atw and rtw, so do that.
This commit is contained in:
dyoung 2006-11-13 03:35:59 +00:00
parent e3361bb265
commit 075fd7d1e9
3 changed files with 15 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: atw.c,v 1.122 2006/10/12 01:31:00 christos Exp $ */
/* $NetBSD: atw.c,v 1.123 2006/11/13 03:35:59 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.122 2006/10/12 01:31:00 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.123 2006/11/13 03:35:59 dyoung Exp $");
#include "bpfilter.h"
@ -414,7 +414,7 @@ atw_read_srom(struct atw_softc *sc)
sd.sd_chip = C46;
break;
default:
printf("%s: unknown SROM type %d\n",
printf("%s: unknown SROM type %" __PRIuBITS "\n",
sc->sc_dev.dv_xname,
__SHIFTOUT(test0, ATW_TEST0_EPTYP_MASK));
return -1;
@ -3301,8 +3301,8 @@ atw_txintr(struct atw_softc *sc)
(txstat & TXSTAT_ERRMASK) != 0) {
bitmask_snprintf(txstat & TXSTAT_ERRMASK, TXSTAT_FMT,
txstat_buf, sizeof(txstat_buf));
printf("%s: txstat %s %d\n", sc->sc_dev.dv_xname,
txstat_buf,
printf("%s: txstat %s %" __PRIuBITS "\n",
sc->sc_dev.dv_xname, txstat_buf,
__SHIFTOUT(txstat, ATW_TXSTAT_ARC_MASK));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtw.c,v 1.79 2006/10/12 07:43:39 xtraeme Exp $ */
/* $NetBSD: rtw.c,v 1.80 2006/11/13 03:35:59 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.79 2006/10/12 07:43:39 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.80 2006/11/13 03:35:59 dyoung Exp $");
#include "bpfilter.h"
@ -1540,7 +1540,8 @@ rtw_intr_rx(struct rtw_softc *sc, uint16_t isr __unused)
hwrate = __SHIFTOUT(hstat, RTW_RXSTAT_RATE_MASK);
if (hwrate >= sizeof(ratetbl) / sizeof(ratetbl[0])) {
printf("%s: unknown rate #%d\n", sc->sc_dev.dv_xname,
printf("%s: unknown rate #%" __PRIuBITS "\n",
sc->sc_dev.dv_xname,
__SHIFTOUT(hstat, RTW_RXSTAT_RATE_MASK));
ifp->if_ierrors++;
goto next;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cdefs.h,v 1.62 2006/10/27 22:10:56 uwe Exp $ */
/* $NetBSD: cdefs.h,v 1.63 2006/11/13 03:35:59 dyoung Exp $ */
/*
* Copyright (c) 1991, 1993
@ -371,12 +371,15 @@
/* find least significant bit that is set */
#define __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask))
#define __PRIuBIT PRIuMAX
#define __PRIuBITS __PRIuBIT
#define __PRIxBIT PRIxMAX
#define __PRIxBITS __PRIxBIT
#define __SHIFTOUT(__x, __mask) \
((typeof(__x))(((__x) & (__mask)) / __LOWEST_SET_BIT(__mask)))
#define __SHIFTIN(__x, __mask) ((typeof(__x))((__x) * __LOWEST_SET_BIT(__mask)))
(((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))
#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask))
#define __SHIFTOUT_MASK(__mask) __SHIFTOUT((__mask), (__mask))
#endif /* !_SYS_CDEFS_H_ */