From: Eric Wong <e@80x24.org>
To: "Nicolás Ojeda Bär" <n.oje.bar@gmail.com>
Cc: meta@public-inbox.org
Subject: [PATCH 1/2] syscall: avoid needless string comparison on x86-64
Date: Mon, 17 Oct 2022 09:30:52 +0000 [thread overview]
Message-ID: <20221017093053.1517046-2-e@80x24.org> (raw)
In-Reply-To: <20221015081246.18167-1-n.oje.bar@gmail.com>
For common x86-64 systems, we can avoid a needless
string comparison on `mips64' by restructuring the
branches for architecture detection.
---
lib/PublicInbox/Syscall.pm | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm
index 412ca64f..291e0489 100644
--- a/lib/PublicInbox/Syscall.pm
+++ b/lib/PublicInbox/Syscall.pm
@@ -97,15 +97,14 @@ if ($^O eq "linux") {
# boundaries.
my $u64_mod_8 = 0;
- # if we're running on an x86_64 kernel, but a 32-bit process,
- # we need to use the x32 or i386 syscall numbers.
- if ($machine eq "x86_64" && $Config{ptrsize} == 4) {
- $machine = $Config{cppsymbols} =~ /\b__ILP32__=1\b/ ? 'x32' : 'i386';
- }
-
- # Similarly for mips64 vs mips
- if ($machine eq "mips64" && $Config{ptrsize} == 4) {
- $machine = "mips";
+ if ($Config{ptrsize} == 4) {
+ # if we're running on an x86_64 kernel, but a 32-bit process,
+ # we need to use the x32 or i386 syscall numbers.
+ if ($machine eq 'x86_64') {
+ $machine = $Config{cppsymbols} =~ /\b__ILP32__=1\b/ ? 'x32' : 'i386'
+ } elsif ($machine eq 'mips64') { # similarly for mips64 vs mips
+ $machine = 'mips';
+ }
}
if ($machine =~ m/^i[3456]86$/) {
next prev parent reply other threads:[~2022-10-17 9:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-15 8:12 SIGWINCH not recognized under macOS Nicolás Ojeda Bär
2022-10-15 8:12 ` [PATCH] SIGWINCH is 28 on macOS Nicolás Ojeda Bär
2022-10-17 8:33 ` [PATCH] SIGWINCH is 28 on Darwin-based OSes Eric Wong
2022-10-17 9:30 ` [PATCH 0/2] fix SIGWINCH for Linux MIPS and PA-RISC Eric Wong
2022-10-17 9:30 ` Eric Wong [this message]
2022-10-17 9:30 ` [PATCH 2/2] sigfd: set SIGWINCH for MIPS and PA-RISC on Linux Eric Wong
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
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221017093053.1517046-2-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
--cc=n.oje.bar@gmail.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).