[flac-dev] [PATCH 15] assert for bitmath functions

lvqcl lvqcl.mail at gmail.com
Sat Jun 28 04:18:00 PDT 2014


In FLAC 1.2.1 there was an assert in FLAC__bitmath_ilog2 and
FLAC__bitmath_ilog2_wide functions:

     unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
     {
         unsigned l = 0;
         FLAC__ASSERT(v > 0);
         while(v >>= 1)
             l++;
         return l;
     }


Now there's no test for the argument of FLAC__bitmath_ilog2(),
and if its argument is equal to 0, the result is "undefined".
FLAC__bitmath_ilog2_wide() returns 0 in this case.
(Actually their arguments are really never equal to 0)


This patch re-adds FLAC__ASSERT() to bitmath functions
(better to have an assert in debug mode instead of undefined result).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 15_bitmath.patch
Type: application/octet-stream
Size: 3169 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20140628/0f7ee1c9/attachment.obj 


More information about the flac-dev mailing list