24 union {
unsigned u;
unsigned char c[4]; } temp;
27 ctemp = temp.c[0]; temp.c[0] = temp.c[3]; temp.c[3] = ctemp;
28 ctemp = temp.c[1]; temp.c[1] = temp.c[2]; temp.c[2] = ctemp;
33#define swap_int(a) (((a) << 24) | (((a) << 8) & 0x00ff0000) | (((a) >> 8) & 0x0000ff00) | ((unsigned long)(a) >> 24))
35#define swap_short(a) (((a & 0xff) << 8) | ((unsigned short)(a) >> 8))
40#if defined(WORDS_BIGENDIAN)
48#if defined(WORDS_BIGENDIAN)
56#if defined(WORDS_BIGENDIAN)
64#if defined(WORDS_BIGENDIAN)
72#if defined(WORDS_BIGENDIAN)
74 for (i = 0; i < *
n; i++) {
83#if defined(WORDS_BIGENDIAN)
85 for (i = 0; i < *
n; i++) {
94#if defined(WORDS_BIGENDIAN)
96 unsigned *uia = (
unsigned *)ia;
97 for (i = 0; i < *
n; i++) {
106#if defined(WORDS_BIGENDIAN)
108 unsigned *uia = (
unsigned *)ia;
109 for (i = 0; i < *
n; i++) {
129#define VMS_FLOAT_NATIVE CVT$K_IEEE_S
130#define VMS_DOUBLE_NATIVE CVT$K_IEEE_T
133#define VMS_FLOAT_NATIVE CVT$K_VAX_F
134#define VMS_DOUBLE_NATIVE CVT$K_VAX_D
137#define VMS_FLOAT_NATIVE CVT$K_VAX_F
138#define VMS_DOUBLE_NATIVE CVT$K_VAX_G
140#error Cannot determine VMS floating point format
148 unsigned int sign : 1;
149 unsigned int exp : 8;
156 unsigned int sign : 1;
157 unsigned int exp : 8;
180#define VAX_SNG_BIAS 0x81
181#define IEEE_SNG_BIAS 0x7f
188 {{0x7f, 0xff, 0x0, 0xffff},
190 {{0x0, 0x0, 0x0, 0x0},
194#define mmax sgl_limits[0]
195#define mmin sgl_limits[1]
202 unsigned int sign : 1;
203 unsigned int exp : 11;
212 unsigned int sign : 1;
213 unsigned int exp : 8;
239#define VAX_DBL_BIAS 0x81
240#define IEEE_DBL_BIAS 0x3ff
241#define MASK(nbits) ((1 << nbits) - 1)
257 unsigned char c_tmp, *c_p = (
unsigned char *)p;
258 for (i = 0; i <
n / 2; i++) {
260 c_p[i] = c_p[
n - i - 1];
261 c_p[
n - i - 1] = c_tmp;
266#define maybe_flip_bytes(__p, __n)
275 vs = *(
reinterpret_cast<struct
vax_single *
>(fp));
302 *fp = *(
reinterpret_cast<float *
>(&is));
311 is = *(
reinterpret_cast<struct
ieee_single *
>(fp));
320 }
else if (
tmp >= 2) {
343 *fp = *(
reinterpret_cast<float *
>(&vs));
350#include <cvt$routines>
358 for (i = 0; i < *
n; i++) {
359 if (cvt$ftof(val + i, CVT$K_VAX_F, val + i, CVT$K_VAX_F, CVT$M_REPORT_ALL) != CVT$K_NORMAL) {
365 for (i = 0; i < *
n; i++) {
371#error Unknown floating point format
380 for (
int i = 0; i < *
n; i++) {
386#error Unknown floating point format
398 for (i = 0; i < *
n; i++) {
400 if (cvt$ftof(val + i, CVT$K_IEEE_S, val + i, VMS_FLOAT_NATIVE, 0) != CVT$K_NORMAL) {
406#error Unknown floating point format
416#include <cvt$routines>
420 for (i = 0; i < *
n; i++) {
421 if (cvt$ftof(val + i, CVT$K_IEEE_T, val + i, VMS_DOUBLE_NATIVE, CVT$M_REPORT_ALL) != CVT$K_NORMAL) {
427#error Unknown floating point format
437#include <cvt$routines>
441 for (i = 0; i < *
n; i++) {
442 if (cvt$ftof(val + i, VMS_FLOAT_NATIVE, val + i, CVT$K_IEEE_S, CVT$M_REPORT_ALL) != CVT$K_NORMAL) {
448#error Unknown floating point format
460 for (i = 0; i < *
n; i++) {
461 if (cvt$ftof(val + i, VMS_DOUBLE_NATIVE, val + i, CVT$K_IEEE_T, CVT$M_REPORT_ALL) != CVT$K_NORMAL) {
467#error Unknown floating point format
472static unsigned char flip_bits(
unsigned char cc)
475 static unsigned char ct[256];
479 for(_i=0; _i<256; _i++)
482 for(_j=0; _j<8; _j++)
484 if (_i & (1<<_j)) { ct[_i] |= (128 >> _j); }
What IEEE double precision floating point looks like.
unsigned int exp
exponential
unsigned int mantissa1
mantissa 1
unsigned int mantissa2
mantissa 2
What IEEE single precision floating point looks like on local machine.
unsigned int exp
Exponential.
unsigned int mantissa
mantissa
Structure holding the limits of s single.
struct ieee_single ieee
ieee single struct
struct vax_single s
vax single struct
Vax double precision floating point.
unsigned int mantissa2
mantissa 2
unsigned int exp
exponential
unsigned int mantissa1
mantissa 1
Vax single precision floating point.
unsigned int mantissa2
mantissa 2
unsigned int mantissa1
mantissa 1
unsigned int exp
Exponential.
void local_to_vax_ints(const fort_int *ia, const fort_int *n)
void vax_to_local_ints(const fort_int *ia, const fort_int *n)
static int ieee_to_vax_float(float *fp)
void ieee_float_to_local(const float *val, const int *n, int *errcode)
void vaxf_to_local(float *val, const int *n, int *errcode)
void local_to_vaxf(float *val, const int *n, int *errcode)
void ieee_double_to_local(const double *val, const int *n, int *errcode)
unsigned local_to_vax_int(const fort_int *i)
static const struct sgl_limits_struct sgl_limits[2]
void local_to_ieee_double(const double *val, const int *n, int *errcode)
static int vax_to_ieee_float(float *fp)
void local_to_vax_shorts(const unsigned short *sa, const int *n)
unsigned short vax_to_local_short(const unsigned short *s)
void vax_to_local_shorts(const unsigned short *sa, const int *n)
#define maybe_flip_bytes(__p, __n)
unsigned vax_to_local_int(const fort_int *i)
unsigned short local_to_vax_short(const unsigned short *s)
void local_to_ieee_float(const float *val, const int *n, int *errcode)