summaryrefslogtreecommitdiff
path: root/sys/arch/sgi
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-12-23 21:32:31 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-12-23 21:32:31 +0000
commit27d881153ecb0f26069a1357e3e3478661f105aa (patch)
tree62d6900b7103cf1ed44872f3436c3b9a99e7a713 /sys/arch/sgi
parenta5a8362408204c7b9408582aee4f08ddc3981351 (diff)
- fix gamma ramp (now white is real white instead of light grey)
- speed-up the integer to single precision float routine by omitting the sign check and starting the log2 computation at 12 instead of 32, since all the values passed to this routine are actually on-screen coordinates.
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r--sys/arch/sgi/xbow/odyssey.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/arch/sgi/xbow/odyssey.c b/sys/arch/sgi/xbow/odyssey.c
index 5289b24fe7d..a786b0ce01a 100644
--- a/sys/arch/sgi/xbow/odyssey.c
+++ b/sys/arch/sgi/xbow/odyssey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: odyssey.c,v 1.9 2013/10/21 10:36:18 miod Exp $ */
+/* $OpenBSD: odyssey.c,v 1.10 2013/12/23 21:32:30 miod Exp $ */
/*
* Copyright (c) 2009, 2010 Joel Sing <jsing@openbsd.org>
*
@@ -70,7 +70,6 @@ struct odyssey_screen {
int height; /* Height in pixels. */
int depth; /* Colour depth in bits. */
int linebytes; /* Bytes per line. */
- int ro_curpos; /* Current position in rasops tile. */
};
struct odyssey_softc {
@@ -117,7 +116,7 @@ int odyssey_erasecols(void *, int, int, int, long);
int odyssey_copyrows(void *, int, int, int);
int odyssey_eraserows(void *, int, int, long);
-u_int32_t ieee754_sp(int32_t);
+u_int32_t ieee754_sp(uint);
/*
* Interfaces for wscons.
@@ -476,7 +475,7 @@ odyssey_setup(struct odyssey_softc *sc)
else if (i < 0x300)
val = ((i - 0x200) >> 1) + 0x80;
else
- val = ((i - 0x300) >> 1) + 0x100;
+ val = ((i - 0x300) >> 0) + 0x100;
val = (val << 20) | (val << 10) | val;
@@ -809,7 +808,8 @@ odyssey_putchar(void *cookie, int row, int col, u_int uc, long attr)
struct rasops_info *ri = cookie;
struct odyssey_softc *sc = ri->ri_hw;
struct wsdisplay_font *font = ri->ri_font;
- int x, y, w, h, bg, fg, ul, i, j, ci, l;
+ int bg, fg, ul, i, j, ci, l;
+ uint x, y, w, h;
u_int8_t *fontbitmap;
u_int chunk;
@@ -1049,31 +1049,26 @@ odyssey_eraserows(void *cookie, int row, int num, long attr)
}
u_int32_t
-ieee754_sp(int32_t v)
+ieee754_sp(uint v)
{
- u_int8_t exp = 0, sign = 0;
- int i = 32;
+ u_int8_t exp = 0;
+ int i = 12; /* 0 <= v < 2048 */
/*
- * Convert an integer to IEEE754 single precision floating point:
+ * Convert a small integer to IEEE754 single precision floating point:
*
* Sign - 1 bit
* Exponent - 8 bits (with 2^(8-1)-1 = 127 bias)
* Fraction - 23 bits
*/
- if (v < 0) {
- sign = 1;
- v = -v;
- }
-
/* Determine shift for fraction. */
while (i && (v & (1 << --i)) == 0);
if (v != 0)
exp = 127 + i;
- return (sign << 31) | (exp << 23) | ((v << (23 - i)) & 0x7fffff);
+ return (exp << 23) | ((v << (23 - i)) & 0x7fffff);
}
/*