Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Ben Pfaff
Sent: Monday, 12 June, 2017 6:44:43 PM > > Subject: Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with > > unrepresentable results > > > > On 06/12/2017 01:13 PM, Lance Richardson wrote: > > > A left shift that would produce a result that is not representa

Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Greg Rose
On 06/12/2017 04:36 PM, Lance Richardson wrote: - Original Message - > From: "Greg Rose" <gvrose8...@gmail.com> > To: "Lance Richardson" <lrich...@redhat.com> > Cc: d...@openvswitch.org > Sent: Monday, 12 June, 2017 6:44:43 PM > Subjec

Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Lance Richardson
- Original Message - > From: "Greg Rose" <gvrose8...@gmail.com> > To: "Lance Richardson" <lrich...@redhat.com> > Cc: d...@openvswitch.org > Sent: Monday, 12 June, 2017 6:44:43 PM > Subject: Re: [ovs-dev] [PATCH] byte-order: avoid left shift

Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Greg Rose
On 06/12/2017 01:13 PM, Lance Richardson wrote: A left shift that would produce a result that is not representable by the type of the expression's result has "undefined behavior" according to the C language standard. Avoid this by casting values that could set the upper bit to unsigned types.

[ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Lance Richardson
A left shift that would produce a result that is not representable by the type of the expression's result has "undefined behavior" according to the C language standard. Avoid this by casting values that could set the upper bit to unsigned types. Found via gcc's undefined behavior sanitizer.