On Sat, 5 Mar 2016 19:03:24 +0100, Bart (bartjun...@gmail.com) wrote
about "[fpc-pascal] Bitcounting" (in
):
> Does FreePascal have a routine for counting bits?
[snip]
> Surely this can be done better?
If you don't mind a bit of C, attached is what I use. It is blazingly
fast compared to examinin
En Sat, 05 Mar 2016 12:03:24 -0600, Bart escribió:
Hi,
Does FreePascal have a routine for counting bits?
So that e.g. BitCount(%100110011) gives 5 (number of bits that are
1)?
I came up with (extracted from IntToBin()):
function BitCount(N: Int64): Integer;
var
Q: QWord;
i: Intege
On 3/5/16, Jonas Maebe wrote:
> The "compilerproc" modifier does not influence code generation other
> than symbol mangling. You can just look at the implementation in the
> system unit like for any other routine.
Lazarus code-tools didn't get me there ;-)
Found it in compilerproc.inc.
Thanks.
On 05/03/16 23:12, Bart wrote:
On 3/5/16, Jonas Maebe wrote:
>FPC 3.x has system.popcnt
Thanks.
I see it's a compilerproc.
How can I see how it'simplemented?
The "compilerproc" modifier does not influence code generation other
than symbol mangling. You can just look at the implementation i
On 3/5/16, Jonas Maebe wrote:
> FPC 3.x has system.popcnt
Thanks.
I see it's a compilerproc.
How can I see how it'simplemented?
Bart
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-p
El 05/03/16 a las 19:03, Bart escribió:
> Hi,
>
> Does FreePascal have a routine for counting bits?
> So that e.g. BitCount(%100110011) gives 5 (number of bits that are 1)?
>
> I came up with (extracted from IntToBin()):
>
> function BitCount(N: Int64): Integer;
> var
> Q: QWord;
> i: Integ
On 05/03/16 19:03, Bart wrote:
Does FreePascal have a routine for counting bits?
So that e.g. BitCount(%100110011) gives 5 (number of bits that are 1)?
FPC 3.x has system.popcnt
Jonas
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
h
The PopCount functions do exactly that.
On 03/05/2016 07:03 PM, Bart wrote:
Hi,
Does FreePascal have a routine for counting bits?
So that e.g. BitCount(%100110011) gives 5 (number of bits that are 1)?
I came up with (extracted from IntToBin()):
function BitCount(N: Int64): Integer;
var
On 05/03/2016 18:03, Bart wrote:
Hi,
Does FreePascal have a routine for counting bits?
So that e.g. BitCount(%100110011) gives 5 (number of bits that are 1)?
I came up with (extracted from IntToBin()):
Have a look at
http://stackoverflow.com/questions/3815165/how-to-implement-bitcount-usi
sorry ... need change intToStr in my suggestion by something like intToStrBin
length( strChange( intToStrBin( N, '0', ''));
but it is just for fun!
De: fpc-pascal-boun...@lists.freepascal.org
em nome de Bart
Enviado: sábado, 5 de março de 2016 15:03
Pa
pseudocode
length( strChange( intToStr( N), '0', ''));
De: fpc-pascal-boun...@lists.freepascal.org
em nome de Bart
Enviado: sábado, 5 de março de 2016 15:03
Para: FPC-Pascal users discussions
Assunto: [fpc-pascal] Bitcounting
Hi,
Does FreePascal have a
11 matches
Mail list logo