On Mon, Mar 16, 2020 at 07:11:54PM +0900, Punit Agrawal wrote: > Kever Yang <[email protected]> writes: > > > On 2020/3/16 下午3:28, Punit Agrawal wrote: > >> Kever Yang <[email protected]> writes: > > [...] > > >> Instead of adding another copy of this code (versions of it already > >> exist in imx8mimage.c, ifwitool.c, aisiamge.c), it would be better to > >> move the below snippet to imagetool.h. > >> > >> #define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) > >> #define ALIGN(x, a) __ALIGN_MASK((x), (typeof(x))(a) - 1) > >> > >> With this, you can drop the version in imx8mimage.c which seems to > >> introduce an unnecessary multiplication / division. > > > > > > The definition of ALIGN is already at include/linux/kernel.h, is it > > better to use that directly? > > If there are no restrictions to include that header, please use > it. It'll be better than making another copy. :)
We can't use that header in tools/ user-space code, no. Using imagetool.h by the ARRAY_SIZE macro is a good spot. Thanks! -- Tom
signature.asc
Description: PGP signature

