[vlc-devel] commit: dvb-c: somewhat working channel-scanning in linux (Ilkka Ollakka )

Laurent Aimar fenrir at via.ecp.fr
Fri Jul 31 13:23:59 CEST 2009


On Fri, Jul 31, 2009, jpd at videolan.org wrote:
> On Fri, Jul 31, 2009 at 01:02:57PM +0200, git version control wrote:
> > +    if( p_scan->i_index < (sizeof(frequencies)/sizeof(int)) )
> >      {
> > -        p_cfg->i_frequency = 13800000 + ( ( p_scan->i_index - (72 + 21 ) )  * 800000);
> > +        p_cfg->i_frequency = 1000000 * ( frequencies[ p_scan->i_index ] );
> 
> I'd be inclined to pre-multiply as the frequencies are stored as int
> (could be unsigned) anyway, saving some multiplications. Minor nit.
 Here, it is absolutly not time critical, so IMHO the only thing to take into
consideration is whether or not pre-multiplied values will increase
readability.

> > +    *pf_pos = (double)p_scan->i_index / (sizeof(frequencies)/sizeof(int));
sizeof(frequencies)/sizeof(*frequencies)
is way better in the long term.

-- 
fenrir




More information about the vlc-devel mailing list