[PATCH] lib: sbi_scratch: Optimize the alignment code for alloc size

Andreas Schwab schwab at suse.de
Thu Mar 9 01:57:44 PST 2023


On Mär 09 2023, Xiang W wrote:

> +	size = (size + __SIZEOF_POINTER__ - 1) & ~(__SIZEOF_POINTER__ - 1);

It is probably more robust to convert (__SIZEOF_POINTER__ - 1) to
unsigned long before inverting.  This currently depends on the fact that
~(__SIZEOF_POINTER__ - 1) is a signed int, and thus sign extended, to
work correctly.

-- 
Andreas Schwab, SUSE Labs, schwab at suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



More information about the opensbi mailing list