AntelopeIO / bls12-381

A high performance C++ BLS library
MIT License
5 stars 6 forks source link

current `__builtin_clzll()` usage could lead to undefined behavior #7

Closed spoonincode closed 1 year ago

spoonincode commented 1 year ago

Originally reported here, https://github.com/AntelopeIO/bls12-381/pull/6#issuecomment-1662387001 and there is some additional commentary on that PR on potential fixes. __builtin_clzll() is undefined when input is 0, which it may be here https://github.com/AntelopeIO/bls12-381/blob/82a137ecdc010563a78673ddabf014dd0ec6ae77/src/scalar.cpp#L250-L251

yarkinwho commented 1 year ago

do you want me to fix that in the PR #6 together? It contains tons of optimization now anyway...

spoonincode commented 1 year ago

either way seems fine

greg7mdp commented 1 year ago

do you want me to fix that in the PR #6 together? It contains tons of optimization now anyway...

works for me.