Expose popcount #10212
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-duplicate
Closed in favor of an existing report
library-core
type-enhancement
A request for a change that isn't a bug
Most CPUs have a popcount (http://en.wikipedia.org/wiki/Hamming_weight) instruction but it is not accessible in Dart.
Yet certain algorithms and datastructures rely on it (http://en.wikipedia.org/wiki/Hash_array_mapped_trie for instance).
So far I have used software emulations of popcount but it's a pain because
1. it's potentially slower than a C++ version and definitely slower than a CPU instruction
2. I don't know any fast implementation that works on both 32 and 64 bits architectures
Would it be possible to expose it as a method of int or num? (With a fallback to a C++ version in the VM for CPUs that don't support it and a software version in dart2js.)
The text was updated successfully, but these errors were encountered: