ngscopeclient / scopehal

Test and measurement hardware abstraction library and protocol decodes. This is the library only. Most users should use scopehal-apps.
BSD 3-Clause "New" or "Revised" License
216 stars 97 forks source link

Fix next_pow2 for LLP64 (Windows) #849

Closed d235j closed 10 months ago

d235j commented 10 months ago

On Windows, __builtin_clzl() only handles 32-bit inputs due to LLP64. This causes problems when larger values are used. Changing this to __builtin_clzll() fixes the crashes. This most notably fixes the crash when running the demo scope on Windows, as next_pow2() is used in the code that performs the downscaling using FFTS.