From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, rt2400-devel@lists.sourceforge.net
Subject: [PATCH 07/10] rt2x00: Use __builtin_choose_expr() instead of ?:
Date: Sun, 8 Jun 2008 23:45:49 +0200 [thread overview]
Message-ID: <200806082345.49841.IvDoorn@gmail.com> (raw)
In-Reply-To: <200806082345.25904.IvDoorn@gmail.com>
To really force the FIELD macros to determine
the first bit of the register field we should
use the __builtin_choose_expr() function.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00reg.h | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index c3f1202..7e88ce5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -145,23 +145,27 @@ struct rt2x00_field32 {
* compile-time rather then run-time.
*/
#define compile_ffs2(__x) \
- ( ((__x) & 0x1) ? 0 : 1 )
+ __builtin_choose_expr(((__x) & 0x1), 0, 1)
#define compile_ffs4(__x) \
- ( ((__x) & 0x3) ? \
- compile_ffs2(__x) : (compile_ffs2((__x) >> 2) + 2) )
+ __builtin_choose_expr(((__x) & 0x3), \
+ (compile_ffs2((__x))), \
+ (compile_ffs2((__x) >> 2) + 2))
#define compile_ffs8(__x) \
- ( ((__x) & 0xf) ? \
- compile_ffs4(__x) : (compile_ffs4((__x) >> 4) + 4) )
+ __builtin_choose_expr(((__x) & 0xf), \
+ (compile_ffs4((__x))), \
+ (compile_ffs4((__x) >> 4) + 4))
#define compile_ffs16(__x) \
- ( ((__x) & 0xff) ? \
- compile_ffs8(__x) : (compile_ffs8((__x) >> 8) + 8) )
+ __builtin_choose_expr(((__x) & 0xff), \
+ (compile_ffs8((__x))), \
+ (compile_ffs8((__x) >> 8) + 8))
#define compile_ffs32(__x) \
- ( ((__x) & 0xffff) ? \
- compile_ffs16(__x) : (compile_ffs16((__x) >> 16) + 16) )
+ __builtin_choose_expr(((__x) & 0xffff), \
+ (compile_ffs16((__x))), \
+ (compile_ffs16((__x) >> 16) + 16))
/*
* This macro will check the requirements for the FIELD{8,16,32} macros
--
1.5.5.3
next prev parent reply other threads:[~2008-06-08 21:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-08 21:41 Please pull 'upstream' branch of rt2x00 Ivo van Doorn
2008-06-08 21:42 ` [PATCH 01/10] rt2x00: Implement rt2x00usb_kick_tx_queue() Ivo van Doorn
2008-06-08 21:43 ` [PATCH 02/10] rt2x00: Move generic TX frame writing code into rt2x00queue Ivo van Doorn
2008-06-08 21:43 ` [PATCH 03/10] rt2x00: Don't kick TX queue after each frame Ivo van Doorn
2008-06-08 21:44 ` [PATCH 04/10] rt2x00: Cleanup struct skb_frame_desc Ivo van Doorn
2008-06-08 21:45 ` [PATCH 05/10] rt2x00: Centralize RX packet alignment handling in rt2x00lib Ivo van Doorn
2008-06-08 21:45 ` [PATCH 06/10] rt2x00: Fix double usage of skb->cb in USB RX path Ivo van Doorn
2008-06-08 21:45 ` Ivo van Doorn [this message]
2008-06-08 21:46 ` [PATCH 08/10] rt2x00: Clear IEEE80211_TX_CTL_USE_RTS_CTS flag for RTS frame Ivo van Doorn
2008-06-08 21:46 ` [PATCH 09/10] rt2x00: Remove unused defines Ivo van Doorn
2008-06-08 21:46 ` [PATCH 10/10] rt2x00: Rework alignment check Ivo van Doorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200806082345.49841.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=rt2400-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).