Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/mupen64plus-video-glide64/src/TexConv.h
2 views
1
/*
2
* Glide64 - Glide video plugin for Nintendo 64 emulators.
3
* Copyright (c) 2002 Dave2001
4
* Copyright (c) 2008 Günther <[email protected]>
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public
17
* Licence along with this program; if not, write to the Free
18
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301, USA
20
*/
21
22
//****************************************************************
23
//
24
// Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)
25
// Project started on December 29th, 2001
26
//
27
// To modify Glide64:
28
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
29
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
30
//
31
// Official Glide64 development channel: #Glide64 on EFnet
32
//
33
// Original author: Dave2001 ([email protected])
34
// Other authors: Gonetz, Gugaman
35
//
36
//****************************************************************
37
38
void TexConv_ARGB1555_ARGB4444 (unsigned char * _src, unsigned char * _dst, int width, int height)
39
{
40
int _size = (width * height) << 1;
41
#if !defined(__GNUC__) && !defined(NO_ASM)
42
__asm {
43
mov esi,dword ptr [_src]
44
mov edi,dword ptr [_dst]
45
mov ecx,dword ptr [_size]
46
47
tc1_loop:
48
mov eax,dword ptr [esi]
49
add esi,4
50
51
// arrr rrgg gggb bbbb
52
// aaaa rrrr gggg bbbb
53
mov edx,eax
54
and eax,0x80008000
55
mov ebx,eax // ebx = 0xa000000000000000
56
shr eax,1
57
or ebx,eax // ebx = 0xaa00000000000000
58
shr eax,1
59
or ebx,eax // ebx = 0xaaa0000000000000
60
shr eax,1
61
or ebx,eax // ebx = 0xaaaa000000000000
62
63
mov eax,edx
64
and eax,0x78007800 // eax = 0x0rrrr00000000000
65
shr eax,3 // eax = 0x0000rrrr00000000
66
or ebx,eax // ebx = 0xaaaarrrr00000000
67
68
mov eax,edx
69
and eax,0x03c003c0 // eax = 0x000000gggg000000
70
shr eax,2 // eax = 0x00000000gggg0000
71
or ebx,eax // ebx = 0xaaaarrrrgggg0000
72
73
and edx,0x001e001e // edx = 0x00000000000bbbb0
74
shr edx,1 // edx = 0x000000000000bbbb
75
or ebx,edx // ebx = 0xaaaarrrrggggbbbb
76
77
mov dword ptr [edi],ebx
78
add edi,4
79
80
dec ecx
81
jnz tc1_loop
82
}
83
#elif !defined(NO_ASM)
84
//printf("TexConv_ARGB1555_ARGB4444\n");
85
asm volatile (
86
//"tc1_loop2: \n"
87
"0: \n"
88
"mov (%[_src]), %%eax \n"
89
"add $4, %[_src] \n"
90
91
// arrr rrgg gggb bbbb
92
// aaaa rrrr gggg bbbb
93
"mov %%eax, %%edx \n"
94
"and $0x80008000, %%eax \n"
95
"mov %%eax, %%ecx \n" // ecx = 0xa000000000000000
96
"shr $1, %%eax \n"
97
"or %%eax, %%ecx \n" // ecx = 0xaa00000000000000
98
"shr $1, %%eax \n"
99
"or %%eax, %%ecx \n" // ecx = 0xaaa0000000000000
100
"shr $1, %%eax \n"
101
"or %%eax, %%ecx \n" // ecx = 0xaaaa000000000000
102
103
"mov %%edx, %%eax \n"
104
"and $0x78007800, %%eax \n" // eax = 0x0rrrr00000000000
105
"shr $3, %%eax \n" // eax = 0x0000rrrr00000000
106
"or %%eax, %%ecx \n" // ecx = 0xaaaarrrr00000000
107
108
"mov %%edx, %%eax \n"
109
"and $0x03c003c0, %%eax \n" // eax = 0x000000gggg000000
110
"shr $2, %%eax \n" // eax = 0x00000000gggg0000
111
"or %%eax, %%ecx \n" // ecx = 0xaaaarrrrgggg0000
112
113
"and $0x001e001e, %%edx \n" // edx = 0x00000000000bbbb0
114
"shr $1, %%edx \n" // edx = 0x000000000000bbbb
115
"or %%edx, %%ecx \n" // ecx = 0xaaaarrrrggggbbbb
116
117
"mov %%ecx, (%[_dst]) \n"
118
"add $4, %[_dst] \n"
119
120
"decl %[_size] \n"
121
"jnz 0b \n"
122
: [_src]"+S"(_src), [_dst]"+D"(_dst), [_size]"+g"(_size)
123
:
124
: "memory", "cc", "eax", "edx", "ecx"
125
);
126
#endif
127
}
128
129
void TexConv_AI88_ARGB4444 (unsigned char * _src, unsigned char * _dst, int width, int height)
130
{
131
int _size = (width * height) << 1;
132
#if !defined(__GNUC__) && !defined(NO_ASM)
133
__asm {
134
mov esi,dword ptr [_src]
135
mov edi,dword ptr [_dst]
136
mov ecx,dword ptr [_size]
137
138
tc1_loop:
139
mov eax,dword ptr [esi]
140
add esi,4
141
142
// aaaa aaaa iiii iiii
143
// aaaa rrrr gggg bbbb
144
mov edx,eax
145
and eax,0xF000F000 // eax = 0xaaaa000000000000
146
mov ebx,eax // ebx = 0xaaaa000000000000
147
148
and edx,0x00F000F0 // edx = 0x00000000iiii0000
149
shl edx,4 // edx = 0x0000iiii00000000
150
or ebx,edx // ebx = 0xaaaaiiii00000000
151
shr edx,4 // edx = 0x00000000iiii0000
152
or ebx,edx // ebx = 0xaaaaiiiiiiii0000
153
shr edx,4 // edx = 0x000000000000iiii
154
or ebx,edx // ebx = 0xaaaaiiiiiiiiiiii
155
156
mov dword ptr [edi],ebx
157
add edi,4
158
159
dec ecx
160
jnz tc1_loop
161
}
162
#elif !defined(NO_ASM)
163
//printf("TexConv_AI88_ARGB4444\n");
164
asm volatile (
165
//"tc1_loop3: \n"
166
"0: \n"
167
"mov (%[_src]), %%eax \n"
168
"add $4, %[_src] \n"
169
170
// aaaa aaaa iiii iiii
171
// aaaa rrrr gggg bbbb
172
"mov %%eax, %%edx \n"
173
"and $0xF000F000, %%eax \n" // eax = 0xaaaa000000000000
174
"mov %%eax, %%ecx \n" // ecx = 0xaaaa000000000000
175
176
"and $0x00F000F0, %%edx \n" // edx = 0x00000000iiii0000
177
"shl $4, %%edx \n" // edx = 0x0000iiii00000000
178
"or %%edx, %%ecx \n" // ecx = 0xaaaaiiii00000000
179
"shr $4, %%edx \n" // edx = 0x00000000iiii0000
180
"or %%edx, %%ecx \n" // ecx = 0xaaaaiiiiiiii0000
181
"shr $4, %%edx \n" // edx = 0x000000000000iiii
182
"or %%edx, %%ecx \n" // ecx = 0xaaaaiiiiiiiiiiii
183
184
"mov %%ecx, (%[_dst]) \n"
185
"add $4, %[_dst] \n"
186
187
"decl %[_size] \n"
188
"jnz 0b \n"
189
: [_src]"+S"(_src), [_dst]"+D"(_dst), [_size]"+g"(_size)
190
:
191
: "memory", "cc", "eax", "edx", "ecx"
192
);
193
#endif
194
}
195
196
void TexConv_AI44_ARGB4444 (unsigned char * _src, unsigned char * _dst, int width, int height)
197
{
198
int _size = width * height;
199
#if !defined(__GNUC__) && !defined(NO_ASM)
200
__asm {
201
mov esi,dword ptr [_src]
202
mov edi,dword ptr [_dst]
203
mov ecx,dword ptr [_size]
204
205
tc1_loop:
206
mov eax,dword ptr [esi]
207
add esi,4
208
209
// aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
210
// aaaa1 rrrr1 gggg1 bbbb1 aaaa0 rrrr0 gggg0 bbbb0
211
// aaaa3 rrrr3 gggg3 bbbb3 aaaa2 rrrr2 gggg2 bbbb2
212
mov edx,eax // eax = aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
213
shl eax,16 // eax = aaaa1 iiii1 aaaa0 iiii0 0000 0000 0000 0000
214
and eax,0xFF000000 // eax = aaaa1 iiii1 0000 0000 0000 0000 0000 0000
215
mov ebx,eax // ebx = aaaa1 iiii1 0000 0000 0000 0000 0000 0000
216
and eax,0x0F000000 // eax = 0000 iiii1 0000 0000 0000 0000 0000 0000
217
shr eax,4 // eax = 0000 0000 iiii1 0000 0000 0000 0000 0000
218
or ebx,eax // ebx = aaaa1 iiii1 iiii1 0000 0000 0000 0000 0000
219
shr eax,4 // eax = 0000 0000 0000 iiii1 0000 0000 0000 0000
220
or ebx,eax // ebx = aaaa1 iiii1 iiii1 iiii1 0000 0000 0000 0000
221
222
mov eax,edx // eax = aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
223
shl eax,8 // eax = aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0 0000 0000
224
and eax,0x0000FF00 // eax = 0000 0000 0000 0000 aaaa0 iiii0 0000 0000
225
or ebx,eax // ebx = aaaa1 iiii1 iiii1 iiii1 aaaa0 iiii0 0000 0000
226
and eax,0x00000F00 // eax = 0000 0000 0000 0000 0000 iiii0 0000 0000
227
shr eax,4 // eax = 0000 0000 0000 0000 0000 0000 iiii0 0000
228
or ebx,eax // ebx = aaaa1 iiii1 iiii1 iiii1 aaaa0 iiii0 iiii0 0000
229
shr eax,4 // eax = 0000 0000 0000 0000 0000 0000 0000 iiii0
230
or ebx,eax // ebx = aaaa1 iiii1 iiii1 iiii1 aaaa0 iiii0 iiii0 iiii0
231
232
mov dword ptr [edi],ebx
233
add edi,4
234
235
mov eax,edx // eax = aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
236
and eax,0xFF000000 // eax = aaaa3 iiii3 0000 0000 0000 0000 0000 0000
237
mov ebx,eax // ebx = aaaa3 iiii3 0000 0000 0000 0000 0000 0000
238
and eax,0x0F000000 // eax = 0000 iiii3 0000 0000 0000 0000 0000 0000
239
shr eax,4 // eax = 0000 0000 iiii3 0000 0000 0000 0000 0000
240
or ebx,eax // ebx = aaaa3 iiii3 iiii3 0000 0000 0000 0000 0000
241
shr eax,4 // eax = 0000 0000 0000 iiii3 0000 0000 0000 0000
242
or ebx,eax // ebx = aaaa3 iiii3 iiii3 iiii3 0000 0000 0000 0000
243
244
// edx = aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
245
shr edx,8 // edx = 0000 0000 aaaa3 aaaa3 aaaa2 iiii2 aaaa1 iiii1
246
and edx,0x0000FF00 // edx = 0000 0000 0000 0000 aaaa2 iiii2 0000 0000
247
or ebx,edx // ebx = aaaa3 iiii3 iiii3 iiii3 aaaa2 iiii2 0000 0000
248
and edx,0x00000F00 // edx = 0000 0000 0000 0000 0000 iiii2 0000 0000
249
shr edx,4 // edx = 0000 0000 0000 0000 0000 0000 iiii2 0000
250
or ebx,edx // ebx = aaaa3 iiii3 iiii3 iiii3 aaaa2 iiii2 iiii2 0000
251
shr edx,4 // edx = 0000 0000 0000 0000 0000 0000 0000 iiii2
252
or ebx,edx // ebx = aaaa3 iiii3 iiii3 iiii3 aaaa2 iiii2 iiii2 iiii2
253
254
mov dword ptr [edi],ebx
255
add edi,4
256
257
dec ecx
258
jnz tc1_loop
259
}
260
#elif !defined(NO_ASM)
261
//printf("TexConv_AI44_ARGB4444\n");
262
asm volatile (
263
//"tc1_loop4: \n"
264
"0: \n"
265
"mov (%[_src]), %%eax \n"
266
"add $4, %[_src] \n"
267
268
// aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
269
// aaaa1 rrrr1 gggg1 bbbb1 aaaa0 rrrr0 gggg0 bbbb0
270
// aaaa3 rrrr3 gggg3 bbbb3 aaaa2 rrrr2 gggg2 bbbb2
271
"mov %%eax, %%edx \n" // eax = aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
272
"shl $16, %%eax \n" // eax = aaaa1 iiii1 aaaa0 iiii0 0000 0000 0000 0000
273
"and $0xFF000000, %%eax \n" // eax = aaaa1 iiii1 0000 0000 0000 0000 0000 0000
274
"mov %%eax, %%ecx \n" // ecx = aaaa1 iiii1 0000 0000 0000 0000 0000 0000
275
"and $0x0F000000, %%eax \n" // eax = 0000 iiii1 0000 0000 0000 0000 0000 0000
276
"shr $4, %%eax \n" // eax = 0000 0000 iiii1 0000 0000 0000 0000 0000
277
"or %%eax, %%ecx \n" // ecx = aaaa1 iiii1 iiii1 0000 0000 0000 0000 0000
278
"shr $4, %%eax \n" // eax = 0000 0000 0000 iiii1 0000 0000 0000 0000
279
"or %%eax, %%ecx \n" // ecx = aaaa1 iiii1 iiii1 iiii1 0000 0000 0000 0000
280
281
"mov %%edx, %%eax \n" // eax = aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
282
"shl $8, %%eax \n" // eax = aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0 0000 0000
283
"and $0x0000FF00, %%eax \n" // eax = 0000 0000 0000 0000 aaaa0 iiii0 0000 0000
284
"or %%eax, %%ecx \n" // ecx = aaaa1 iiii1 iiii1 iiii1 aaaa0 iiii0 0000 0000
285
"and $0x00000F00, %%eax \n" // eax = 0000 0000 0000 0000 0000 iiii0 0000 0000
286
"shr $4, %%eax \n" // eax = 0000 0000 0000 0000 0000 0000 iiii0 0000
287
"or %%eax, %%ecx \n" // ecx = aaaa1 iiii1 iiii1 iiii1 aaaa0 iiii0 iiii0 0000
288
"shr $4, %%eax \n" // eax = 0000 0000 0000 0000 0000 0000 0000 iiii0
289
"or %%eax, %%ecx \n" // ecx = aaaa1 iiii1 iiii1 iiii1 aaaa0 iiii0 iiii0 iiii0
290
291
"mov %%ecx, (%[_dst]) \n"
292
"add $4, %[_dst] \n"
293
294
"mov %%edx, %%eax \n" // eax = aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
295
"and $0xFF000000, %%eax \n" // eax = aaaa3 iiii3 0000 0000 0000 0000 0000 0000
296
"mov %%eax, %%ecx \n" // ecx = aaaa3 iiii3 0000 0000 0000 0000 0000 0000
297
"and $0x0F000000, %%eax \n" // eax = 0000 iiii3 0000 0000 0000 0000 0000 0000
298
"shr $4, %%eax \n" // eax = 0000 0000 iiii3 0000 0000 0000 0000 0000
299
"or %%eax, %%ecx \n" // ecx = aaaa3 iiii3 iiii3 0000 0000 0000 0000 0000
300
"shr $4, %%eax \n" // eax = 0000 0000 0000 iiii3 0000 0000 0000 0000
301
"or %%eax, %%ecx \n" // ecx = aaaa3 iiii3 iiii3 iiii3 0000 0000 0000 0000
302
303
// edx = aaaa3 iiii3 aaaa2 iiii2 aaaa1 iiii1 aaaa0 iiii0
304
"shr $8, %%edx \n" // edx = 0000 0000 aaaa3 aaaa3 aaaa2 iiii2 aaaa1 iiii1
305
"and $0x0000FF00, %%edx \n" // edx = 0000 0000 0000 0000 aaaa2 iiii2 0000 0000
306
"or %%edx, %%ecx \n" // ecx = aaaa3 iiii3 iiii3 iiii3 aaaa2 iiii2 0000 0000
307
"and $0x00000F00, %%edx \n" // edx = 0000 0000 0000 0000 0000 iiii2 0000 0000
308
"shr $4, %%edx \n" // edx = 0000 0000 0000 0000 0000 0000 iiii2 0000
309
"or %%edx, %%ecx \n" // ecx = aaaa3 iiii3 iiii3 iiii3 aaaa2 iiii2 iiii2 0000
310
"shr $4, %%edx \n" // edx = 0000 0000 0000 0000 0000 0000 0000 iiii2
311
"or %%edx, %%ecx \n" // ecx = aaaa3 iiii3 iiii3 iiii3 aaaa2 iiii2 iiii2 iiii2
312
313
"mov %%ecx, (%[_dst]) \n"
314
"add $4, %[_dst] \n"
315
316
"decl %[_size] \n"
317
"jnz 0b \n"
318
: [_src]"+S"(_src), [_dst]"+D"(_dst), [_size]"+g"(_size)
319
:
320
: "memory", "cc", "eax", "edx", "ecx"
321
);
322
#endif
323
}
324
325
void TexConv_A8_ARGB4444 (unsigned char * _src, unsigned char * _dst, int width, int height)
326
{
327
int _size = (width * height) << 1;
328
#if !defined(__GNUC__) && !defined(NO_ASM)
329
__asm {
330
mov esi,dword ptr [_src]
331
mov edi,dword ptr [_dst]
332
mov ecx,dword ptr [_size]
333
334
tc1_loop:
335
mov eax,dword ptr [esi]
336
add esi,4
337
338
// aaaa3 aaaa3 aaaa2 aaaa2 aaaa1 aaaa1 aaaa0 aaaa0
339
// aaaa1 rrrr1 gggg1 bbbb1 aaaa0 rrrr0 gggg0 bbbb0
340
// aaaa3 rrrr3 gggg3 bbbb3 aaaa2 rrrr2 gggg2 bbbb2
341
mov edx,eax
342
and eax,0x0000F000 // eax = 00 00 00 00 a1 00 00 00
343
shl eax,16 // eax = a1 00 00 00 00 00 00 00
344
mov ebx,eax // ebx = a1 00 00 00 00 00 00 00
345
shr eax,4
346
or ebx,eax // ebx = a1 a1 00 00 00 00 00 00
347
shr eax,4
348
or ebx,eax // ebx = a1 a1 a1 00 00 00 00 00
349
shr eax,4
350
or ebx,eax // ebx = a1 a1 a1 a1 00 00 00 00
351
352
mov eax,edx
353
and eax,0x000000F0 // eax = 00 00 00 00 00 00 a0 00
354
shl eax,8 // eax = 00 00 00 00 a0 00 00 00
355
or ebx,eax
356
shr eax,4
357
or ebx,eax
358
shr eax,4
359
or ebx,eax
360
shr eax,4
361
or ebx,eax // ebx = a1 a1 a1 a1 a0 a0 a0 a0
362
363
mov dword ptr [edi],ebx
364
add edi,4
365
366
mov eax,edx // eax = a3 a3 a2 a2 a1 a1 a0 a0
367
and eax,0xF0000000 // eax = a3 00 00 00 00 00 00 00
368
mov ebx,eax // ebx = a3 00 00 00 00 00 00 00
369
shr eax,4
370
or ebx,eax // ebx = a3 a3 00 00 00 00 00 00
371
shr eax,4
372
or ebx,eax // ebx = a3 a3 a3 00 00 00 00 00
373
shr eax,4
374
or ebx,eax // ebx = a3 a3 a3 a3 00 00 00 00
375
376
and edx,0x00F00000 // eax = 00 00 a2 00 00 00 00 00
377
shr edx,8 // eax = 00 00 00 00 a2 00 00 00
378
or ebx,edx
379
shr edx,4
380
or ebx,edx
381
shr edx,4
382
or ebx,edx
383
shr edx,4
384
or ebx,edx // ebx = a3 a3 a3 a3 a2 a2 a2 a2
385
386
mov dword ptr [edi],ebx
387
add edi,4
388
389
dec ecx
390
jnz tc1_loop
391
}
392
#elif !defined(NO_ASM)
393
//printf("TexConv_A8_ARGB4444\n");
394
asm volatile (
395
//"tc1_loop: \n"
396
"0: \n"
397
"mov (%[src]), %%eax \n"
398
"add $4, %[src] \n"
399
400
// aaaa3 aaaa3 aaaa2 aaaa2 aaaa1 aaaa1 aaaa0 aaaa0
401
// aaaa1 rrrr1 gggg1 bbbb1 aaaa0 rrrr0 gggg0 bbbb0
402
// aaaa3 rrrr3 gggg3 bbbb3 aaaa2 rrrr2 gggg2 bbbb2
403
"mov %%eax, %%edx \n"
404
"and $0x0000F000, %%eax \n" // eax = 00 00 00 00 a1 00 00 00
405
"shl $16, %%eax \n" // eax = a1 00 00 00 00 00 00 00
406
"mov %%eax, %%ecx \n" // ecx = a1 00 00 00 00 00 00 00
407
"shr $4, %%eax \n"
408
"or %%eax, %%ecx \n" // ecx = a1 a1 00 00 00 00 00 00
409
"shr $4, %%eax \n"
410
"or %%eax, %%ecx \n" // ecx = a1 a1 a1 00 00 00 00 00
411
"shr $4, %%eax \n"
412
"or %%eax, %%ecx \n" // ecx = a1 a1 a1 a1 00 00 00 00
413
414
"mov %%edx, %%eax \n"
415
"and $0x000000F0, %%eax \n" // eax = 00 00 00 00 00 00 a0 00
416
"shl $8, %%eax \n" // eax = 00 00 00 00 a0 00 00 00
417
"or %%eax, %%ecx \n"
418
"shr $4, %%eax \n"
419
"or %%eax, %%ecx \n"
420
"shr $4, %%eax \n"
421
"or %%eax, %%ecx \n"
422
"shr $4, %%eax \n"
423
"or %%eax, %%ecx \n" // ecx = a1 a1 a1 a1 a0 a0 a0 a0
424
425
"mov %%ecx, (%[_dst]) \n"
426
"add $4, %[_dst] \n"
427
428
"mov %%edx, %%eax \n" // eax = a3 a3 a2 a2 a1 a1 a0 a0
429
"and $0xF0000000, %%eax \n" // eax = a3 00 00 00 00 00 00 00
430
"mov %%eax, %%ecx \n" // ecx = a3 00 00 00 00 00 00 00
431
"shr $4, %%eax \n"
432
"or %%eax, %%ecx \n" // ecx = a3 a3 00 00 00 00 00 00
433
"shr $4, %%eax \n"
434
"or %%eax, %%ecx \n" // ecx = a3 a3 a3 00 00 00 00 00
435
"shr $4, %%eax \n"
436
"or %%eax, %%ecx \n" // ecx = a3 a3 a3 a3 00 00 00 00
437
438
"and $0x00F00000, %%edx \n" // eax = 00 00 a2 00 00 00 00 00
439
"shr $8, %%edx \n" // eax = 00 00 00 00 a2 00 00 00
440
"or %%edx, %%ecx \n"
441
"shr $4, %%edx \n"
442
"or %%edx, %%ecx \n"
443
"shr $4, %%edx \n"
444
"or %%edx, %%ecx \n"
445
"shr $4, %%edx \n"
446
"or %%edx, %%ecx \n" // ecx = a3 a3 a3 a3 a2 a2 a2 a2
447
448
"mov %%ecx, (%[_dst]) \n"
449
"add $4, %[_dst] \n"
450
451
"decl %[_size] \n"
452
"jnz 0b \n"
453
: [src]"+S"(_src), [_dst]"+D"(_dst), [_size]"+g"(_size)
454
:
455
: "memory", "cc", "eax", "ecx", "edx"
456
);
457
#endif
458
}
459
460
461