[cvs] / xvidcore / src / portab.h Repository:
ViewVC logotype

Diff of /xvidcore/src/portab.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26.2.8, Sat Feb 15 08:39:17 2003 UTC revision 1.27, Wed Sep 4 22:01:59 2002 UTC
# Line 3  Line 3 
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - Portable macros, types and inlined assembly -   *  - Portable macros, types and inlined assembly -
5   *   *
6   *  Copyright(C) 2002 Michael Militzer <isibaar@xvid.org>   *  Copyright(C) 2002 Michael Militzer
  *               2002 Peter Ross <pross@xvid.org>  
  *               2002 Edouard Gomez <ed.gomez@wanadoo.fr>  
7   *   *
8   *  This file is part of XviD, a free MPEG-4 video encoder/decoder   *  This program is an implementation of a part of one or more MPEG-4
9     *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
10     *  to use this software module in hardware or software products are
11     *  advised that its use may infringe existing patents or copyrights, and
12     *  any such use would be at such party's own risk.  The original
13     *  developer of this software module and his/her company, and subsequent
14     *  editors and their companies, will have no liability for use of this
15     *  software or modifications or derivatives thereof.
16   *   *
17   *  XviD is free software; you can redistribute it and/or modify it   *  This program is free software ; you can redistribute it and/or modify
18   *  under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
19   *  the Free Software Foundation; either version 2 of the License, or   *  the Free Software Foundation; either version 2 of the License, or
20   *  (at your option) any later version.   *  (at your option) any later version.
21   *   *
# Line 23  Line 28 
28   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
29   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
30   *   *
  *  Under section 8 of the GNU General Public License, the copyright  
  *  holders of XVID explicitly forbid distribution in the following  
  *  countries:  
  *  
  *    - Japan  
  *    - United States of America  
  *  
  *  Linking XviD statically or dynamically with other modules is making a  
  *  combined work based on XviD.  Thus, the terms and conditions of the  
  *  GNU General Public License cover the whole combination.  
  *  
  *  As a special exception, the copyright holders of XviD give you  
  *  permission to link XviD with independent modules that communicate with  
  *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the  
  *  license terms of these independent modules, and to copy and distribute  
  *  the resulting combined work under terms of your choice, provided that  
  *  every copy of the combined work is accompanied by a complete copy of  
  *  the source code of XviD (the version of XviD used to produce the  
  *  combined work), being distributed under the terms of the GNU General  
  *  Public License plus this exception.  An independent module is a module  
  *  which is not derived from or based on XviD.  
  *  
  *  Note that people who make modified versions of XviD are not obligated  
  *  to grant this special exception for their modified versions; it is  
  *  their choice whether to do so.  The GNU General Public License gives  
  *  permission to release a modified version without this exception; this  
  *  exception also makes it possible to release a modified version which  
  *  carries forward this exception.  
  *  
31   * $Id$   * $Id$
32   *   *
33   ****************************************************************************/   ****************************************************************************/
# Line 59  Line 35 
35  #ifndef _PORTAB_H_  #ifndef _PORTAB_H_
36  #define _PORTAB_H_  #define _PORTAB_H_
37    
 /*****************************************************************************  
  *  Common things  
  ****************************************************************************/  
38    
39  /* Debug level masks */  // debug level masks
40  #define DPRINTF_ERROR           0x00000001  #define DPRINTF_ERROR           0x00000001
41  #define DPRINTF_STARTCODE       0x00000002  #define DPRINTF_STARTCODE       0x00000002
42  #define DPRINTF_HEADER          0x00000004  #define DPRINTF_HEADER          0x00000004
# Line 71  Line 44 
44  #define DPRINTF_MB                      0x00000010  #define DPRINTF_MB                      0x00000010
45  #define DPRINTF_COEFF           0x00000020  #define DPRINTF_COEFF           0x00000020
46  #define DPRINTF_MV                      0x00000040  #define DPRINTF_MV                      0x00000040
 #define DPRINTF_RC                      0x00000080  
