svn commit: r305177 - head/sys/net

Benjamin Kaduk bjkfbsd at gmail.com
Thu May 18 15:10:06 UTC 2017


On Thu, May 18, 2017 at 10:00 AM, Oleg Bulyzhin <oleg at freebsd.org> wrote:

> On Thu, May 18, 2017 at 04:25:01PM +0200, Hans Petter Selasky wrote:
> >
> > Can you explain a bit more what is wrong?
> >
> > > If you care about readability it should be:
> > > ((((pri) & 7) << 13) | (((cfi) & 1) << 12) | ((vlid) & EVL_VLID_MASK))
> >
> > Isn't this exactly what the patch is doing? -R ???
>
> Current version is shifting pri out of uint16. If you examine parentheses:
> pri is shifted left 13, then 12.
> Original version did it right (shift 1, then 12 (total 13)).
>

Calculations in the C abstract machine would be performed in the 'int' type
to which uint16 operands are promoted, though.

-Ben


More information about the svn-src-all mailing list