diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2009-08-26 12:23:40 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2009-08-26 12:23:40 +0000 |
commit | 8ed31e1809b9b62df050f92b08501e96f485c677 (patch) | |
tree | 7d1c1ede52dd154cb81adcbded913d5e6d6abc64 | |
parent | eeed523198867ebd135391608cc58cb62ed7f6ce (diff) |
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@
-rw-r--r-- | sys/dev/microcode/udl/build.c | 4 | ||||
-rw-r--r-- | sys/dev/microcode/udl/udl_huffman.h | 4 | ||||
-rw-r--r-- | sys/dev/usb/udl.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/udl.h | 6 |
4 files changed, 10 insertions, 10 deletions
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 <mglocker@openbsd.org> @@ -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 <mglocker@openbsd.org> @@ -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 <mglocker@openbsd.org> @@ -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) * \ |