Mercurial > sdl-ios-xcode
annotate src/endian/SDL_endian.c @ 1344:2eed9997bd24
G:\SDL-12-CVS\src\video\math_private.h(171) : error C4226:
nonstandard extension used : 'huge' is an obsolete keyword
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 07 Feb 2006 17:49:40 +0000 |
parents | c9b51268668f |
children |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 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 | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 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 /* Functions for dynamically reading and writing endian-specific values */ | |
24 | |
25 #include "SDL_endian.h" | |
26 | |
27 Uint16 SDL_ReadLE16 (SDL_RWops *src) | |
28 { | |
29 Uint16 value; | |
30 | |
31 SDL_RWread(src, &value, (sizeof value), 1); | |
32 return(SDL_SwapLE16(value)); | |
33 } | |
34 Uint16 SDL_ReadBE16 (SDL_RWops *src) | |
35 { | |
36 Uint16 value; | |
37 | |
38 SDL_RWread(src, &value, (sizeof value), 1); | |
39 return(SDL_SwapBE16(value)); | |
40 } | |
41 Uint32 SDL_ReadLE32 (SDL_RWops *src) | |
42 { | |
43 Uint32 value; | |
44 | |
45 SDL_RWread(src, &value, (sizeof value), 1); | |
46 return(SDL_SwapLE32(value)); | |
47 } | |
48 Uint32 SDL_ReadBE32 (SDL_RWops *src) | |
49 { | |
50 Uint32 value; | |
51 | |
52 SDL_RWread(src, &value, (sizeof value), 1); | |
53 return(SDL_SwapBE32(value)); | |
54 } | |
55 Uint64 SDL_ReadLE64 (SDL_RWops *src) | |
56 { | |
57 Uint64 value; | |
58 | |
59 SDL_RWread(src, &value, (sizeof value), 1); | |
60 return(SDL_SwapLE64(value)); | |
61 } | |
62 Uint64 SDL_ReadBE64 (SDL_RWops *src) | |
63 { | |
64 Uint64 value; | |
65 | |
66 SDL_RWread(src, &value, (sizeof value), 1); | |
67 return(SDL_SwapBE64(value)); | |
68 } | |
69 | |
70 int SDL_WriteLE16 (SDL_RWops *dst, Uint16 value) | |
71 { | |
72 value = SDL_SwapLE16(value); | |
73 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
74 } | |
75 int SDL_WriteBE16 (SDL_RWops *dst, Uint16 value) | |
76 { | |
77 value = SDL_SwapBE16(value); | |
78 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
79 } | |
80 int SDL_WriteLE32 (SDL_RWops *dst, Uint32 value) | |
81 { | |
82 value = SDL_SwapLE32(value); | |
83 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
84 } | |
85 int SDL_WriteBE32 (SDL_RWops *dst, Uint32 value) | |
86 { | |
87 value = SDL_SwapBE32(value); | |
88 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
89 } | |
90 int SDL_WriteLE64 (SDL_RWops *dst, Uint64 value) | |
91 { | |
92 value = SDL_SwapLE64(value); | |
93 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
94 } | |
95 int SDL_WriteBE64 (SDL_RWops *dst, Uint64 value) | |
96 { | |
97 value = SDL_SwapBE64(value); | |
98 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
99 } |