[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flac-dev
Subject:    Re: [flac-dev] [PATCH 2] more changes in bitmath.h
From:       Erik de Castro Lopo <mle+la () mega-nerd ! com>
Date:       2015-12-29 19:30:30
Message-ID: 20151230063030.404dcc484b18deab64182c26 () mega-nerd ! com
[Download RAW message or body]

lvqcl wrote:

> 1) FLAC supports only MSVS 2005 and newer, so (_MSC_VER >= 1400)
> is always true and can be removed.
> 
> 
> 2) The argument for FLAC__clz_uint32() is of FLAC__uint32 type, so
> FLAC__clz_soft_uint32() should have the same argument type.
> 
> 
> 3) The patch removes unnecessary parentheses around 'word' variable.
> 
> 
> 4) It also replaces "sizeof(FLAC__uint32) * CHAR_BIT  - 1 - FLAC__clz_uint32(v)"
> with "FLAC__clz_uint32(v) ^ 31U" (and the same for 64-bit version).
> 
> "sizeof(FLAC__uint32) * CHAR_BIT" must be 32, or the code won't work.
> So it's simpler to use "31 - FLAC__clz_uint32(v)" or even better,
> "FLAC__clz_uint32(v) ^ 31".
> 
> Why XORing is better: gcc implements __builtin_clz as bsr^31, so
> FLAC__bitmath_ilog2() now calculates 31 - (bsr^31). GCC is unable
> to simplify it to just bsr. But it can do it for (bsr^31)^31.
> 
> 
> 5) The patch adds FLAC__U64L() for a big constant.


Applied. Thanks.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic