例程:
#include "SDL_endian.h"
void ReadScanline16(FILE *file, Uint16 *scanline, int length)
{
fread(scanline, length, sizeof(Uint16), file);
if ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) {
int i;
for ( i=length-1; i >= 0; --i )
scanline[i] = SDL_SwapLE16(scanline[i]);
}
}
|