RE: [EXT] RE: [PATCH] media: amphion: fix some error related with undefined reference to __divdi3

From: Ming Qian
Date: Thu Mar 10 2022 - 03:37:24 EST


> -----Original Message-----
> From: David Laight [mailto:David.Laight@xxxxxxxxxx]
> Sent: Wednesday, March 9, 2022 9:27 PM
> To: Ming Qian <ming.qian@xxxxxxx>; mchehab@xxxxxxxxxx;
> shawnguo@xxxxxxxxxx; robh+dt@xxxxxxxxxx; s.hauer@xxxxxxxxxxxxxx
> Cc: hverkuil-cisco@xxxxxxxxx; kernel@xxxxxxxxxxxxxx; festevam@xxxxxxxxx;
> dl-linux-imx <linux-imx@xxxxxxx>; Aisheng Dong <aisheng.dong@xxxxxxx>;
> linux-media@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> devicetree@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Subject: [EXT] RE: [PATCH] media: amphion: fix some error related with
> undefined reference to __divdi3
>
> Caution: EXT Email
>
> From: Ming Qian
> > Sent: 09 March 2022 05:02
> ...
> > 3. use 'val >> 1' instead of ' val / 2'
>
> The compiler should do that anyway.
>
> Especially for unsigned values.
> And it has the wrong (different) rounding for negative values.
>
> David
>

Hi David,
Yes, you are right, if the value is negative, the behavior is wrong.
But here, the value type is u32, so I think it's OK.

Ming

> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1
> 1PT, UK Registration No: 1397386 (Wales)