[U-Boot-Users] [PATCH] ppc: Add u64 versions of fls64 and __ilog bitops
Wolfgang Denk
wd at denx.de
Wed Jun 11 01:51:22 CEST 2008
Dear Kumar,
in message <3F2661BD-8C86-410F-984D-B887242A8AA2 at kernel.crashing.org> you wrote:
>
> > Comments and code do not match; you'r actually adding much more code.
>
> I was just needing the u64 versions and the other stuff came along to
> make it work :)
Please make the comment match the code.
> > Also: is fls() vs. __fls() a good way to differentiate between int and
> > ulong?
>
> I took this from the kernel source tree and didn't really pay much
> attention to it.
Maybe we can do better?
> >> + * fls64(value) returns 0 if value is 0 or the position of the last
> >> + * set bit if value is nonzero. The last (most significant) bit is
> >
> > Sorry, I can't parse this.
>
> again taken from kernel land.
No reason not to fix it.
> >> +#elif BITS_PER_LONG == 64
> >> +static inline int fls64(__u64 x)
> >> +{
> >> + if (x == 0)
> >> + return 0;
> >> + return __fls(x) + 1;
> >
> > Do I have to understand where the "+1" is coming from?
>
> Nope, you can just accept it. I can drop this for now since I don't
> believe we support any ppc64 machines.
I guess we might see support for the PA6T soon. SO please leave it
here.
And I'd appreciate if somebody could explain the code to me...
> >> +static inline int ffs64(u64 x)
> >> +{
> >> + return __ilog2_u64(x & -x) + 1ull;
> >
> > Isn't there an easier way to do this?
>
> Not aware of one.
>
> So, I've stolen this from the kernel and am not sure what you'd like
> for me to change at this point.
Please clean it up and fix at least the obvious issues.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Build a system that even a fool can use and only a fool will want to
use it.
More information about the U-Boot
mailing list