OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
epr_swap.c File Reference
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "epr_api.h"
#include "epr_core.h"
#include "epr_field.h"
Include dependency graph for epr_swap.c:

Go to the source code of this file.

Functions

void byte_swap_short (short *buffer, epr_uint number_of_swaps)
 
void byte_swap_int (int *buffer, epr_uint number_of_swaps)
 
void byte_swap_ushort (epr_ushort *buffer, epr_uint number_of_swaps)
 
void byte_swap_uint (epr_uint *buffer, epr_uint number_of_swaps)
 
void byte_swap_float (float *buffer, epr_uint number_of_swaps)
 
int epr_is_little_endian_order ()
 
int epr_is_big_endian_order ()
 
void epr_swap_endian_order (const EPR_SField *field)
 

Function Documentation

◆ byte_swap_float()

void byte_swap_float ( float *  buffer,
epr_uint  number_of_swaps 
)

Swaps bytes within NUMBER_OF_SWAPS four-byte words, starting at address BUFFER.

Parameters
bufferthe one element typed buffer to convert for a little endian order machine
number_of_swapsnumber of elements to convert

Definition at line 131 of file epr_swap.c.

◆ byte_swap_int()

void byte_swap_int ( int *  buffer,
epr_uint  number_of_swaps 
)

Swaps bytes within NUMBER_OF_SWAPS four-byte words, starting at address BUFFER.

Definition at line 65 of file epr_swap.c.

◆ byte_swap_short()

void byte_swap_short ( short *  buffer,
epr_uint  number_of_swaps 
)

Swaps bytes within NUMBER_OF_SWAPS two-byte words, starting at address BUFFER.

Parameters
bufferthe one element typed buffer to convert for a little endian order machine
number_of_swapsnumber of elements to convert

Definition at line 43 of file epr_swap.c.

◆ byte_swap_uint()

void byte_swap_uint ( epr_uint buffer,
epr_uint  number_of_swaps 
)

Swaps bytes within NUMBER_OF_SWAPS four-byte words, starting at address BUFFER.

Parameters
bufferthe one element typed buffer to convert for a little endian order machine
number_of_swapsnumber of elements to convert

Definition at line 112 of file epr_swap.c.

◆ byte_swap_ushort()

void byte_swap_ushort ( epr_ushort buffer,
epr_uint  number_of_swaps 
)

Swaps bytes within NUMBER_OF_SWAPS two-byte words, starting at address BUFFER.

Parameters
bufferthe one element typed buffer to convert for a little endian order machine
number_of_swapsnumber of elements to convert

Definition at line 93 of file epr_swap.c.

◆ epr_is_big_endian_order()

int epr_is_big_endian_order ( )

Returns a oolean value indicating whether this code run's on a little endian order machine or not.

1 stands for little endian (BE), 0/code> otherwise

Definition at line 171 of file epr_swap.c.

◆ epr_is_little_endian_order()

int epr_is_little_endian_order ( )

A boolean value indicating whether this code run's on a little endian order machine or not.

1 stands for little endian (LE), 0 stands for big endian (BE). Returns a oolean value indicating whether this code run's on a little endian order machine or not.

1 stands for little endian (LE), 0/code> otherwise

Definition at line 152 of file epr_swap.c.

◆ epr_swap_endian_order()

void epr_swap_endian_order ( const EPR_SField *  field)

Converts bytes for a little endian order machine

Parameters
fieldthe pointer at data reading in

Definition at line 192 of file epr_swap.c.