Undo previous that incorrectly byte-swaps stamps for little endian

machines when RI_BSWAP is *not* set.  Redo my original fix to directly
build stamps in desired endianness instead of calling bswap32().
This commit is contained in:
uwe 2002-02-11 20:50:58 +00:00
parent e858ed8fa4
commit 6e320d03b8
1 changed files with 18 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops8.c,v 1.15 2002/02/08 14:55:23 uch Exp $ */
/* $NetBSD: rasops8.c,v 1.16 2002/02/11 20:50:58 uwe Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.15 2002/02/08 14:55:23 uch Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.16 2002/02/11 20:50:58 uwe Exp $");
#include "opt_rasops.h"
@ -189,23 +189,24 @@ rasops8_makestamp(ri, attr)
stamp_attr = attr;
for (i = 0; i < 16; i++) {
#if BYTE_ORDER == LITTLE_ENDIAN
stamp[i] = (i & 8 ? fg : bg);
stamp[i] |= ((i & 4 ? fg : bg) << 8);
stamp[i] |= ((i & 2 ? fg : bg) << 16);
stamp[i] |= ((i & 1 ? fg : bg) << 24);
#if BYTE_ORDER == BIG_ENDIAN
#define NEED_LITTLE_ENDIAN_STAMP RI_BSWAP
#else
stamp[i] = (i & 1 ? fg : bg);
stamp[i] |= ((i & 2 ? fg : bg) << 8);
stamp[i] |= ((i & 4 ? fg : bg) << 16);
stamp[i] |= ((i & 8 ? fg : bg) << 24);
#define NEED_LITTLE_ENDIAN_STAMP 0
#endif
#if BYTE_ORDER == LITTLE_ENDIAN
if ((ri->ri_flg & RI_BSWAP) == 0)
#else
if ((ri->ri_flg & RI_BSWAP) != 0)
#endif
stamp[i] = bswap32(stamp[i]);
if ((ri->ri_flg & RI_BSWAP) == NEED_LITTLE_ENDIAN_STAMP) {
/* little endian */
stamp[i] = (i & 8 ? fg : bg);
stamp[i] |= ((i & 4 ? fg : bg) << 8);
stamp[i] |= ((i & 2 ? fg : bg) << 16);
stamp[i] |= ((i & 1 ? fg : bg) << 24);
} else {
/* big endian */
stamp[i] = (i & 1 ? fg : bg);
stamp[i] |= ((i & 2 ? fg : bg) << 8);
stamp[i] |= ((i & 4 ? fg : bg) << 16);
stamp[i] |= ((i & 8 ? fg : bg) << 24);
}
}
}