BinaryAnalysisPlatform / bap

Binary Analysis Platform
MIT License
2.07k stars 273 forks source link

adds arbitrary-precision loopless clz and popcount to Primus Lisp #1464

Closed ivg closed 2 years ago

ivg commented 2 years ago

The pure Primus Lisp implementation supports both statically known and unknown inputs of any lengths. For statically unknown inputs, the generated code will not have any loops and will be proportional in size to the size of inputs in bits divided by 64. The popcount implementation is also branchless.

This PR also hides specialized functions such as clzN and popcountN functions in favor of the generic clz and popcount functions.

Not, to properly function on statically known values, this PR needs #1463.

bmourad01 commented 2 years ago

Would it also be useful to include a corresponding helper for ctz?