47  #define DPRINTF_DEBUG           0x80000000  #define DPRINTF_DEBUG           0x80000000
48    
49  /* debug level for this library */  // debug level
50  #ifdef _DEBUG  #define DPRINTF_LEVEL           0
51  #define DPRINTF_LEVEL           (DPRINTF_RC|0x0000007F)  
 #else  
 #define DPRINTF_LEVEL           DPRINTF_RC  
 #endif  
52    
 /* Buffer size for non C99 compliant compilers (msvc) */  
53  #define DPRINTF_BUF_SZ  1024  #define DPRINTF_BUF_SZ  1024
54    
 /*****************************************************************************  
  *  Types used in XviD sources  
  ****************************************************************************/  
55    
56  /*----------------------------------------------------------------------------  #if defined(WIN32)
  | Standard Unix include file (sorry, we put all unix into "linux" case)  
  *---------------------------------------------------------------------------*/  
57    
58  #if defined(LINUX) || defined(BEOS) || defined(FREEBSD)  #include <windows.h>
59    #include <stdio.h>
60    
61  /* All (u)int(size)_t types are defined here */  static __inline void
62  #    include <inttypes.h>  DPRINTF(int level, char *fmt,
63                    ...)
64    {
65            if ((DPRINTF_LEVEL & level))
66            {
67                    va_list args;
68                    char buf[DPRINTF_BUF_SZ];
69    
70  /*----------------------------------------------------------------------------                  va_start(args, fmt);
71   | msvc (lacks such a header file)                  vsprintf(buf, fmt, args);
72   *---------------------------------------------------------------------------*/                  OutputDebugString(buf);
73                    fprintf(stdout, "%s\n", buf);
74                    fflush(stdout);
75            }
76    }
77    
 #elif defined(_MSC_VER) || defined (__WATCOMC__)  
 #    define int8_t   char  
 #    define uint8_t  unsigned char  
 #    define int16_t  short  
 #    define uint16_t unsigned short  
 #    define int32_t  int  
 #    define uint32_t unsigned int  
 #    define int64_t  __int64  
 #    define uint64_t unsigned __int64  
78    
79  /*----------------------------------------------------------------------------  #define DEBUGCBR(A,B,C) { char tmp[100]; wsprintf(tmp, "CBR: frame: %i, quant: %i, deviation: %i\n", (A), (B), (C)); OutputDebugString(tmp); }
80   | Fallback when using gcc  
81   *---------------------------------------------------------------------------*/  #ifdef _DEBUG
82    #define DEBUG(S) OutputDebugString((S));
83    #define DEBUG1(S,I) { char tmp[100]; wsprintf(tmp, "%s %i\n", (S), (I)); OutputDebugString(tmp); }
84    #define DEBUG2(X,A,B) { char tmp[100]; wsprintf(tmp, "%s %i %i\n", (X), (A), (B)); OutputDebugString(tmp); }
85    #define DEBUG3(X,A,B,C){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i",(X),(A), (B), (C)); OutputDebugString(tmp); }
86    #define DEBUG4(X,A,B,C,D){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i %i",(X),(A), (B), (C), (D)); OutputDebugString(tmp); }
87    #define DEBUG8(X,A,B,C,D,E,F,G,H){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i %i %i %i %i %i",(X),(A),(B),(C),(D),(E),(F),(G),(H)); OutputDebugString(tmp); }
88    #else
89    #define DEBUG(S)
90    #define DEBUG1(S,I)
91    #define DEBUG2(X,A,B)
92    #define DEBUG3(X,A,B,C)
93    #define DEBUG4(X,A,B,C,D)
94    #define DEBUG8(X,A,B,C,D,E,F,G,H)
95    #endif
96    
 #elif defined(__GNUC__) || defined(__ICC)  
