mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-25 05:59:11 +00:00
Add SDL_ReadS8 and SDL_WriteS8
This commit is contained in:
parent
96bb06d9c7
commit
ef6123886e
5 changed files with 49 additions and 0 deletions
|
@ -1117,6 +1117,20 @@ SDL_bool SDL_ReadU8(SDL_IOStream *src, Uint8 *value)
|
|||
return result;
|
||||
}
|
||||
|
||||
SDL_bool SDL_ReadS8(SDL_IOStream *src, Sint8 *value)
|
||||
{
|
||||
Sint8 data = 0;
|
||||
SDL_bool result = SDL_FALSE;
|
||||
|
||||
if (SDL_ReadIO(src, &data, sizeof(data)) == sizeof(data)) {
|
||||
result = SDL_TRUE;
|
||||
}
|
||||
if (value) {
|
||||
*value = data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
SDL_bool SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value)
|
||||
{
|
||||
Uint16 data = 0;
|
||||
|
@ -1236,6 +1250,11 @@ SDL_bool SDL_WriteU8(SDL_IOStream *dst, Uint8 value)
|
|||
return (SDL_WriteIO(dst, &value, sizeof(value)) == sizeof(value));
|
||||
}
|
||||
|
||||
SDL_bool SDL_WriteS8(SDL_IOStream *dst, Sint8 value)
|
||||
{
|
||||
return (SDL_WriteIO(dst, &value, sizeof(value)) == sizeof(value));
|
||||
}
|
||||
|
||||
SDL_bool SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value)
|
||||
{
|
||||
const Uint16 swapped = SDL_SwapLE16(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue