login
Login
/
Register
Search
Header Space
Forums
News
Jobs
Blogs
Features
Man Pages
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
March
»
18
Re: [PATCH] kernel: add bit rotation helpers for 16 and 8 bit
view
thread
Score:
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From:
Randy Dunlap <randy.dunlap@...>
To: Harvey Harrison <harvey.harrison@...>
Cc: Andrew Morton <akpm@...>, LKML <linux-kernel@...>, Johannes Berg <johannes@...>
Subject:
Re: [PATCH] kernel: add bit rotation helpers for 16 and 8 bit
Date: Tuesday, March 18, 2008 - 4:32 pm
Harvey Harrison wrote:
quoted text
> Will replace open-coded variants elsewhere. Done in the same > style as the 32-bit versions. > > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> > --- > Andrew, these will be used to replace some open-coded variants in the > mac80211 code, there are currently no users so it can go in with little > risk. > > Randy, CC'd in case I screwed up the kerneldoc.
Looks good. Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
quoted text
> include/linux/bitops.h | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 40 insertions(+), 0 deletions(-) > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > index 69c1edb..40d5473 100644 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -65,6 +65,46 @@ static inline __u32 ror32(__u32 word, unsigned int shift) > return (word >> shift) | (word << (32 - shift)); > } > > +/** > + * rol16 - rotate a 16-bit value left > + * @word: value to rotate > + * @shift: bits to roll > + */ > +static inline __u16 rol16(__u16 word, unsigned int shift) > +{ > + return (word << shift) | (word >> (16 - shift)); > +} > + > +/** > + * ror16 - rotate a 16-bit value right > + * @word: value to rotate > + * @shift: bits to roll > + */ > +static inline __u16 ror16(__u16 word, unsigned int shift) > +{ > + return (word >> shift) | (word << (16 - shift)); > +} > + > +/** > + * rol8 - rotate an 8-bit value left > + * @word: value to rotate > + * @shift: bits to roll > + */ > +static inline __u8 rol8(__u8 word, unsigned int shift) > +{ > + return (word << shift) | (word >> (8 - shift)); > +} > + > +/** > + * ror8 - rotate an 8-bit value right > + * @word: value to rotate > + * @shift: bits to roll > + */ > +static inline __u8 ror8(__u8 word, unsigned int shift) > +{ > + return (word >> shift) | (word << (8 - shift)); > +} > + > static inline unsigned fls_long(unsigned long l) > { > if (sizeof(l) == 4)
-- ~Randy --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH] kernel: add bit rotation helpers for 16 and 8 bit
, Harvey Harrison
, (Tue Mar 18, 4:24 pm)
Re: [PATCH] kernel: add bit rotation helpers for 16 and 8 bit
, Randy Dunlap
, (Tue Mar 18, 4:32 pm)
Navigation
Create content
Mailing list archives
Recent posts
Mail archive search
Enter your search terms.
all mailing lists
alsa-devel
dragonflybsd-bugs
dragonflybsd-commit
dragonflybsd-docs
dragonflybsd-kernel
dragonflybsd-submit
dragonflybsd-user
freebsd-announce
freebsd-bugs
freebsd-chat
freebsd-cluster
freebsd-current
freebsd-drivers
freebsd-embeded
freebsd-fs
freebsd-hackers
freebsd-hardware
freebsd-mobile
freebsd-net
freebsd-performance
freebsd-pf
freebsd-security
freebsd-security-notifications
freebsd-threads
git
git-commits-head
linux-activists
linux-arm
linux-ath5k-devel
linux-btrfs
linux-c-programming
linux-driver-devel
linux-ext4
linux-fsdevel
linux-ia64
linux-input
linux-kernel
linux-kernel-janitors
linux-kernel-mentors
linux-kernel-newbies
linux-kvm
linux-net
linux-netdev
linux-newbie
linux-nfs
linux-raid
linux-scsi
linux-security-module
linux-sparse
linux-usb
linux-usb-devel
madwifi-devel
netbsd-announce
netbsd-tech-kern
openbsd-announce
openbsd-bugs
openbsd-ipv6
openbsd-misc
openbsd-security-announce
openbsd-smp
openbsd-source-changes
openbsd-tech
openfabrics-general
openmoko-community
openmoko-devel
openmoko-kernel
reiserfs-devel
tux3
ucarp
Optionally limit your search to a specific mailing list.
advanced
Popular discussions
linux-kernel
:
Greg Kroah-Hartman
[PATCH 002/196] Chinese: rephrase English introduction in HOWTO
Linus Torvalds
Linux 2.6.27-rc8
Parag Warudkar
BUG: soft lockup - CPU#1 stuck for 15s! [swapper:0]
James Bottomley
Re: Integration of SCST in the mainstream Linux kernel
git
:
Jakub Narebski
Re: VCS comparison table
Wincent Colaiuta
Re: [ANNOUNCE] GIT 1.5.4
Sam Song
Fwd: [OT] Re: Git via a proxy server?
Junio C Hamano
Re: More precise tag following
openbsd-misc
:
Nick Guenther
Re: Real men don't attack straw men
Raimo Niskanen
HP ProLiant DL140 G3 problems
Todd Pytel
IDE or SCSI virtual disks for VMWare image?
R. Fumione
OpenBSD speed on desktops
linux-netdev
:
Patrick McHardy
[NET_SCHED 03/15]: act_api: fix netlink API conversion bug
Jarek Poplawski
[PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Theodore Tso
Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin"
Linus Torvalds
Re: [GIT]: Networking
Latest forum posts
Kernel Module Oops! TRICKY PROBLEM!
11 hours ago
Linux kernel
usb mic not detected
14 hours ago
Applications and Utilities
linux-2.6.10
21 hours ago
Linux kernel
How to detect usb device insertioin and removal event ?
1 day ago
Linux general
Extended configuration Read/Write
1 day ago
Windows
Add ext2 inode field
1 day ago
Linux kernel
the kernel how to power off the machine
1 day ago
Linux kernel
struct gendisk via request_queue
1 day ago
Linux kernel
page initialization during kernel initialization
2 days ago
Linux kernel
Read Transport Layer Data form network packets (tcp/ip)
3 days ago
Linux kernel
Show all forums...
Recent Tags
bugs
-rc8
Linux
Linus Torvalds
quote
Intel
2.6.27-rc8
-rc
2.6.27
more tags
Colocation donated by:
Who's online
There are currently
3 users
and
1273 guests
online.
Online users
Jeremy
kingneutron
strcmp
Syndicate
speck-geostationary