login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
August
»
24
Re: [PATCH] memchr (trivial) optimization
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Matt Mackall <mpm@...>
To: Jan Engelhardt <jengelh@...>
Cc: Ingo Oeser <ioe-lkml@...>, lode leroy <lode_leroy@...>, <linux-kernel@...>
Subject:
Re: [PATCH] memchr (trivial) optimization
Date: Friday, August 24, 2007 - 11:57 am
On Fri, Aug 24, 2007 at 02:54:48PM +0200, Jan Engelhardt wrote:
quoted text
> > On Aug 23 2007 19:13, Matt Mackall wrote: > > > >And you can do even better with this: > > > >void *memchr(const void *s, int c, size_t n) > >{ > > const unsigned char *p = s, *e = s + n; > > const unsigned char *e = p + n; > > Uhm, you have two "e"s in there.
Yep, that's what I get for editing in email.
quoted text
> Or do it glibc-style > > void *memchr(const void *s, unsigned char c, size_t n) > { > ... > for (; p + 3 < e; p += 4) { > if (c == p[0]) > return (void *)&p[0]; > if (c == p[1]) > return (void *)&p[1]; > if (c == p[2]) > return (void *)&p[2]; > if (c == p[3]) > return (void *)&p[3]; > } > ... /* check the rest */ > }
Yes, very funny. -- Mathematics is the supreme nostalgia of our time. -
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] memchr (trivial) optimization
, lode leroy
, (Wed Aug 22, 5:34 am)
Re: [PATCH] memchr (trivial) optimization
, Ingo Oeser
, (Wed Aug 22, 8:13 pm)
Re: [PATCH] memchr (trivial) optimization
, Matt Mackall
, (Thu Aug 23, 8:13 pm)
Re: [PATCH] memchr (trivial) optimization
, Jan Engelhardt
, (Fri Aug 24, 8:54 am)
Re: [PATCH] memchr (trivial) optimization
, Matt Mackall
, (Fri Aug 24, 11:57 am)
Re: [PATCH] memchr (trivial) optimization
, Jeremy Fitzhardinge
, (Thu Aug 23, 9:03 pm)
Re: [PATCH] memchr (trivial) optimization
, Matt Mackall
, (Thu Aug 23, 10:19 pm)
Re: [PATCH] memchr (trivial) optimization
, Andi Kleen
, (Wed Aug 22, 6:56 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
James Bottomley
Re: Integration of SCST in the mainstream Linux kernel
Greg Kroah-Hartman
[PATCH 007/196] Chinese: add translation of stable_kernel_rules.txt
david
Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3
Jan Engelhardt
intel iommu (Re: -mm merge plans for 2.6.23)
git
:
openbsd-misc
:
linux-netdev
:
Alexey Dobriyan
Re: [GIT]: Networking
Jarek Poplawski
[PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Gerrit Renker
[PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side)
David Miller
Re: [BUG] New Kernel Bugs
Colocation donated by:
Who's online
There are currently
8 users
and
863 guests
online.
Online users
davidward561
benefitsofcoll
dalesnail
twilightdolls61
subash_patel
colinnatalioafe
laptopaccount01
webcashformula
Syndicate