97    
98  #    define int8_t   char  #    define int8_t   char
99  #    define uint8_t  unsigned char  #    define uint8_t  unsigned char
# Line 123  Line 101 
101  #    define uint16_t unsigned short  #    define uint16_t unsigned short
102  #    define int32_t  int  #    define int32_t  int
103  #    define uint32_t unsigned int  #    define uint32_t unsigned int
104  #    define int64_t  long long  #define int64_t __int64
105  #    define uint64_t unsigned long long  #define uint64_t unsigned __int64
   
 /*----------------------------------------------------------------------------  
  | Ok, we don't know how to define these types... error  
  *---------------------------------------------------------------------------*/  
   
 #else  
 #    error Do not know how to define (u)int(size)_t types  
 #endif  
   
 /*****************************************************************************  
  *  Some things that are only architecture dependant  
  ****************************************************************************/  
   
 #if defined(ARCH_X86) || defined(ARCH_PPC) || defined(ARCH_MIPS)  || defined(ARCH_SPARC)  
 #    define CACHE_LINE  16  
 #    define ptr_t uint32_t  
 #elif defined(ARCH_IA64)  
 #    define CACHE_LINE  32  
 #    define ptr_t uint64_t  
 #else  
 /* todo: fix cache_line 0 operation */  
 #    define CACHE_LINE  16  
106  #    define ptr_t uint32_t  #    define ptr_t uint32_t
 #endif  
   
 /*****************************************************************************  
  *  Things that must be sorted by compiler and then by architecture  
  ****************************************************************************/  
   
 /*****************************************************************************  
  *  MSVC compiler specific macros, functions  
  ****************************************************************************/  
107    
108  #if defined(_MSC_VER)  #define EMMS() __asm {emms}
   
 /*----------------------------------------------------------------------------  
  | Common msvc stuff  
  *---------------------------------------------------------------------------*/  
   
 #include <windows.h>  
 #include <stdio.h>  
109    
110          /* non-ansi function mapping */  #define CACHE_LINE  16
 #       define snprintf _snprintf  
 #       define vsnprintf _vsnprintf  
   
     /*  
      * This function must be declared/defined all the time because MSVC does  
      * not support C99 variable arguments macros  
      */  
     static __inline void DPRINTF(int level, char *fmt, ...)  
     {  
         if (DPRINTF_LEVEL & level) {  
             va_list args;  
             char buf[DPRINTF_BUF_SZ];  
             va_start(args, fmt);  
             vsprintf(buf, fmt, args);  
             OutputDebugString(buf);  
             fprintf(stderr, "%s\n", buf);  
          }  
      }  
111    
112  #    if _MSC_VER <= 1200  #    if _MSC_VER <= 1200
113  #        define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \  #        define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \
# Line 196  Line 118 
118                  __declspec(align(alignment)) type name[(sizex)*(sizey)]                  __declspec(align(alignment)) type name[(sizex)*(sizey)]
119  #    endif  #    endif
120    
121    // needed for bitstream.h
 /*----------------------------------------------------------------------------  
  | msvc x86 specific macros/functions  
  *---------------------------------------------------------------------------*/  
 #    if defined(ARCH_X86)  
122  #        define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax  #        define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
123    
124               static __inline int64_t read_counter(void)  // needed for timer.c
125    static __inline int64_t
126    read_counter()
127               {               {
128                   int64_t ts;                   int64_t ts;
129                   uint32_t ts1, ts2;                   uint32_t ts1, ts2;
130    
131                   __asm {                   __asm {
132                       rdtsc                       rdtsc
133                       mov ts1, eax                       mov ts1, eax
134                       mov ts2, edx                       mov ts2, edx
135                   }                   }
136    
137                   ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);                   ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);
138    
139                   return ts;                   return ts;
140               }               }
141    
142  /*----------------------------------------------------------------------------  #elif defined(LINUX) || defined(DJGPP) || defined(FREEBSD) || defined(BEOS)
  | msvc unknown architecture  
  *---------------------------------------------------------------------------*/  
 #    else  
 /* ANSI C version of BSWAP */  
 #define BSWAP(x) \  
  x = ((((x) & 0xff000000) >> 24) | \  
      (((x) & 0x00ff0000) >>  8) | \  
      (((x) & 0x0000ff00) <<  8) | \  
      (((x) & 0x000000ff) << 24))  
   
 #    endif  
   
   
143    
144    #include <stdio.h>
145    #include <stdarg.h>
146    
147  /*****************************************************************************  static __inline void
148   *  GNU CC compiler stuff  DPRINTF(int level, char *fmt,
149   ****************************************************************************/                  ...)
150    {
151            if ((DPRINTF_LEVEL & level)) {
152                    va_list args;
153                    char buf[DPRINTF_BUF_SZ];
154    
155  #elif defined(__GNUC__) || defined(__ICC) /* Compiler test */                  va_start(args, fmt);
156                    vsprintf(buf, fmt, args);
157                    fprintf(stdout, "%s\n", buf);
158            }
159    }
160    
 /*----------------------------------------------------------------------------  
  | Common gcc stuff  
  *---------------------------------------------------------------------------*/  
   
 /*  
  * As gcc is (mostly) C99 compliant, we define DPRINTF only if it's realy needed  
  * and it's a macro calling fprintf directly  
  */  
161  #    ifdef _DEBUG  #    ifdef _DEBUG
162    
         /* Needed for all debuf fprintf calls */  
163  #       include <stdio.h>  #       include <stdio.h>
164    #define DEBUG_WHERE               stdout
165    #define DEBUG(S)                  fprintf(DEBUG_WHERE, "%s\n", (S));
166    #define DEBUG1(S,I)               fprintf(DEBUG_WHERE, "%s %i\n", (S), (I))
167    #define DEBUG2(S,A,B)             fprintf(DEBUG_WHERE, "%s%i=%i\n", (S), (A), (B))
168    #define DEBUG3(S,A,B,C)           fprintf(DEBUG_WHERE, "%s %i %x %x\n", (S), (A), (B), (C))
169    #define DEBUG8(S,A,B,C,D,E,F,G,H)
170    #define DEBUGCBR(A,B,C)           fprintf(DEBUG_WHERE, "CBR: frame: %i, quant: %i, deviation: %i\n", (A), (B), (C))
171    #else
172    #define DEBUG(S)
173    #define DEBUG1(S,I)
174    #define DEBUG2(X,A,B)
175    #define DEBUG3(X,A,B,C)
176    #define DEBUG8(X,A,B,C,D,E,F,G,H)
177    #define DEBUGCBR(A,B,C)
178    #endif
179    
180  #       define DPRINTF(level, format, ...) \  #if defined(LINUX) || defined(BEOS)
             do {\  
                 if(DPRINTF_LEVEL & level)\  
                     fprintf(stderr, format"\n", ##__VA_ARGS__);\  
             }while(0);  
   
 #    else /* _DEBUG */  
 #        define DPRINTF(level, format, ...)  
 #    endif /* _DEBUG */  
   
181    
182    #if defined(BEOS)
183    #include <inttypes.h>
184    #else
185    #include <stdint.h>
186    #endif
187    
188  #    define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \  #    define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \
189              type name##_storage[(sizex)*(sizey)+(alignment)-1]; \              type name##_storage[(sizex)*(sizey)+(alignment)-1]; \
190              type * name = (type *) (((ptr_t) name##_storage+(alignment - 1)) & ~((ptr_t)(alignment)-1))              type * name = (type *) (((ptr_t) name##_storage+(alignment - 1)) & ~((ptr_t)(alignment)-1))
191    
192  /*----------------------------------------------------------------------------  #else
  | gcc x86 specific macros/functions  
  *---------------------------------------------------------------------------*/  
 #    if defined(ARCH_X86)  
 #        define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) );  
193    
194           static __inline int64_t read_counter(void)  #define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \
195           {          __attribute__ ((__aligned__(CACHE_LINE))) type name[(sizex)*(sizey)]
196               int64_t ts;  
197               uint32_t ts1, ts2;  #define int8_t   char
198               __asm__ __volatile__("rdtsc\n\t":"=a"(ts1), "=d"(ts2));  #define uint8_t  unsigned char
199               ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);  #define int16_t  short
200               return ts;  #define uint16_t unsigned short
201           }  #define int32_t  int
202    #define uint32_t unsigned int
203    #define int64_t  long long
204    #define uint64_t unsigned long long
205    
206  /*----------------------------------------------------------------------------  #endif
207   | gcc PPC and PPC Altivec specific macros/functions  
208   *---------------------------------------------------------------------------*/  
209  #    elif defined(ARCH_PPC)  // needed for bitstream.h
210  #        define BSWAP(a) __asm__ __volatile__ \  #ifdef ARCH_PPC
211                  ( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a));  #define BSWAP(a) __asm__ __volatile__ ( "lwbrx %0,0,%1; eieio" : "=r" (a) : \
212                    "r" (&(a)), "m" (a));
213    #define EMMS()
214    
215           static __inline unsigned long get_tbl(void)  static __inline unsigned long
216    get_tbl(void)
217           {           {
218               unsigned long tbl;               unsigned long tbl;
219               asm volatile ("mftb %0":"=r" (tbl));               asm volatile ("mftb %0":"=r" (tbl));
220    
221               return tbl;               return tbl;
222           }           }
223    static __inline unsigned long
224           static __inline unsigned long get_tbu(void)  get_tbu(void)
225           {           {
226               unsigned long tbl;               unsigned long tbl;
227               asm volatile ("mftbu %0":"=r" (tbl));               asm volatile ("mftbu %0":"=r" (tbl));
228    
229               return tbl;               return tbl;
230           }           }
231    static __inline int64_t
232           static __inline int64_t read_counter(void)  read_counter()
233           {           {
234               unsigned long tb, tu;               unsigned long tb, tu;
235    
236               do {               do {
237                   tu = get_tbu();                   tu = get_tbu();
238                   tb = get_tbl();                   tb = get_tbl();
# Line 313  Line 240 
240               return (((int64_t) tu) << 32) | (int64_t) tb;               return (((int64_t) tu) << 32) | (int64_t) tb;
241           }           }
242    
243  /*----------------------------------------------------------------------------  #define ptr_t   uint32_t
244   | gcc IA64 specific macros/functions  
245   *---------------------------------------------------------------------------*/  #define CACHE_LINE 16
246    
247  #    elif defined(ARCH_IA64)  #    elif defined(ARCH_IA64)
248  #        define BSWAP(a)  __asm__ __volatile__ \  
249                  ("mux1 %1 = %0, @rev" ";;" \  #define ptr_t   uint64_t
250    
251    #define CACHE_LINE 32
252    
253    #define EMMS()
254    
255    #ifdef __GNUC__
256    
257    // needed for bitstream.h
258    #define BSWAP(a)  __asm__ __volatile__ ("mux1 %1 = %0, @rev" \
259                            ";;" \
260                   "shr.u %1 = %1, 32" : "=r" (a) : "r" (a));                   "shr.u %1 = %1, 32" : "=r" (a) : "r" (a));
261    
262           static __inline int64_t read_counter(void) {  // rdtsc replacement for ia64
263    static __inline int64_t read_counter() {
264               unsigned long result;               unsigned long result;
265    
266    //      __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
267    //      while (__builtin_expect ((int) result == -1, 0))
268               __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");               __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
269               return result;               return result;
270    
271           }           }
272    
273  /*----------------------------------------------------------------------------  /* we are missing our ia64intrin.h file, but according to the
274   | gcc SPARC specific macros/functions     Intel's ecc manual, this should be the right way ...
275   *---------------------------------------------------------------------------*/     this
 #    elif defined(ARCH_SPARC)  
 #        define BSWAP(a) \  
                 ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \  
                        (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))  
276    
277           static __inline int64_t read_counter(void)  #elif defined(__INTEL_COMPILER)
278           {  
279               return 0;  #include <ia64intrin.h>
280    
281    static __inline int64_t read_counter() {
282      return __getReg(44);
283           }           }
284    
285  /*----------------------------------------------------------------------------  #define BSWAP(a) ((unsigned int) (_m64_mux1(a, 0xb) >> 32))
286   | gcc MIPS specific macros/functions  */
287   *---------------------------------------------------------------------------*/  
288  #    elif defined(ARCH_MIPS)  #else
289    
290    // needed for bitstream.h
291  #        define BSWAP(a) \  #        define BSWAP(a) \
292                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \           ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff))
                        (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))  
293    
294           static __inline int64_t read_counter(void)  // rdtsc command most likely not supported,
295    // so just dummy code here
296    static __inline int64_t
297    read_counter()
298           {           {
299               return 0;               return 0;
300           }           }
301    
302  /*----------------------------------------------------------------------------  #endif // gcc or ecc
303   | XviD + gcc unsupported Architecture  
  *---------------------------------------------------------------------------*/  
304  #    else  #    else
305  /* ANSI C version of BSWAP */  #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
306  #define BSWAP(x) \  #define EMMS() __asm__("emms\n\t")
  x = ((((x) & 0xff000000) >> 24) | \  
      (((x) & 0x00ff0000) >>  8) | \  
      (((x) & 0x0000ff00) <<  8) | \  
      (((x) & 0x000000ff) << 24))  
