On Tue, Jun 13, 2017 at 11:34:25AM -0400, Lance Richardson wrote:
> > From: "Ben Pfaff"
> > To: "Lance Richardson"
> > Cc: d...@openvswitch.org
> > Sent: Tuesday, 13 June, 2017 11:17:26 AM
> > Subject: Re: [PATCH] byte-order: Fix undefined behavior of
> From: "Ben Pfaff"
> To: "Lance Richardson"
> Cc: d...@openvswitch.org
> Sent: Tuesday, 13 June, 2017 11:17:26 AM
> Subject: Re: [PATCH] byte-order: Fix undefined behavior of BYTES_TO_BE32.
>
> On Tue, Jun 13, 2017 at 09:09:44AM -0400, Lance Richardson wrote:
On Tue, Jun 13, 2017 at 09:09:44AM -0400, Lance Richardson wrote:
> > From: "Ben Pfaff"
> > To: d...@openvswitch.org
> > Cc: "Ben Pfaff" , "Lance Richardson"
> > Sent: Tuesday, 13 June, 2017 12:51:14 AM
> > Subject: [PATCH] byte-order: Fix
> From: "Ben Pfaff"
> To: d...@openvswitch.org
> Cc: "Ben Pfaff" , "Lance Richardson"
> Sent: Tuesday, 13 June, 2017 12:51:14 AM
> Subject: [PATCH] byte-order: Fix undefined behavior of BYTES_TO_BE32.
>
> A left shift that would produce a result
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.
Also document and convert a macro to a function.