support freebsd versions without log2 function
Merge pull request #1510 from schmurfy/freebsd_fix

fixed compilation on freebsd releases witout log2 function