From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 01/16] vga: use common endian swap macros
Date: Thu, 18 Jan 2024 13:24:01 +0100 [thread overview]
Message-ID: <20240118122416.9209-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20240118122416.9209-1-pbonzini@redhat.com>
The constant-expression bswap is provided by const_le32(), and GET_PLANE()
can also be implemented using cpu_to_le32(). Remove the custom macros in
vga.c.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/display/vga.c | 65 +++++++++++++-----------------------------------
1 file changed, 17 insertions(+), 48 deletions(-)
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 886a4020e5d..a8b5830a30a 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -90,58 +90,27 @@ const uint8_t gr_mask[16] = {
0x00, /* 0x0f */
};
-#define cbswap_32(__x) \
-((uint32_t)( \
- (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
- (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
- (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
- (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) ))
-
-#if HOST_BIG_ENDIAN
-#define PAT(x) cbswap_32(x)
-#else
-#define PAT(x) (x)
-#endif
-
-#if HOST_BIG_ENDIAN
-#define BIG 1
-#else
-#define BIG 0
-#endif
-
-#if HOST_BIG_ENDIAN
-#define GET_PLANE(data, p) (((data) >> (24 - (p) * 8)) & 0xff)
-#else
-#define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff)
-#endif
+#define GET_PLANE(data, p) ((cpu_to_le32(data) >> ((p) * 8)) & 0xff)
static const uint32_t mask16[16] = {
- PAT(0x00000000),
- PAT(0x000000ff),
- PAT(0x0000ff00),
- PAT(0x0000ffff),
- PAT(0x00ff0000),
- PAT(0x00ff00ff),
- PAT(0x00ffff00),
- PAT(0x00ffffff),
- PAT(0xff000000),
- PAT(0xff0000ff),
- PAT(0xff00ff00),
- PAT(0xff00ffff),
- PAT(0xffff0000),
- PAT(0xffff00ff),
- PAT(0xffffff00),
- PAT(0xffffffff),
+ const_le32(0x00000000),
+ const_le32(0x000000ff),
+ const_le32(0x0000ff00),
+ const_le32(0x0000ffff),
+ const_le32(0x00ff0000),
+ const_le32(0x00ff00ff),
+ const_le32(0x00ffff00),
+ const_le32(0x00ffffff),
+ const_le32(0xff000000),
+ const_le32(0xff0000ff),
+ const_le32(0xff00ff00),
+ const_le32(0xff00ffff),
+ const_le32(0xffff0000),
+ const_le32(0xffff00ff),
+ const_le32(0xffffff00),
+ const_le32(0xffffffff),
};
-#undef PAT
-
-#if HOST_BIG_ENDIAN
-#define PAT(x) (x)
-#else
-#define PAT(x) cbswap_32(x)
-#endif
-
static uint32_t expand4[256];
static uint16_t expand2[256];
static uint8_t expand4to8[16];
--
2.43.0
next prev parent reply other threads:[~2024-01-18 12:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 12:24 [PULL 00/16] VGA, x86 TCG, misc changes for 2024-01-18 Paolo Bonzini
2024-01-18 12:24 ` Paolo Bonzini [this message]
2024-01-18 12:24 ` [PULL 02/16] vga: introduce VGADisplayParams Paolo Bonzini
2024-01-18 12:24 ` [PULL 03/16] vga: mask addresses in non-VESA modes to 256k Paolo Bonzini
2024-01-18 12:24 ` [PULL 04/16] vga: implement horizontal pel panning in graphics modes Paolo Bonzini
2024-01-18 12:24 ` [PULL 05/16] vga: optimize horizontal pel panning in 256-color modes Paolo Bonzini
2024-01-18 12:24 ` [PULL 06/16] vga: reindent memory access code Paolo Bonzini
2024-01-18 12:24 ` [PULL 07/16] vga: use latches in odd/even mode too Paolo Bonzini
2024-01-18 12:24 ` [PULL 08/16] vga: sort-of implement word and double-word access modes Paolo Bonzini
2024-01-18 12:24 ` [PULL 09/16] Add class property to configure KVM device node to use Paolo Bonzini
2024-01-18 12:24 ` [PULL 10/16] io_uring: move LuringState typedef to block/aio.h Paolo Bonzini
2024-01-18 12:24 ` [PULL 11/16] target/i386: Do not re-compute new pc with CF_PCREL Paolo Bonzini
2024-01-18 12:24 ` [PULL 12/16] target/i386: fix incorrect EIP in PC-relative translation blocks Paolo Bonzini
2024-01-18 12:24 ` [PULL 13/16] target/i386: pcrel: store low bits of physical address in data[0] Paolo Bonzini
2024-01-18 12:24 ` [PULL 14/16] remove unnecessary casts from uintptr_t Paolo Bonzini
2024-01-18 12:24 ` [PULL 15/16] qemu/osdep: Add huge page aligned support on LoongArch platform Paolo Bonzini
2024-01-18 12:24 ` [PULL 16/16] tests/tcg: Don't #include <inttypes.h> in aarch64/system/vtimer.c Paolo Bonzini
2024-01-19 16:41 ` [PULL 00/16] VGA, x86 TCG, misc changes for 2024-01-18 Peter Maydell
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=20240118122416.9209-2-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).