From: Andreas Schwab <schwab@suse.de>
To: opensbi@lists.infradead.org
Subject: [PATCH] lib: sbi_scratch: Optimize the alignment code for alloc size
Date: Thu, 09 Mar 2023 10:57:44 +0100 [thread overview]
Message-ID: <mvmpm9ifdrb.fsf@suse.de> (raw)
In-Reply-To: <20230309094607.72318-1-wxjstz@126.com> (Xiang W.'s message of "Thu, 9 Mar 2023 17:46:07 +0800")
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."
prev parent reply other threads:[~2023-03-09 9:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 9:46 [PATCH] lib: sbi_scratch: Optimize the alignment code for alloc size Xiang W
2023-03-09 9:57 ` Andreas Schwab [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mvmpm9ifdrb.fsf@suse.de \
--to=schwab@suse.de \
--cc=opensbi@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox