Parent Directory
|
Revision Log
Revision 3 -
(view)
(download)
Original Path: trunk/xvidcore/src/portab.h
1 : | Isibaar | 3 | #ifndef _PORTAB_H_ |
2 : | #define _PORTAB_H_ | ||
3 : | |||
4 : | #if defined(WIN32) | ||
5 : | |||
6 : | #include <windows.h> | ||
7 : | |||
8 : | #define DEBUG(S) OutputDebugString((S)); | ||
9 : | #define DEBUG1(S,I) { char tmp[100]; wsprintf(tmp, "%s %i\n", (S), (I)); OutputDebugString(tmp); } | ||
10 : | #define DEBUG2(X,A,B) { char tmp[100]; wsprintf(tmp, "%s %i %i\n", (X), (A), (B)); OutputDebugString(tmp); } | ||
11 : | #define DEBUG3(X,A,B,C){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i",(X),(A), (B), (C)); OutputDebugString(tmp); } | ||
12 : | #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); } | ||
13 : | |||
14 : | |||
15 : | |||
16 : | #define int8_t char | ||
17 : | #define uint8_t unsigned char | ||
18 : | #define int16_t short | ||
19 : | #define uint16_t unsigned short | ||
20 : | #define int32_t int | ||
21 : | #define uint32_t unsigned int | ||
22 : | #define int64_t __int64 | ||
23 : | #define uint64_t unsigned __int64 | ||
24 : | |||
25 : | #define EMMS() __asm {emms} | ||
26 : | |||
27 : | // needed for bitstream.h | ||
28 : | #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax | ||
29 : | |||
30 : | // needed for timer.c | ||
31 : | static __inline int64_t read_counter() { | ||
32 : | int64_t ts; | ||
33 : | uint32_t ts1, ts2; | ||
34 : | |||
35 : | __asm { | ||
36 : | rdtsc | ||
37 : | mov ts1, eax | ||
38 : | mov ts2, edx | ||
39 : | } | ||
40 : | |||
41 : | ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); | ||
42 : | |||
43 : | return ts; | ||
44 : | } | ||
45 : | |||
46 : | #elif defined(LINUX) || defined(DJGPP) | ||
47 : | |||
48 : | #include <stdio.h> | ||
49 : | #define DEBUG_WHERE stdout | ||
50 : | #define DEBUG(S) fprintf(DEBUG_WHERE, "%s\n", (S)); | ||
51 : | #define DEBUG1(S,I) fprintf(DEBUG_WHERE, "%s %i\n", (S), (I)) | ||
52 : | #define DEBUG2(S,A,B) fprintf(DEBUG_WHERE, "%s%i=%i\n", (S), (A), (B)) | ||
53 : | #define DEBUG3(S,A,B,C) fprintf(DEBUG_WHERE, "%s %i %x %x\n", (S), (A), (B), (C)) | ||
54 : | #define DEBUG8(S,A,B,C,D,E,F,G,H) | ||
55 : | |||
56 : | #if defined(LINUX) | ||
57 : | |||
58 : | #include <stdint.h> | ||
59 : | |||
60 : | #else | ||
61 : | |||
62 : | #define int8_t char | ||
63 : | #define uint8_t unsigned char | ||
64 : | #define int16_t short | ||
65 : | #define uint16_t unsigned short | ||
66 : | #define int32_t int | ||
67 : | #define uint32_t unsigned int | ||
68 : | #define int64_t long long | ||
69 : | #define uint64_t unsigned long long | ||
70 : | |||
71 : | #endif | ||
72 : | |||
73 : | #define EMMS() __asm__("emms\n\t") | ||
74 : | |||
75 : | // needed for bitstream.h | ||
76 : | #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) | ||
77 : | |||
78 : | // needed for timer.c | ||
79 : | static __inline int64_t read_counter() { | ||
80 : | int64_t ts; | ||
81 : | uint32_t ts1, ts2; | ||
82 : | |||
83 : | __asm__ __volatile__("rdtsc\n\t":"=a"(ts1), "=d"(ts2)); | ||
84 : | |||
85 : | ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); | ||
86 : | |||
87 : | return ts; | ||
88 : | } | ||
89 : | |||
90 : | #else // OTHER OS | ||
91 : | |||
92 : | #define DEBUG(S) | ||
93 : | #define DEBUG1(S,I) | ||
94 : | #define DEBUG2(X,A,B) | ||
95 : | #define DEBUG3(X,A,B,C) | ||
96 : | #define DEBUG8(X,A,B,C,D,E,F,G,H) | ||
97 : | |||
98 : | #include <inttypes.h> | ||
99 : | |||
100 : | #define EMMS() | ||
101 : | |||
102 : | // needed for bitstream.h | ||
103 : | #define BSWAP(a) \ | ||
104 : | ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) | ||
105 : | |||
106 : | // rdtsc command most likely not supported, | ||
107 : | // so just dummy code here | ||
108 : | static __inline int64_t read_counter() { | ||
109 : | return 0; | ||
110 : | } | ||
111 : | |||
112 : | #endif | ||
113 : | |||
114 : | #endif // _PORTAB_H_ | ||
115 : |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |