Anybody know of a BitScanReverse intrinsic in C# Net 6.0?

Discussion of chess software programming and technical issues.

Moderator: Ras

Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Anybody know of a BitScanReverse intrinsic in C# Net 6.0?

Post by Chessnut1071 »

I see why C++ is preferred over C#, but, I don't have time for C++ right now.
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Anybody know of a BitScanReverse intrinsic in C# Net 6.0?

Post by dangi12012 »

Why open a second thread?
You already said you could make it work?

C# .net 6/5 .net core 3.1/2.1/2 and .net framework 4.8/4.7/4.6/4/3.8/3.6/3.5 literally all have access to instrinsics.
The newer ones even natively.

Its still this one Chessnut:
ulong result = System.Runtime.Intrinsics.X86.Bmi1.X64.TrailingZeroCount(value);
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Re: Anybody know of a BitScanReverse intrinsic in C# Net 6.0?

Post by Chessnut1071 »

dangi12012 wrote: Sat Dec 18, 2021 1:23 am Why open a second thread?
You already said you could make it work?

C# .net 6/5 .net core 3.1/2.1/2 and .net framework 4.8/4.7/4.6/4/3.8/3.6/3.5 literally all have access to instrinsics.
The newer ones even natively.

Its still this one Chessnut:
ulong result = System.Runtime.Intrinsics.X86.Bmi1.X64.TrailingZeroCount(value);
TrailingZeroCount is working for my North vectors. Now I need the south vectors and the opposite of TrailingZeroCount. I can't seem to find an equivalent to BitScanReverse like in C++ and the MS docs didn't list a method under Bmi.X64
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Anybody know of a BitScanReverse intrinsic in C# Net 6.0?

Post by dangi12012 »

Chessnut1071 wrote: Sat Dec 18, 2021 1:51 am
dangi12012 wrote: Sat Dec 18, 2021 1:23 am Why open a second thread?
You already said you could make it work?

C# .net 6/5 .net core 3.1/2.1/2 and .net framework 4.8/4.7/4.6/4/3.8/3.6/3.5 literally all have access to instrinsics.
The newer ones even natively.

Its still this one Chessnut:
ulong result = System.Runtime.Intrinsics.X86.Bmi1.X64.TrailingZeroCount(value);
TrailingZeroCount is working for my North vectors. Now I need the south vectors and the opposite of TrailingZeroCount. I can't seem to find an equivalent to BitScanReverse like in C++ and the MS docs didn't list a method under Bmi.X64
There you go. Just google once yourself before posting on this board
https://docs.microsoft.com/en-us/dotnet ... ew=net-6.0
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Re: Anybody know of a BitScanReverse intrinsic in C# Net 6.0?

Post by Chessnut1071 »

dangi12012 wrote: Sat Dec 18, 2021 2:11 am
Chessnut1071 wrote: Sat Dec 18, 2021 1:51 am
dangi12012 wrote: Sat Dec 18, 2021 1:23 am Why open a second thread?
You already said you could make it work?

C# .net 6/5 .net core 3.1/2.1/2 and .net framework 4.8/4.7/4.6/4/3.8/3.6/3.5 literally all have access to instrinsics.
The newer ones even natively.

Its still this one Chessnut:
ulong result = System.Runtime.Intrinsics.X86.Bmi1.X64.TrailingZeroCount(value);
TrailingZeroCount is working for my North vectors. Now I need the south vectors and the opposite of TrailingZeroCount. I can't seem to find an equivalent to BitScanReverse like in C++ and the MS docs didn't list a method under Bmi.X64
There you go. Just google once yourself before posting on this board
https://docs.microsoft.com/en-us/dotnet ... ew=net-6.0
thx dangi.
Actually, I tried to Goggled that method for 2 days. I thought it was under Bmi1 instead of Lzcnt. My bitboard is about 90% done. I hope its a lot faster than my mail box, otherwise, I wasted a huge amount of time,