lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1205603650.19648.1242579149@webmail.messagingengine.com>
Date:	Sat, 15 Mar 2008 18:54:10 +0100
From:	"Alexander van Heukelum" <heukelum@...tmail.fm>
To:	"Andi Kleen" <andi@...stfloor.org>
Cc:	"Andi Kleen" <andi@...stfloor.org>,
	"Jeremy Fitzhardinge" <jeremy@...p.org>,
	"Alexander van Heukelum" <heukelum@...lshack.com>,
	"Ingo Molnar" <mingo@...e.hu>,
	"Thomas Gleixner" <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	"LKML" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86: merge the simple bitops and move them to bitops.h


On Fri, 14 Mar 2008 23:18:45 +0100, "Andi Kleen" <andi@...stfloor.org>
said:
> > #else
> > static inline int fls64(__u64 x)
> > {
> >         if (x == 0)
> >                 return 0;
> >         return __fls(x) + 1;
> 
> That would require a polymorphic macro __fls that adapts to 32bit and
> 64bit arguments.  Not good C style.

Hi Andi,

It's unsigned long __fls(unsigned long)... and this is only compiled
if unsigned long is as long as u64. Seems fine to me. Moreover, it
is _exactly_ how it is done in x86_64 now. I must be missing something.

> > This is the only reason that this define exists. With another
> > name it would be fine. HWEIGHT_USE_MULTIPLIER?
> 
> AFAIK it only exists because some ancient sparc chips had incredibly
> slow multipliers.

Good to know. And I realized that there is also the machines without
a hardware multiply instruction at all. So you are right. i386/x86_64
should just unconditionally set ARCH_HAS_FAST_MULTIPLIER.

> > And my feeling is that this is exactly the reason why this is
> > not a good version for a generic implementation in bitops.h. But
> > I don't care much.
> 
> I bet most different approaches who might be slightly
> faster for larger bit strings would make the one bit 
> case slower.

That is true, of course. But then the name of the function should
give a hint that it is optimized for short sequences.

Greetings,
    Alexander
-- 
  Alexander van Heukelum
  heukelum@...tmail.fm

-- 
http://www.fastmail.fm - Or how I learned to stop worrying and
                          love email again

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