307    
 #    endif /* Architecture checking */  
308    
309  /*****************************************************************************  // needed for timer.c
310   *  OPEN WATCOM C/C++ compiler  static __inline int64_t
311   ****************************************************************************/  read_counter()
312  #elif defined(__WATCOMC__)  {
313            int64_t ts;
314            uint32_t ts1, ts2;
315    
316            __asm__ __volatile__("rdtsc\n\t":"=a"(ts1),
317                                                     "=d"(ts2));
318    
319            ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);
320    
321            return ts;
322    }
323    
324    #define ptr_t   uint32_t
325    
326    #define CACHE_LINE 16
327    
328    #endif
329    
330    #else                                                   // OTHER OS
331    
332    
333  #       include <stdio.h>  #       include <stdio.h>
334  #       include <stdarg.h>  #       include <stdarg.h>
335    
336      static __inline void DPRINTF(int level, char *fmt, ...)  static __inline void
337    DPRINTF(int level, char *fmt, ...)
338      {      {
339                  if (DPRINTF_LEVEL & level) {          if ((DPRINTF_LEVEL & level)) {
340    
341              va_list args;              va_list args;
342              char buf[DPRINTF_BUF_SZ];              char buf[DPRINTF_BUF_SZ];
343    
344              va_start(args, fmt);              va_start(args, fmt);
345              vsprintf(buf, fmt, args);              vsprintf(buf, fmt, args);
346                          fprintf(stderr, "%s\n", buf);                  fprintf(stdout, "%s\n", buf);
347                  }                  }
348          }          }
349    
 #       define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \  
                 type name##_storage[(sizex)*(sizey)+(alignment)-1]; \  
                 type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1))  
350    
351  /*----------------------------------------------------------------------------  #define DEBUG(S)
352   | watcom x86 specific macros/functions  #define DEBUG1(S,I)
353   *---------------------------------------------------------------------------*/  #define DEBUG2(X,A,B)
354  #       if defined(ARCH_X86)  #define DEBUG3(X,A,B,C)
355    #define DEBUG8(X,A,B,C,D,E,F,G,H)
356    #define DEBUGCBR(A,B,C)
357    
358  #               define BSWAP(a)  __asm mov eax,a __asm bswap eax __asm mov a, eax  #include <inttypes.h>
359    
360    #define EMMS()
361    
362                  static __inline int64_t read_counter(void)  // needed for bitstream.h
363    #define BSWAP(a) \
364             ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff))
365    
366    // rdtsc command most likely not supported,
367    // so just dummy code here
368    static __inline int64_t
369    read_counter()
370                  {                  {
371                          int64_t ts;          return 0;
                         uint32_t ts1, ts2;  
                         __asm {  
                                 rdtsc  
                                 mov ts1, eax  
                                 mov ts2, edx  
                         }  
                         ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);  
                         return ts;  
372                  }                  }
373    
374  /*----------------------------------------------------------------------------  #define ptr_t uint32_t
  | watcom unsupported architecture  
  *---------------------------------------------------------------------------*/  
 #       else  
   
 #               define BSWAP(x) \  
                         x = ((((x) & 0xff000000) >> 24) | \  
                                 (((x) & 0x00ff0000) >>  8) | \  
                                 (((x) & 0x0000ff00) <<  8) | \  
                                 (((x) & 0x000000ff) << 24))  
375    
376                  static int64_t read_counter() { return 0; }  #define CACHE_LINE  16
377    #define CACHE_ALIGN
378    
379  #       endif  #       endif
 /*****************************************************************************  
  *  Unknown compiler  
  ****************************************************************************/  
 #else /* Compiler test */  
   
 #    error Compiler not supported  
380    
381  #endif /* Compiler test */  #endif                                                  // _PORTAB_H_
   
   
 #endif  

Legend:
Removed from v.1.26.2.8  
changed lines
  Added in v.1.27

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4