Commit 9d051ffc authored by Daniel Egger's avatar Daniel Egger
Browse files

Fix SPARC alignment problem. Fix by Jon Hazen. Bug #21269.



 Fix SPARC alignment problem. Fix by Jon Hazen. Bug #21269.
parent e13fcd8b
Wed Sep 27 00:46:31 CEST 2000 Daniel Egger <egger@suse.de>
* app/paint_funcs.c: Implemented suggested solution for
SPARC alignment problem by Jon Hazen. Fixes bug #21269.
Wed Sep 27 00:46:31 CEST 2000 Daniel Egger <egger@suse.de>
 
* app/channel_ops.c:
......
......@@ -477,9 +477,9 @@ paint_funcs_setup ()
}
/* for (j = 0; j < 255; j++) */
/* { //rows */
/* { rows */
/* for (k = 0; k < 255; k++) */
/* { //column */
/* { column */
/* printf ("%d",add_lut[j][k]); */
/* printf(" "); */
/* } */
......@@ -539,44 +539,74 @@ color_pixels (unsigned char *dest,
Is this safe to assume? Lets find out.
This is 4-7X as fast as the simple version.
*/
register unsigned char c0, c1, c2;
register unsigned char c0, c1, c2, c3;
#if !defined(sparc) && !defined(__sparc__)
register guint32 *longd, longc;
register guint16 *shortd, shortc;
#endif /* !sparc && !__sparc__ */
switch (bytes)
{
case 1:
memset(dest, *color, w);
break;
case 2:
#if defined(sparc) || defined(__sparc__)
c0 = color[0];
c1 = color[1];
while (w--)
{
dest[0] = c0;
dest[1] = c1;
dest += 2;
}
#else
shortc = ((guint16 *)color)[0];
shortd = (guint16 *)dest;
while (w--)
{
*shortd = shortc;
shortd++;
}
{
*shortd = shortc;
shortd++;
}
#endif /* sparc || __sparc__ */
break;
case 3:
c0 = color[0];
c1 = color[1];
c2 = color[2];
while (w--)
{
dest[0] = c0;
dest[1] = c1;
dest[2] = c2;
dest += 3;
}
{
dest[0] = c0;
dest[1] = c1;
dest[2] = c2;
dest += 3;
}
break;
case 4:
#if defined(sparc) || defined(__sparc__)
c0 = color[0];
c1 = color[1];
c2 = color[2];
c3 = color[3];
while (w--)
{
dest[0] = c0;
dest[1] = c1;
dest[2] = c2;
dest[3] = c3;
dest += 4;
}
#else
longc = ((guint32 *)color)[0];
longd = (guint32 *)dest;
while (w--)
{
*longd = longc;
longd++;
}
{
*longd = longc;
longd++;
}
#endif /* sparc || __sparc__ */
break;
default:
while (w--)
......
......@@ -477,9 +477,9 @@ paint_funcs_setup ()
}
/* for (j = 0; j < 255; j++) */
/* { //rows */
/* { rows */
/* for (k = 0; k < 255; k++) */
/* { //column */
/* { column */
/* printf ("%d",add_lut[j][k]); */
/* printf(" "); */
/* } */
......@@ -539,44 +539,74 @@ color_pixels (unsigned char *dest,
Is this safe to assume? Lets find out.
This is 4-7X as fast as the simple version.
*/
register unsigned char c0, c1, c2;
register unsigned char c0, c1, c2, c3;
#if !defined(sparc) && !defined(__sparc__)
register guint32 *longd, longc;
register guint16 *shortd, shortc;
#endif /* !sparc && !__sparc__ */
switch (bytes)
{
case 1:
memset(dest, *color, w);
break;
case 2:
#if defined(sparc) || defined(__sparc__)
c0 = color[0];
c1 = color[1];
while (w--)
{
dest[0] = c0;
dest[1] = c1;
dest += 2;
}
#else
shortc = ((guint16 *)color)[0];
shortd = (guint16 *)dest;
while (w--)
{
*shortd = shortc;
shortd++;
}
{
*shortd = shortc;
shortd++;
}
#endif /* sparc || __sparc__ */
break;
case 3:
c0 = color[0];
c1 = color[1];
c2 = color[2];
while (w--)
{
dest[0] = c0;
dest[1] = c1;
dest[2] = c2;
dest += 3;
}
{
dest[0] = c0;
dest[1] = c1;
dest[2] = c2;
dest += 3;
}
break;
case 4:
#if defined(sparc) || defined(__sparc__)
c0 = color[0];
c1 = color[1];
c2 = color[2];
c3 = color[3];
while (w--)
{
dest[0] = c0;
dest[1] = c1;
dest[2] = c2;
dest[3] = c3;
dest += 4;
}
#else
longc = ((guint32 *)color)[0];
longd = (guint32 *)dest;
while (w--)
{
*longd = longc;
longd++;
}
{
*longd = longc;
longd++;
}
#endif /* sparc || __sparc__ */
break;
default:
while (w--)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment