Date: Thu, 18 May 2017 10:10:01 -0500 From: Benjamin Kaduk <bjkfbsd@gmail.com> To: Oleg Bulyzhin <oleg@freebsd.org> Cc: Hans Petter Selasky <hps@selasky.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, araujo@freebsd.org, hps@freebsd.org, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Sepherosa Ziehau <sephe@freebsd.org> Subject: Re: svn commit: r305177 - head/sys/net Message-ID: <CAJ5_RoB=YA4=XhCmhJ3nCnLKvSYq8Rv%2BpWh-YmvE7v9D4VRrrA@mail.gmail.com> In-Reply-To: <20170518150030.GA55481@lath.RINET.ru> References: <201609010632.u816WZUj025186@repo.freebsd.org> <20170518140403.GA54405@lath.RINET.ru> <355478da-ed4d-60bb-bb4e-144a694e28b8@selasky.org> <20170518150030.GA55481@lath.RINET.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 18, 2017 at 10:00 AM, Oleg Bulyzhin <oleg@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ5_RoB=YA4=XhCmhJ3nCnLKvSYq8Rv%2BpWh-YmvE7v9D4VRrrA>