Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

.NET Core 3 (in preview, due out Sep 23) includes support for popcount as part of the BitOperations class: https://docs.microsoft.com/en-us/dotnet/api/system.numerics..... There's a recent post describing hardware intrinsics in .NET Core: https://devblogs.microsoft.com/dotnet/hardware-intrinsics-in...

There are a lot of potential use cases, but one of the early discussions was around quickly scanning for known HTTP headers. You can see that in use here: https://github.com/aspnet/AspNetCore/blob/caa910ceeba5f2b2c0...

If you really need help falling asleep, here's the discussion going back to 2015: https://github.com/dotnet/corefx/issues/2209

Disclaimers: Microsoft employee, Nazgûl



GHC also includes a `popCount` function that is implemented in terms of the built-in instruction: https://haskell-works.github.io/posts/2018-08-22-pdep-and-pe...


Cool!

It would be nice to get bitscanforward/reverse too.

I created this library long ago to get popcnt on desktop .net: https://github.com/omgtehlion/netintrinsics

Blog post with more details (in Russian): https://m.habr.com/ru/post/239619/

EDIT: found lzcnt/tzcnt on a linked page, thanks! But what about bswap or I'm asking too much? ))


.NET is getting some really cool stuff lately. Sadly, it'll likely be irrelevant to me for the time to come




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: