#include "utility.h"
Go to the source code of this file.
Functions | |
| int | gs_swap_int (int *x) |
| int | gs_swap_int_nop (int *x) |
| int | gs_swap_int_undef (int *x) |
| int | gs_swap_float (float *f) |
| int | gs_swap_float_nop (float *x) |
| int | gs_swap_float_undef (float *x) |
| int | gs_swap_double (double *d) |
| int | gs_swap_double_nop (double *d) |
| int | gs_swap_double_undef (double *d) |
Variables | |
| gs_int_swap_f | gs_int_swap_func [4][4] |
| gs_float_swap_f | gs_float_swap_func [4][4] |
| gs_double_swap_f | gs_double_swap_func [4][4] |
This file contains routines for performing conversions between different machine representations.
The arrays of function pointers are indexed by the byte order part of the data signature such that the value at (m,n) is the function that converts between byte order 'm' and byte order 'n'.
Definition in file data_conversion.c.
| int gs_swap_double | ( | double * | d | ) |
Swaps the bytes in a double.
| d | -- pointer to the double to be swapped |
Definition at line 173 of file data_conversion.c.
| int gs_swap_double_nop | ( | double * | d | ) |
Does nothing. This is used along the diagonal of the conversion matrix since that represents a conversion between the same representations.
| d | -- pointer to the double to be swapped |
Definition at line 201 of file data_conversion.c.
{
return 0;
}
| int gs_swap_double_undef | ( | double * | d | ) |
Does nothing. This is used in the conversion matrix in places where we have not implemented a conversion between the two representations.
| d | -- pointer to the double to be swapped |
Definition at line 218 of file data_conversion.c.
{
ERRPRINTF("Error: this conversion is undefined\n");
return -1;
}
| int gs_swap_float | ( | float * | f | ) |
Swaps the bytes in a float.
| x | -- pointer to the float to be swapped |
Definition at line 113 of file data_conversion.c.
| int gs_swap_float_nop | ( | float * | x | ) |
Does nothing. This is used along the diagonal of the conversion matrix since that represents a conversion between the same representations.
| x | -- pointer to the float to be swapped |
Definition at line 141 of file data_conversion.c.
{
return 0;
}
| int gs_swap_float_undef | ( | float * | x | ) |
Does nothing. This is used in the conversion matrix in places where we have not implemented a conversion between the two representations.
| x | -- pointer to the float to be swapped |
Definition at line 158 of file data_conversion.c.
{
ERRPRINTF("Error: this conversion is undefined\n");
return -1;
}
| int gs_swap_int | ( | int * | x | ) |
Swaps the bytes in an integer.
| x | -- pointer to the integer to be swapped |
Definition at line 50 of file data_conversion.c.
{
switch(sizeof(int)) {
case 4:
*x = ((*x & 0xFF) << 24) |
((*x & 0xFF00) << 8) |
((*x & 0xFF0000) >> 8) |
((*x & 0xFF000000) >> 24);
return 0;
case 2:
*x = ((*x & 0xFF) << 8) |
((*x & 0xFF00) >> 8);
return 0;
default:
ERRPRINTF("Error: unexpected int size\n");
return -1;
}
}
| int gs_swap_int_nop | ( | int * | x | ) |
Does nothing. This is used along the diagonal of the conversion matrix since that represents a conversion between the same representations.
| x | -- pointer to the integer to be swapped |
Definition at line 81 of file data_conversion.c.
{
return 0;
}
| int gs_swap_int_undef | ( | int * | x | ) |
Does nothing. This is used in the conversion matrix in places where we have not implemented a conversion between the two representations.
| x | -- pointer to the integer to be swapped |
Definition at line 98 of file data_conversion.c.
{
ERRPRINTF("Error: this conversion is undefined\n");
return -1;
}
| gs_double_swap_f gs_double_swap_func[4][4] |
{
{gs_swap_double_nop, gs_swap_double_undef, gs_swap_double_undef, gs_swap_double},
{gs_swap_double_undef, gs_swap_double_nop, gs_swap_double_undef, gs_swap_double_undef},
{gs_swap_double_undef, gs_swap_double_undef, gs_swap_double_nop, gs_swap_double_undef},
{gs_swap_double, gs_swap_double_undef, gs_swap_double_undef, gs_swap_double_nop}}
Array of double byte swapping functions
Definition at line 35 of file data_conversion.c.
| gs_float_swap_f gs_float_swap_func[4][4] |
{
{gs_swap_float_nop, gs_swap_float_undef, gs_swap_float_undef, gs_swap_float},
{gs_swap_float_undef, gs_swap_float_nop, gs_swap_float_undef, gs_swap_float_undef},
{gs_swap_float_undef, gs_swap_float_undef, gs_swap_float_nop, gs_swap_float_undef},
{gs_swap_float, gs_swap_float_undef, gs_swap_float_undef, gs_swap_float_nop}}
Array of float byte swapping functions
Definition at line 27 of file data_conversion.c.
| gs_int_swap_f gs_int_swap_func[4][4] |
{
{gs_swap_int_nop, gs_swap_int_undef, gs_swap_int_undef, gs_swap_int},
{gs_swap_int_undef, gs_swap_int_nop, gs_swap_int_undef, gs_swap_int_undef},
{gs_swap_int_undef, gs_swap_int_undef, gs_swap_int_nop, gs_swap_int_undef},
{gs_swap_int, gs_swap_int_undef, gs_swap_int_undef, gs_swap_int_nop}}
Array of integer byte swapping functions
Definition at line 19 of file data_conversion.c.
1.6.3-20100507