From 8ed31e1809b9b62df050f92b08501e96f485c677 Mon Sep 17 00:00:00 2001 From: Marcus Glocker Date: Wed, 26 Aug 2009 12:23:40 +0000 Subject: Also avoid __packed struct to Huffman table in the driver side in favour of performance. Instead generate the Huffman table with two ints. Suggested, help and OK deraadt@ --- sys/dev/microcode/udl/build.c | 4 ++-- sys/dev/microcode/udl/udl_huffman.h | 4 ++-- sys/dev/usb/udl.c | 6 +++--- sys/dev/usb/udl.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/microcode/udl/build.c b/sys/dev/microcode/udl/build.c index 6e1855ccd31..d3d09146868 100644 --- a/sys/dev/microcode/udl/build.c +++ b/sys/dev/microcode/udl/build.c @@ -1,4 +1,4 @@ -/* $OpenBSD: build.c,v 1.3 2009/08/25 21:45:26 deraadt Exp $ */ +/* $OpenBSD: build.c,v 1.4 2009/08/26 12:23:39 mglocker Exp $ */ /* * Copyright (c) 2009 Marcus Glocker @@ -30,7 +30,7 @@ int main(void) { int fd, i; - uint8_t size; + uint32_t size; uint32_t value; fd = open(FILENAME, O_WRONLY | O_CREAT | O_TRUNC, 0644); diff --git a/sys/dev/microcode/udl/udl_huffman.h b/sys/dev/microcode/udl/udl_huffman.h index 4fe1f390b27..0580d142304 100644 --- a/sys/dev/microcode/udl/udl_huffman.h +++ b/sys/dev/microcode/udl/udl_huffman.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udl_huffman.h,v 1.2 2009/08/25 21:36:34 deraadt Exp $ */ +/* $OpenBSD: udl_huffman.h,v 1.3 2009/08/26 12:23:39 mglocker Exp $ */ /* * Huffman table for pixel difference compression. @@ -14,7 +14,7 @@ #define UDL_HUFFMAN_RECORDS 65536 + 1 struct record { - uint8_t size; + uint32_t size; uint32_t value; } udl_huffman[] = { { 20, 966905 }, diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c index 8020aa11849..34f8bfcff18 100644 --- a/sys/dev/usb/udl.c +++ b/sys/dev/usb/udl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udl.c,v 1.23 2009/08/25 19:46:51 mglocker Exp $ */ +/* $OpenBSD: udl.c,v 1.24 2009/08/26 12:23:39 mglocker Exp $ */ /* * Copyright (c) 2009 Marcus Glocker @@ -1052,10 +1052,10 @@ udl_cmd_insert_buf_comp(struct udl_softc *sc, uint8_t *buf, uint32_t len) { struct udl_cmd_buf *cb = &sc->sc_cmd_buf; struct udl_huffman *h; - uint8_t bit_count, bit_pos; + uint8_t bit_pos; uint16_t *pixels, prev; int16_t diff; - uint32_t bit_pattern, bit_cur; + uint32_t bit_count, bit_pattern, bit_cur; int i, j, bytes, eob, padding; udl_cmd_insert_check(cb, len); diff --git a/sys/dev/usb/udl.h b/sys/dev/usb/udl.h index 3eba18f0768..1ab664283e6 100644 --- a/sys/dev/usb/udl.h +++ b/sys/dev/usb/udl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udl.h,v 1.4 2009/08/25 19:46:51 mglocker Exp $ */ +/* $OpenBSD: udl.h,v 1.5 2009/08/26 12:23:39 mglocker Exp $ */ /* * Copyright (c) 2009 Marcus Glocker @@ -161,9 +161,9 @@ uint8_t udl_null_key_1[] = { * Compression. */ struct udl_huffman { - uint8_t bit_count; + uint32_t bit_count; uint32_t bit_pattern; -} __packed; +}; #define UDL_HUFFMAN_RECORD_SIZE sizeof(struct udl_huffman) #define UDL_HUFFMAN_RECORDS (65536 + 1) #define UDL_HUFFMAN_BASE (((UDL_HUFFMAN_RECORDS - 1) / 2) * \ -- cgit v1.2.3