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

Ilkka Ollakka ilkka.ollakka+vlc at oamk.fi
Fri Jul 31 17:58:55 CEST 2009


On pe 31. heinäkuuta 2009 13.23.59, Laurent Aimar wrote:
> 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.
 
 Actually it was originally without need of multiply, but IMO it's much
 more readable in this form. But yes, they should be unsigned and const.

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

 Yes, I'll change it when I'll go back to modifying that if nobody else
 have changed those allready by then.

-- 
Ilkka Ollakka
The average woman would rather have beauty than brains, because the
average man can see better than he can think.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090731/e22f9a73/attachment.sig>


More information about the vlc-devel mailing list