Re: [PATCH][V2] net: dsa: mv88e6xxx: avoid unintended sign extension on a 16 bit shift

2018-02-19 Thread Richard Cochran
On Mon, Feb 19, 2018 at 12:19:16PM +, David Laight wrote: > This seems to be somewhat excessive 64bit maths on a 32bit system. > It is more than enough to make timelo/timehi 'unsigned int'. Do you see a difference in the generated code? Thanks, Richard

Re: [PATCH][V2] net: dsa: mv88e6xxx: avoid unintended sign extension on a 16 bit shift

2018-02-19 Thread Richard Cochran
On Mon, Feb 19, 2018 at 12:19:16PM +, David Laight wrote: > This seems to be somewhat excessive 64bit maths on a 32bit system. > It is more than enough to make timelo/timehi 'unsigned int'. Do you see a difference in the generated code? Thanks, Richard

RE: [PATCH][V2] net: dsa: mv88e6xxx: avoid unintended sign extension on a 16 bit shift

2018-02-19 Thread David Laight
From: Colin King > Sent: 16 February 2018 16:55 > > From: Colin Ian King > > The shifting of timehi by 16 bits to the left will be promoted to > a 32 bit signed int and then sign-extended to an u64. If the top bit > of timehi is set then all then all the upper bits of

RE: [PATCH][V2] net: dsa: mv88e6xxx: avoid unintended sign extension on a 16 bit shift

2018-02-19 Thread David Laight
From: Colin King > Sent: 16 February 2018 16:55 > > From: Colin Ian King > > The shifting of timehi by 16 bits to the left will be promoted to > a 32 bit signed int and then sign-extended to an u64. If the top bit > of timehi is set then all then all the upper bits of ns end up as also > being

Re: [PATCH][V2] net: dsa: mv88e6xxx: avoid unintended sign extension on a 16 bit shift

2018-02-16 Thread David Miller
From: Colin King Date: Fri, 16 Feb 2018 16:55:05 + > From: Colin Ian King > > The shifting of timehi by 16 bits to the left will be promoted to > a 32 bit signed int and then sign-extended to an u64. If the top bit > of timehi is set then

Re: [PATCH][V2] net: dsa: mv88e6xxx: avoid unintended sign extension on a 16 bit shift

2018-02-16 Thread David Miller
From: Colin King Date: Fri, 16 Feb 2018 16:55:05 + > From: Colin Ian King > > The shifting of timehi by 16 bits to the left will be promoted to > a 32 bit signed int and then sign-extended to an u64. If the top bit > of timehi is set then all then all the upper bits of ns end up as also >

[PATCH][V2] net: dsa: mv88e6xxx: avoid unintended sign extension on a 16 bit shift

2018-02-16 Thread Colin King
From: Colin Ian King The shifting of timehi by 16 bits to the left will be promoted to a 32 bit signed int and then sign-extended to an u64. If the top bit of timehi is set then all then all the upper bits of ns end up as also being set because of the sign-extension.

[PATCH][V2] net: dsa: mv88e6xxx: avoid unintended sign extension on a 16 bit shift

2018-02-16 Thread Colin King
From: Colin Ian King The shifting of timehi by 16 bits to the left will be promoted to a 32 bit signed int and then sign-extended to an u64. If the top bit of timehi is set then all then all the upper bits of ns end up as also being set because of the sign-extension. Fix this by making timehi