-/* $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>
*
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 {
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.
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;
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;
}
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);
}
/*