Mercurial > sdl-ios-xcode
annotate src/endian/SDL_endian.c @ 689:5bb080d35049
Date: Tue, 19 Aug 2003 17:57:00 +0200
From: Stephane Marchesin
Subject: Re: [SDL] [patch] MMX alpha blit patches with MMX detection
I think everything is correct now. I've done as much testing as I could,
but some real-world testing wouldn't hurt, I think.
The patch is here : http://icps.u-strasbg.fr/~marchesin/sdl_mmxblit.patch
If you do byte-by-byte comparison of the output between C and MMX
functions, you'll notice that the results for 555 and 565 RGB alpha
blits aren't exactly the same. This is because MMX functions for 555 and
565 RGB have an higher accuracy. If you want the exact same behaviour
that's possible by masking the three lower alpha bits in the MMX
functions. Just ask !
I removed one MMX function because after I fixed it to match its C
equivalent, it revealed to be slower than the C version on a PIII
(although a bit faster on an Athlon XP).
I've also added MMX and PIII replacements for SDL_memcpy. Those provide
some speed up in testvidinfo -benchmark (at least for me, under linux &
X11).
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 22 Aug 2003 05:51:19 +0000 |
parents | f6ffac90895c |
children | b8d311d90021 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 /* Functions for dynamically reading and writing endian-specific values */ | |
29 | |
30 #include "SDL_endian.h" | |
31 | |
32 Uint16 SDL_ReadLE16 (SDL_RWops *src) | |
33 { | |
34 Uint16 value; | |
35 | |
36 SDL_RWread(src, &value, (sizeof value), 1); | |
37 return(SDL_SwapLE16(value)); | |
38 } | |
39 Uint16 SDL_ReadBE16 (SDL_RWops *src) | |
40 { | |
41 Uint16 value; | |
42 | |
43 SDL_RWread(src, &value, (sizeof value), 1); | |
44 return(SDL_SwapBE16(value)); | |
45 } | |
46 Uint32 SDL_ReadLE32 (SDL_RWops *src) | |
47 { | |
48 Uint32 value; | |
49 | |
50 SDL_RWread(src, &value, (sizeof value), 1); | |
51 return(SDL_SwapLE32(value)); | |
52 } | |
53 Uint32 SDL_ReadBE32 (SDL_RWops *src) | |
54 { | |
55 Uint32 value; | |
56 | |
57 SDL_RWread(src, &value, (sizeof value), 1); | |
58 return(SDL_SwapBE32(value)); | |
59 } | |
60 Uint64 SDL_ReadLE64 (SDL_RWops *src) | |
61 { | |
62 Uint64 value; | |
63 | |
64 SDL_RWread(src, &value, (sizeof value), 1); | |
65 return(SDL_SwapLE64(value)); | |
66 } | |
67 Uint64 SDL_ReadBE64 (SDL_RWops *src) | |
68 { | |
69 Uint64 value; | |
70 | |
71 SDL_RWread(src, &value, (sizeof value), 1); | |
72 return(SDL_SwapBE64(value)); | |
73 } | |
74 | |
75 int SDL_WriteLE16 (SDL_RWops *dst, Uint16 value) | |
76 { | |
77 value = SDL_SwapLE16(value); | |
78 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
79 } | |
80 int SDL_WriteBE16 (SDL_RWops *dst, Uint16 value) | |
81 { | |
82 value = SDL_SwapBE16(value); | |
83 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
84 } | |
85 int SDL_WriteLE32 (SDL_RWops *dst, Uint32 value) | |
86 { | |
87 value = SDL_SwapLE32(value); | |
88 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
89 } | |
90 int SDL_WriteBE32 (SDL_RWops *dst, Uint32 value) | |
91 { | |
92 value = SDL_SwapBE32(value); | |
93 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
94 } | |
95 int SDL_WriteLE64 (SDL_RWops *dst, Uint64 value) | |
96 { | |
97 value = SDL_SwapLE64(value); | |
98 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
99 } | |
100 int SDL_WriteBE64 (SDL_RWops *dst, Uint64 value) | |
101 { | |
102 value = SDL_SwapBE64(value); | |
103 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
104 } |