size_t SDL_WriteBE64(SDL_RWops * dst, Uint64 value) { value = SDL_SwapBE64(value); return (SDL_RWwrite(dst, &value, (sizeof value), 1)); }
size_t SDL_WriteU8(SDL_RWops * dst, Uint8 value) { return (SDL_RWwrite(dst, &value, (sizeof value), 1)); }
size_t SDL_WriteLE32(SDL_RWops * dst, Uint32 value) { value = SDL_SwapLE32(value); return (SDL_RWwrite(dst, &value, (sizeof value), 1)); }
static void png_write_SDL(png_structp png_ptr, png_bytep data, png_size_t length) { SDL_RWops *rw = (SDL_RWops*)png_get_io_ptr(png_ptr); SDL_RWwrite(rw, data, sizeof(png_byte), length); }