src/hermes/HeadX86.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 21 Sep 2003 18:32:04 +0000
changeset 720 f90d80d68071
parent 366 c94b390687d2
child 1197 bb5ace455586
permissions -rw-r--r--
N Sep 17 8791 Sam Lantinga Re: tks source released
Date: Sun, 07 Sep 2003 02:51:58 +0200
From: Stephane Marchesin
Subject: [SDL] Two little patches

Compiling SDL with a recent gcc (gcc 3.3.1, 3.3 doesn't have this
behaviour) gives some nasty warnings :

SDL_blit_A.c: In function `BlitRGBtoRGBSurfaceAlpha128MMX':
SDL_blit_A.c:223: warning: integer constant is too large for "long" type
SDL_blit_A.c:225: warning: integer constant is too large for "long" type
SDL_blit_A.c:227: warning: integer constant is too large for "long" type
[...]

The first attached patch (longlongfix.patch) tells gcc to really treat
those constants as unsigned long long and not long.

The second patch (nasinclude.patch) fixes an include problem I had while
compiling nas audio : when the <audio/audiolib.h> file lies in
/usr/X11R6/include, a -I/usr/X11R6/include option is needed or the file
isn't found.
     1 /*
     2    Header definitions for the x86 routines for the HERMES library
     3    Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
     4    This source code is licensed under the GNU LGPL
     5   
     6    Please refer to the file COPYING.LIB contained in the distribution for
     7    licensing conditions
     8 */
     9 
    10 #ifndef __HERMES_HEAD_X86__
    11 #define __HERMES_HEAD_X86__
    12 
    13 
    14 #ifdef X86_ASSEMBLER
    15 
    16 /* If you can't stand IFDEFS, then close your eyes now, please :) */
    17 
    18 /* Ok, we start with normal function definitions */
    19 #ifdef __cplusplus
    20 extern "C" {
    21 #endif
    22 
    23 
    24 void STACKCALL ConvertX86(HermesConverterInterface *);
    25 void STACKCALL ClearX86_32(HermesClearInterface *);
    26 void STACKCALL ClearX86_24(HermesClearInterface *);
    27 void STACKCALL ClearX86_16(HermesClearInterface *);
    28 void STACKCALL ClearX86_8(HermesClearInterface *);
    29 
    30 int STACKCALL Hermes_X86_CPU();
    31 
    32 void ConvertX86p32_32BGR888();
    33 void ConvertX86p32_32RGBA888();
    34 void ConvertX86p32_32BGRA888();
    35 void ConvertX86p32_24RGB888();
    36 void ConvertX86p32_24BGR888();
    37 void ConvertX86p32_16RGB565();
    38 void ConvertX86p32_16BGR565();
    39 void ConvertX86p32_16RGB555();
    40 void ConvertX86p32_16BGR555();
    41 void ConvertX86p32_8RGB332();
    42 
    43 void ConvertX86p16_32RGB888();
    44 void ConvertX86p16_32BGR888();
    45 void ConvertX86p16_32RGBA888();
    46 void ConvertX86p16_32BGRA888();
    47 void ConvertX86p16_24RGB888();
    48 void ConvertX86p16_24BGR888();
    49 void ConvertX86p16_16BGR565();
    50 void ConvertX86p16_16RGB555();
    51 void ConvertX86p16_16BGR555();
    52 void ConvertX86p16_8RGB332();
    53 
    54 void CopyX86p_4byte();
    55 void CopyX86p_3byte();
    56 void CopyX86p_2byte();
    57 void CopyX86p_1byte();
    58 
    59 void ConvertX86pI8_32();
    60 void ConvertX86pI8_24();
    61 void ConvertX86pI8_16();
    62 
    63 extern int ConvertX86p16_32RGB888_LUT_X86[512];
    64 extern int ConvertX86p16_32BGR888_LUT_X86[512];
    65 extern int ConvertX86p16_32RGBA888_LUT_X86[512];
    66 extern int ConvertX86p16_32BGRA888_LUT_X86[512];
    67   
    68 #ifdef __cplusplus
    69 }
    70 #endif
    71 
    72 
    73 
    74 
    75 /* Now fix up the ELF underscore problem */
    76 
    77 #if defined(__ELF__) && defined(__GNUC__)
    78   #ifdef __cplusplus
    79   extern "C" {
    80   #endif
    81 
    82   int Hermes_X86_CPU() __attribute__ ((alias ("_Hermes_X86_CPU")));
    83 
    84   void ConvertX86(HermesConverterInterface *) __attribute__ ((alias ("_ConvertX86")));
    85 
    86 #if 0
    87   void ClearX86_32(HermesClearInterface *) __attribute__ ((alias ("_ClearX86_32")));
    88   void ClearX86_24(HermesClearInterface *)  __attribute__ ((alias ("_ClearX86_24")));
    89   void ClearX86_16(HermesClearInterface *)  __attribute__ ((alias ("_ClearX86_16")));
    90   void ClearX86_8(HermesClearInterface *)  __attribute__ ((alias ("_ClearX86_8")));
    91 #endif
    92 
    93   void ConvertX86p32_32BGR888() __attribute__ ((alias ("_ConvertX86p32_32BGR888")));
    94   void ConvertX86p32_32RGBA888() __attribute__ ((alias ("_ConvertX86p32_32RGBA888")));
    95   void ConvertX86p32_32BGRA888() __attribute__ ((alias ("_ConvertX86p32_32BGRA888")));
    96   void ConvertX86p32_24RGB888() __attribute__ ((alias ("_ConvertX86p32_24RGB888")));
    97   void ConvertX86p32_24BGR888() __attribute__ ((alias ("_ConvertX86p32_24BGR888")));
    98   void ConvertX86p32_16RGB565() __attribute__ ((alias ("_ConvertX86p32_16RGB565")));
    99   void ConvertX86p32_16BGR565() __attribute__ ((alias ("_ConvertX86p32_16BGR565")));
   100   void ConvertX86p32_16RGB555() __attribute__ ((alias ("_ConvertX86p32_16RGB555")));
   101   void ConvertX86p32_16BGR555() __attribute__ ((alias ("_ConvertX86p32_16BGR555")));
   102   void ConvertX86p32_8RGB332() __attribute__ ((alias ("_ConvertX86p32_8RGB332")));
   103 
   104 #if 0
   105   void ConvertX86p16_32RGB888() __attribute__ ((alias ("_ConvertX86p16_32RGB888")));
   106   void ConvertX86p16_32BGR888() __attribute__ ((alias ("_ConvertX86p16_32BGR888")));
   107   void ConvertX86p16_32RGBA888() __attribute__ ((alias ("_ConvertX86p16_32RGBA888")));
   108   void ConvertX86p16_32BGRA888() __attribute__ ((alias ("_ConvertX86p16_32BGRA888")));
   109   void ConvertX86p16_24RGB888() __attribute__ ((alias ("_ConvertX86p16_24RGB888")));
   110   void ConvertX86p16_24BGR888() __attribute__ ((alias ("_ConvertX86p16_24BGR888")));
   111 #endif
   112   void ConvertX86p16_16BGR565() __attribute__ ((alias ("_ConvertX86p16_16BGR565")));
   113   void ConvertX86p16_16RGB555() __attribute__ ((alias ("_ConvertX86p16_16RGB555")));
   114   void ConvertX86p16_16BGR555() __attribute__ ((alias ("_ConvertX86p16_16BGR555")));
   115   void ConvertX86p16_8RGB332() __attribute__ ((alias ("_ConvertX86p16_8RGB332")));
   116 
   117 #if 0
   118   void CopyX86p_4byte() __attribute__ ((alias ("_CopyX86p_4byte")));
   119   void CopyX86p_3byte() __attribute__ ((alias ("_CopyX86p_3byte")));
   120   void CopyX86p_2byte() __attribute__ ((alias ("_CopyX86p_2byte")));
   121   void CopyX86p_1byte() __attribute__ ((alias ("_CopyX86p_1byte")));
   122 
   123   void ConvertX86pI8_32() __attribute__ ((alias ("_ConvertX86pI8_32")));
   124   void ConvertX86pI8_24() __attribute__ ((alias ("_ConvertX86pI8_24")));
   125   void ConvertX86pI8_16() __attribute__ ((alias ("_ConvertX86pI8_16")));
   126 
   127   extern int ConvertX86p16_32RGB888_LUT_X86[512] __attribute__ ((alias ("_ConvertX86p16_32RGB888_LUT_X86")));
   128   extern int ConvertX86p16_32BGR888_LUT_X86[512] __attribute__ ((alias ("_ConvertX86p16_32BGR888_LUT_X86")));
   129   extern int ConvertX86p16_32RGBA888_LUT_X86[512] __attribute__ ((alias ("_ConvertX86p16_32RGBA888_LUT_X86")));
   130   extern int ConvertX86p16_32BGRA888_LUT_X86[512] __attribute__ ((alias ("_ConvertX86p16_32BGRA888_LUT_X86")));
   131 #endif
   132 
   133   #ifdef __cplusplus
   134   }
   135   #endif
   136 
   137 #endif /* ELF & GNU */
   138 
   139 
   140 
   141 /* Make it run with WATCOM C */
   142 #ifdef __WATCOMC__
   143 #pragma warning 601 9
   144 
   145 #pragma aux Hermes_X86_CPU "_*"
   146 
   147 #pragma aux ConvertX86 "_*" modify [EAX EBX ECX EDX ESI EDI]
   148 #pragma aux ClearX86_32 "_*" modify [EAX EBX ECX EDX ESI EDI]
   149 #pragma aux ClearX86_24 "_*" modify [EAX EBX ECX EDX ESI EDI]
   150 #pragma aux ClearX86_16 "_*" modify [EAX EBX ECX EDX ESI EDI]
   151 #pragma aux ClearX86_8 "_*" modify [EAX EBX ECX EDX ESI EDI]
   152 
   153 #pragma aux ConvertX86p32_32BGR888 "_*"
   154 #pragma aux ConvertX86p32_32RGBA888 "_*"
   155 #pragma aux ConvertX86p32_32BGRA888 "_*"
   156 #pragma aux ConvertX86p32_24RGB888 "_*"
   157 #pragma aux ConvertX86p32_24BGR888 "_*"
   158 #pragma aux ConvertX86p32_16RGB565 "_*"
   159 #pragma aux ConvertX86p32_16BGR565 "_*"
   160 #pragma aux ConvertX86p32_16RGB555 "_*"
   161 #pragma aux ConvertX86p32_16BGR555 "_*"
   162 #pragma aux ConvertX86p32_8RGB332 "_*"
   163 
   164 #pragma aux ConvertX86p16_32RGB888 "_*"
   165 #pragma aux ConvertX86p16_32BGR888 "_*"
   166 #pragma aux ConvertX86p16_32RGBA888 "_*"
   167 #pragma aux ConvertX86p16_32BGRA888 "_*"
   168 #pragma aux ConvertX86p16_24RGB888 "_*"
   169 #pragma aux ConvertX86p16_24BGR888 "_*"
   170 #pragma aux ConvertX86p16_16BGR565 "_*"
   171 #pragma aux ConvertX86p16_16RGB555 "_*"
   172 #pragma aux ConvertX86p16_16BGR555 "_*"
   173 #pragma aux ConvertX86p16_8RGB332 "_*"
   174 
   175 #pragma aux CopyX86p_4byte "_*"
   176 #pragma aux CopyX86p_3byte "_*"
   177 #pragma aux CopyX86p_2byte "_*"
   178 #pragma aux CopyX86p_1byte "_*"
   179 
   180 #pragma aux ConvertX86pI8_32 "_*"
   181 #pragma aux ConvertX86pI8_24 "_*"
   182 #pragma aux ConvertX86pI8_16 "_*"
   183 
   184 #pragma aux ConvertX86p16_32RGB888_LUT_X86 "_*"
   185 #pragma aux ConvertX86p16_32BGR888_LUT_X86 "_*"
   186 #pragma aux ConvertX86p16_32RGBA888_LUT_X86 "_*"
   187 #pragma aux ConvertX86p16_32BGRA888_LUT_X86 "_*"
   188 
   189 #endif /* __WATCOMC__ */
   190 
   191 
   192 #endif /* X86_ASSEMBLER */
   193 
   194 
   195 #endif