8#include "EndianSwapper.h"
25 if(inputEndian !=
"LSB" && inputEndian !=
"MSB") {
26 string message =
"Invalid parameter-InputEndian must be LSB or MSB";
27 throw IException(IException::Programmer, message, _FILEINFO_);
30 if((Isis::IsLsb() && inputEndian ==
"LSB") ||
31 (Isis::IsMsb() && inputEndian ==
"MSB")) {
56 double result = *(
double *)buf;
59 char *ptr = (
char *)buf + (
sizeof(
double) - 1) *
p_needSwap;
61 for(
unsigned int i = 0; i <
sizeof(double); i++) {
79 float result = *(
float *)buf;
82 char *ptr = (
char *)buf + (
sizeof(
float) - 1) *
p_needSwap;
84 for(
unsigned int i = 0; i <
sizeof(float); i++) {
109 int result = *(
int *)buf;
112 char *ptr = (
char *)buf + (
sizeof(
int) - 1) *
p_needSwap;
114 for(
unsigned int i = 0; i <
sizeof(int); i++) {
131 uint32_t result = *(uint32_t *)buf;
134 char *ptr = (
char *)buf + (
sizeof(uint32_t) - 1) *
p_needSwap;
136 for(
unsigned int i = 0; i <
sizeof(uint32_t); i++) {
153 long long int result = *(
long long int *)buf;
156 char *ptr = (
char *)buf + (
sizeof(
long long int) - 1) *
p_needSwap;
158 for(
unsigned int i = 0; i <
sizeof(
long long int); i++) {
175 short int result = *(
short int *)buf;
178 char *ptr = (
char *)buf + (
sizeof(
short int) - 1) *
p_needSwap;
180 for(
unsigned int i = 0; i <
sizeof(
short int); i++) {
198 unsigned short int result = *(
unsigned short int *)buf;
200 char *ptr = (
char *)buf + (
sizeof(
unsigned short int) - 1) *
p_needSwap;
202 for(
unsigned int i = 0; i <
sizeof(
unsigned short int); i++) {
float Float(void *buf)
Swaps a floating point value.
short int ShortInt(void *buf)
Swaps a short integer value.
int p_swapDirection
Indicates which direction to increment the pointer for swapping.
long long int LongLongInt(void *buf)
Swaps an 8 byte integer value.
~EndianSwapper()
Destroys the EndianSwapper object.
int Int(void *buf)
Swaps a 4 byte integer value.
double Double(void *buf)
Swaps a double precision value.
uint32_t Uint32_t(void *buf)
Swaps a 32bit unsigned integer.
unsigned short int UnsignedShortInt(void *buf)
Swaps an unsigned short integer value.
EndianSwapper(QString inputEndian)
Constructs an EndianSwapper object, determining whether swapping of bytes actually needs to occur and...
union Isis::EndianSwapper::@223260073032135314225012045064032120076335315007 p_swapper
Union containing the output double precision value, floating point value, short integer value,...
bool p_needSwap
Indicates whether bytes need to be swapped.
int ExportFloat(void *buf)
Swaps a floating point value for Exporting.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.