Exemple #1
0
/*
 * Read an unsigned 16-bit int and swap to native byte order.
 */
static int readui16(void *in, PHYSFS_uint16 *val)
{
    PHYSFS_uint16 v;
    BAIL_IF_MACRO(__PHYSFS_platformRead(in, &v, sizeof (v), 1) != 1, NULL, 0);
    *val = PHYSFS_swapULE16(v);
    return(1);
} /* readui16 */
int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val)
{
    PHYSFS_uint16 in;
    BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
    BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
    *val = PHYSFS_swapULE16(in);
    return(1);
} /* PHYSFS_readULE16 */
int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val)
{
    PHYSFS_uint16 out = PHYSFS_swapULE16(val);
    BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
    return(1);
} /* PHYSFS_writeULE16 */
Exemple #4
0
uint16 Util::swapULE16(uint16 value) {
	return PHYSFS_swapULE16(value);
}