1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

Add patches to fix build with clang by replacing some inline assembly with

optimal code, and removing some unneded casts.

Submitted by:	dim
Approved by:	kwm, miwi (mentors, implicit)
This commit is contained in:
Niclas Zeising 2013-01-30 16:21:26 +00:00
parent adac2b8bea
commit 07d27c9c2d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=311232
4 changed files with 85 additions and 3 deletions

View File

@ -39,9 +39,6 @@ post-patch: .SILENT
${REINPLACE_CMD} -e '30d' ${WRKSRC}/src/vgabg.h
${REINPLACE_CMD} -e 's,^ (unsigned [[:alpha:]]*),,' \
${WRKSRC}/src/apm.c
# Allow to build on !i386
${REINPLACE_CMD} -e '29,36s,def __alpha__, defined(NO_ASSEMBLY),' \
${WRKSRC}/src/vgapix.c ${WRKSRC}/gl/driver.c
# 024_vesa_not_print_crap.patch from Debian
${REINPLACE_CMD} -e '/^printf/d' ${WRKSRC}/src/vesa.c
# Clean up after typo fixes in manpages

View File

@ -0,0 +1,29 @@
--- gl/driver.c.orig 1999-07-18 10:18:44.000000000 +0200
+++ gl/driver.c 2013-01-26 21:34:27.000000000 +0100
@@ -1,6 +1,7 @@
/* driver.c Framebuffer primitives */
+#include <sys/endian.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -33,17 +34,7 @@ static inline int RGB2BGR(int c)
/* However bswap is not supported by 386 */
if (MODEFLAGS & MODEFLAG_24BPP_REVERSED)
-#ifdef __alpha__
- c = ((c >> 0) & 0xff) << 16 |
- ((c >> 8) & 0xff) << 8 |
- ((c >> 16) & 0xff) << 0;
-#else
- asm("rorw $8, %0\n" /* 0RGB -> 0RBG */
- "rorl $16, %0\n" /* 0RBG -> BG0R */
- "rorw $8, %0\n" /* BG0R -> BGR0 */
- "shrl $8, %0\n" /* 0BGR -> 0BGR */
- : "=q"(c):"0"(c));
-#endif
+ c = bswap32(c) >> 8;
return c;
}

View File

@ -0,0 +1,23 @@
--- gl/line.c.orig 1999-12-05 08:32:54.000000000 +0100
+++ gl/line.c 2013-01-26 21:25:52.000000000 +0100
@@ -90,13 +90,13 @@ static inline int gl_regioncode (int x,
#else
-#define INC_IF_NEG(y, result) \
-{ \
- __asm__("btl $31,%1\n\t" \
- "adcl $0,%0" \
- : "=r" ((int) result) \
- : "rm" ((int) (y)), "0" ((int) result) \
- ); \
+#define INC_IF_NEG(y, result) \
+{ \
+ __asm__("btl $31,%1\n\t" \
+ "adcl $0,%0" \
+ : "=r" (result) \
+ : "rm" (y), "0" (result) \
+ ); \
}
static inline int gl_regioncode (int x, int y)

View File

@ -0,0 +1,33 @@
--- src/vgapix.c.orig 1999-07-27 18:36:19.000000000 +0200
+++ src/vgapix.c 2013-01-26 21:14:42.000000000 +0100
@@ -8,6 +8,7 @@
/* partially copyrighted (C) 1993 by Hartmut Schirmer */
/* HH: Added 4bpp support, and use bytesperpixel. */
+#include <sys/endian.h>
#include <stdio.h>
#include "vga.h"
#include "libvga.h"
@@ -22,21 +23,8 @@ static inline void read_write(unsigned l
static inline int RGB2BGR(int c)
{
-/* a bswap would do the same as the first 3 but in only ONE! cycle. */
-/* However bswap is not supported by 386 */
-
if (MODEFLAGS & RGB_MISORDERED)
-#ifdef __alpha__
- c = ((c >> 0) & 0xff) << 16 |
- ((c >> 8) & 0xff) << 8 |
- ((c >> 16) & 0xff) << 0;
-#else
- asm("rorw $8, %0\n" /* 0RGB -> 0RBG */
- "rorl $16, %0\n" /* 0RBG -> BG0R */
- "rorw $8, %0\n" /* BG0R -> BGR0 */
- "shrl $8, %0\n" /* 0BGR -> 0BGR */
- : "=q"(c):"0"(c));
-#endif
+ c = bswap32(c) >> 8;
return c;
}