25 union {
unsigned u;
unsigned char c[4]; } temp;
28 ctemp = temp.c[0]; temp.c[0] = temp.c[3]; temp.c[3] = ctemp;
29 ctemp = temp.c[1]; temp.c[1] = temp.c[2]; temp.c[2] = ctemp;
34#define swap_int(a) (((a) << 24) | (((a) << 8) & 0x00ff0000) | (((a) >> 8) & 0x0000ff00) | ((unsigned long)(a) >> 24))
36#define swap_short(a) (((a & 0xff) << 8) | ((unsigned short)(a) >> 8))
41#if defined(WORDS_BIGENDIAN)
49#if defined(WORDS_BIGENDIAN)
57#if defined(WORDS_BIGENDIAN)
65#if defined(WORDS_BIGENDIAN)
73#if defined(WORDS_BIGENDIAN)
75 for (i = 0; i < *
n; i++) {
84#if defined(WORDS_BIGENDIAN)
86 for (i = 0; i < *
n; i++) {
95#if defined(WORDS_BIGENDIAN)
97 unsigned *uia = (
unsigned *)ia;
98 for (i = 0; i < *
n; i++) {
107#if defined(WORDS_BIGENDIAN)
109 unsigned *uia = (
unsigned *)ia;
110 for (i = 0; i < *
n; i++) {
130#define VMS_FLOAT_NATIVE CVT$K_IEEE_S
131#define VMS_DOUBLE_NATIVE CVT$K_IEEE_T
134#define VMS_FLOAT_NATIVE CVT$K_VAX_F
135#define VMS_DOUBLE_NATIVE CVT$K_VAX_D
138#define VMS_FLOAT_NATIVE CVT$K_VAX_F
139#define VMS_DOUBLE_NATIVE CVT$K_VAX_G
141#error Cannot determine VMS floating point format
149 unsigned int sign : 1;
150 unsigned int exp : 8;
157 unsigned int sign : 1;
158 unsigned int exp : 8;
181#define VAX_SNG_BIAS 0x81
182#define IEEE_SNG_BIAS 0x7f
189 {{0x7f, 0xff, 0x0, 0xffff},
191 {{0x0, 0x0, 0x0, 0x0},
195#define mmax sgl_limits[0]
196#define mmin sgl_limits[1]
203 unsigned int sign : 1;
204 unsigned int exp : 11;
213 unsigned int sign : 1;
214 unsigned int exp : 8;
240#define VAX_DBL_BIAS 0x81
241#define IEEE_DBL_BIAS 0x3ff
242#define MASK(nbits) ((1 << nbits) - 1)
258 unsigned char c_tmp, *c_p = (
unsigned char *)p;
259 for (i = 0; i <
n / 2; i++) {
261 c_p[i] = c_p[
n - i - 1];
262 c_p[
n - i - 1] = c_tmp;
267#define maybe_flip_bytes(__p, __n)
278 vs = *(
reinterpret_cast<struct
vax_single *
>(fp));
305 *fp = *(
reinterpret_cast<float *
>(&is));
314 is = *(
reinterpret_cast<struct
ieee_single *
>(fp));
323 }
else if (
tmp >= 2) {
346 *fp = *(
reinterpret_cast<float *
>(&vs));
355#include <cvt$routines>
363 for (i = 0; i < *
n; i++) {
364 if (cvt$ftof(val + i, CVT$K_VAX_F, val + i, CVT$K_VAX_F, CVT$M_REPORT_ALL) != CVT$K_NORMAL) {
370 for (i = 0; i < *
n; i++) {
376#error Unknown floating point format
385 for (
int i = 0; i < *
n; i++) {
391#error Unknown floating point format
403 for (i = 0; i < *
n; i++) {
405 if (cvt$ftof(val + i, CVT$K_IEEE_S, val + i, VMS_FLOAT_NATIVE, 0) != CVT$K_NORMAL) {
411#error Unknown floating point format
421#include <cvt$routines>
425 for (i = 0; i < *
n; i++) {
426 if (cvt$ftof(val + i, CVT$K_IEEE_T, val + i, VMS_DOUBLE_NATIVE, CVT$M_REPORT_ALL) != CVT$K_NORMAL) {
432#error Unknown floating point format
442#include <cvt$routines>
446 for (i = 0; i < *
n; i++) {
447 if (cvt$ftof(val + i, VMS_FLOAT_NATIVE, val + i, CVT$K_IEEE_S, CVT$M_REPORT_ALL) != CVT$K_NORMAL) {
453#error Unknown floating point format
465 for (i = 0; i < *
n; i++) {
466 if (cvt$ftof(val + i, VMS_DOUBLE_NATIVE, val + i, CVT$K_IEEE_T, CVT$M_REPORT_ALL) != CVT$K_NORMAL) {
472#error Unknown floating point format
477static unsigned char flip_bits(
unsigned char cc)
480 static unsigned char ct[256];
484 for(_i=0; _i<256; _i++)
487 for(_j=0; _j<8; _j++)
489 if (_i & (1<<_j)) { ct[_i] |= (128 >> _j); }
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
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)