diff options
author | Gerd Hoffmann | 2018-10-15 07:53:33 +0200 |
---|---|---|
committer | Gerd Hoffmann | 2018-10-15 09:57:33 +0200 |
commit | 2e4a0b176642c5ffcca063880ad2aa8e44c78c8a (patch) | |
tree | 35803ecd0fbf02eb9fc1248fbd297f850a34ce78 /hw/display/edid-generate.c | |
parent | Merge remote-tracking branch 'remotes/kraxel/tags/ui-20181012-pull-request' i... (diff) | |
download | qemu-2e4a0b176642c5ffcca063880ad2aa8e44c78c8a.tar.gz qemu-2e4a0b176642c5ffcca063880ad2aa8e44c78c8a.tar.xz qemu-2e4a0b176642c5ffcca063880ad2aa8e44c78c8a.zip |
edid: fix alignment issues
Use stl_le_p() & friends instead of casts.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20181015055333.32030-1-kraxel@redhat.com
Diffstat (limited to 'hw/display/edid-generate.c')
-rw-r--r-- | hw/display/edid-generate.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c index 37e60fe42a..bdf5e1d4d4 100644 --- a/hw/display/edid-generate.c +++ b/hw/display/edid-generate.c @@ -223,7 +223,7 @@ static void edid_desc_timing(uint8_t *desc, uint32_t clock = 75 * (xres + xblank) * (yres + yblank); - *(uint32_t *)(desc) = cpu_to_le32(clock / 10000); + stl_le_p(desc, clock / 10000); desc[2] = xres & 0xff; desc[3] = xblank & 0xff; @@ -342,9 +342,9 @@ void qemu_edid_generate(uint8_t *edid, size_t size, (((info->vendor[2] - '@') & 0x1f) << 0)); uint16_t model_nr = 0x1234; uint32_t serial_nr = info->serial ? atoi(info->serial) : 0; - *(uint16_t *)(edid + 8) = cpu_to_be16(vendor_id); - *(uint16_t *)(edid + 10) = cpu_to_le16(model_nr); - *(uint32_t *)(edid + 12) = cpu_to_le32(serial_nr); + stw_be_p(edid + 8, vendor_id); + stw_le_p(edid + 10, model_nr); + stl_le_p(edid + 12, serial_nr); /* manufacture week and year */ edid[16] = 42; |