Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

ncx_cray.c

Go to the documentation of this file.
00001 /*
00002  *      Copyright 1996, University Corporation for Atmospheric Research
00003  *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
00004  *      
00005  */
00006 #ifndef _CRAY
00007 #error "ncx_cray.c is a cray specific implementation"
00008 #endif
00009 
00010 /*
00011  * An external data representation interface.
00012  */
00013 /*
00014  * TODO: Fix "off diagonal" functions (ncx_{put,get}[n]_t1_t2() s.t. t1 != t2)
00015  * to be use IEG functions when diagonals are.
00016  *
00017  * Whine to cray about IEG function limiting behavior.
00018  */
00019 
00020 #include <string.h>
00021 #include <limits.h>
00022 /* alias poorly named limits.h macros */
00023 #define  SHORT_MAX  SHRT_MAX
00024 #define  SHORT_MIN  SHRT_MIN
00025 #define USHORT_MAX USHRT_MAX
00026 #include <float.h>
00027 #include <assert.h>
00028 #include "ncx.h"
00029 
00030 /**/
00031 #if USE_IEG
00032 #define C_SIZE_T size_t
00033 
00034 extern int
00035 CRAY2IEG(
00036         const int *typep,
00037         const C_SIZE_T *nump,
00038         word *foreignp,
00039         const int *bitoffp,
00040         const void *local,
00041         const int *stride
00042 );
00043 
00044 extern int
00045 IEG2CRAY(
00046         const int *typep,
00047         const C_SIZE_T *nump,
00048         const word *foreignp,
00049         const int *bitoffp,
00050         void *local,
00051         const int *stride
00052 );
00053 
00054 
00055 static const int Zero = 0;
00056 static const C_SIZE_T One = 1;
00057 static const int ThirtyTwo = 32;
00058 static const int UnitStride = 1;
00059 static const int Cray2_I32 = 1; /* 32 bit two complement */
00060 static const int Cray2_F32 = 2; /* IEEE single precision */
00061 static const int Cray2_I16 = 7; /* 16 bit twos complement */
00062 static const int Cray2_F64 = 8; /* CRAY float to IEEE double */
00063 
00064 #define SHORT_USE_IEG 1
00065 #define INT_USE_IEG 1
00066 #define FLOAT_USE_IEG 1
00067 #define DOUBLE_USE_IEG 1
00068 
00069 #if _CRAY1
00070 /*
00071  * Return the number of bits "into" a word that (void *) is.
00072  * N.B. This is based on the CRAY1 (PVP) address structure,
00073  * which puts the address within a word in the leftmost 3 bits
00074  * of the address.
00075  */
00076 static size_t
00077 bitoff(const void *vp)
00078 {
00079         const size_t bitoffset = ((size_t)vp >> (64 - 6)) & 0x3f;
00080         return bitoffset;
00081 }
00082 # else
00083 #error "Don't use IEG2CRAY, CRAY2IEG except on CRAY1 (MPP) platforms"
00084 #define bitoff(vp) ((size_t)(vp) % 64) /* N.B. Assumes 64 bit word */
00085 # endif /* _CRAY1 */
00086 
00087 #endif /* USE_IEG */
00088 
00089 #if _CRAY1
00090 /*
00091  * Return the number of bytes "into" a word that (void *) is.
00092  * N.B. This is based on the CRAY1 (PVP) address structure,
00093  * which puts the address within a word in the leftmost 3 bits
00094  * of the address.
00095  */
00096 static size_t
00097 byteoff(const void *vp)
00098 {
00099         const size_t byteoffset = ((size_t)vp >> (64 - 3)) & 0x7;
00100         return byteoffset;
00101 }
00102 #else
00103 #define byteoff(vp) ((size_t)(vp) % 8) /* N.B. Assumes 64 bit word */
00104 #endif /* _CRAY1 */
00105 
00106 /*
00107  * Return the number of bytes until the next "word" boundary
00108  */
00109 static size_t
00110 word_align(const void *vp)
00111 {
00112         const size_t rem = byteoff(vp);
00113         if(rem == 0)
00114                 return 0;
00115         return sizeof(word) - rem;
00116 }
00117 
00118 
00119 static const char nada[X_ALIGN] = {0, 0, 0, 0};
00120 
00121 
00122 /*
00123  * Primitive numeric conversion functions.
00124  */
00125 
00126 /* x_schar */
00127 
00128  /* We don't implement and x_schar primitives. */
00129 
00130 
00131 /* x_short */
00132 
00133 typedef short ix_short;
00134 #define SIZEOF_IX_SHORT SIZEOF_SHORT
00135 #define IX_SHORT_MAX SHORT_MAX
00136 
00137 static void
00138 cget_short_short(const void *xp, short *ip, int which)
00139 {
00140         const long *wp = xp;
00141 
00142         switch(which) {
00143         case 0:
00144                 *ip = (short)(*wp >> 48);
00145                 break;
00146         case 1:
00147                 *ip = (short)((*wp >> 32) & 0xffff);
00148                 break;
00149         case 2:
00150                 *ip = (short)((*wp >> 16) & 0xffff);
00151                 break;
00152         case 3:
00153                 *ip = (short)(*wp & 0xffff);
00154                 break;
00155         }
00156 
00157         if(*ip & 0x8000)
00158         {
00159                 /* extern is negative */
00160                 *ip |= (~(0xffff));
00161         }
00162 }
00163 #define get_ix_short(xp, ip) cget_short_short((xp), (ip), byteoff(xp)/X_SIZEOF_SHORT)
00164 
00165 static int
00166 cput_short_short(void *xp, const short *ip, int which)
00167 {
00168         word *wp = xp;
00169 
00170         switch(which) {
00171         case 0:
00172                 *wp = (*ip << 48)
00173                             | (*wp & 0x0000ffffffffffff);
00174                 break;
00175         case 1:
00176                 *wp = ((*ip << 32) & 0x0000ffff00000000)
00177                             | (*wp & 0xffff0000ffffffff);
00178                 break;
00179         case 2:
00180                 *wp = ((*ip << 16) & 0x00000000ffff0000)
00181                             | (*wp & 0xffffffff0000ffff);
00182                 break;
00183         case 3:
00184                 *wp = (*ip         & 0x000000000000ffff)   
00185                             | (*wp & 0xffffffffffff0000);
00186                 break;
00187         }
00188 
00189         if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
00190                 return NC_ERANGE;
00191         return ENOERR;
00192 }
00193 
00194 int
00195 ncx_get_short_schar(const void *xp, schar *ip)
00196 {
00197         ix_short xx;
00198         get_ix_short(xp, &xx);
00199         *ip = xx;
00200         if(xx > SCHAR_MAX || xx < SCHAR_MIN)
00201                 return NC_ERANGE;
00202         return ENOERR;
00203 }
00204 
00205 int
00206 ncx_get_short_uchar(const void *xp, uchar *ip)
00207 {
00208         ix_short xx;
00209         get_ix_short(xp, &xx);
00210         *ip = xx;
00211         if(xx > UCHAR_MAX || xx < 0)
00212                 return NC_ERANGE;
00213         return ENOERR;
00214 }
00215 
00216 int
00217 ncx_get_short_short(const void *xp, short *ip)
00218 {
00219         get_ix_short(xp, ip);
00220         return ENOERR;
00221 }
00222 
00223 int
00224 ncx_get_short_int(const void *xp, int *ip)
00225 {
00226         ix_short xx;
00227         get_ix_short(xp, &xx);
00228         *ip = xx;
00229         return ENOERR;
00230 }
00231 
00232 int
00233 ncx_get_short_long(const void *xp, long *ip)
00234 {
00235         ix_short xx;
00236         get_ix_short(xp, &xx);
00237         *ip = xx;
00238         return ENOERR;
00239 }
00240 
00241 int
00242 ncx_get_short_float(const void *xp, float *ip)
00243 {
00244         ix_short xx;
00245         get_ix_short(xp, &xx);
00246         *ip = xx;
00247         return ENOERR;
00248 }
00249 
00250 int
00251 ncx_get_short_double(const void *xp, double *ip)
00252 {
00253         ix_short xx;
00254         get_ix_short(xp, &xx);
00255         *ip = xx;
00256         return ENOERR;
00257 }
00258 
00259 int
00260 ncx_put_short_schar(void *xp, const schar *ip)
00261 {
00262         uchar *cp = xp;
00263         if(*ip & 0x80)
00264                 *cp++ = 0xff;
00265         else
00266                 *cp++ = 0;
00267         *cp = (uchar)*ip;
00268         return ENOERR;
00269 }
00270 
00271 int
00272 ncx_put_short_uchar(void *xp, const uchar *ip)
00273 {
00274         uchar *cp = xp;
00275         *cp++ = 0;
00276         *cp = *ip;
00277         return ENOERR;
00278 }
00279 
00280 int
00281 ncx_put_short_short(void *xp, const short *ip)
00282 {
00283         return cput_short_short(xp, ip, byteoff(xp)/X_SIZEOF_SHORT);
00284 }
00285 
00286 int
00287 ncx_put_short_int(void *xp, const int *ip)
00288 {
00289         ix_short xx = (ix_short)*ip;
00290         return cput_short_short(xp, &xx, byteoff(xp)/X_SIZEOF_SHORT);
00291 }
00292 
00293 int
00294 ncx_put_short_long(void *xp, const long *ip)
00295 {
00296         ix_short xx = (ix_short)*ip;
00297         return cput_short_short(xp, &xx, byteoff(xp)/X_SIZEOF_SHORT);
00298 }
00299 
00300 int
00301 ncx_put_short_float(void *xp, const float *ip)
00302 {
00303         ix_short xx = (ix_short)*ip;
00304         const int status = cput_short_short(xp, &xx, byteoff(xp)/X_SIZEOF_SHORT);
00305         if(status != ENOERR)
00306                 return status;
00307         if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
00308                 return NC_ERANGE;
00309         return ENOERR;
00310 }
00311 
00312 int
00313 ncx_put_short_double(void *xp, const double *ip)
00314 {
00315         ix_short xx = (ix_short)*ip;
00316         const int status = cput_short_short(xp, &xx, byteoff(xp)/X_SIZEOF_SHORT);
00317         if(status != ENOERR)
00318                 return status;
00319         if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
00320                 return NC_ERANGE;
00321         return ENOERR;
00322 }
00323 
00324 /* x_int */
00325 
00326 typedef int ix_int;
00327 #define SIZEOF_IX_INT SIZEOF_INT
00328 #define IX_INT_MAX INT_MAX
00329 
00330 static void
00331 cget_int_int(const void *xp, int *ip, int which)
00332 {
00333         const long *wp = xp;
00334 
00335         if(which == 0)
00336         {
00337                 *ip = (int)(*wp >> 32);
00338         }
00339         else
00340         {
00341                 *ip = (int)(*wp & 0xffffffff);
00342         }
00343 
00344         if(*ip & 0x80000000)
00345         {
00346                 /* extern is negative */
00347                 *ip |= (~(0xffffffff));
00348         }
00349 }
00350 #define get_ix_int(xp, ip) cget_int_int((xp), (ip), byteoff(xp))
00351 
00352 static int
00353 cput_int_int(void *xp, const int *ip, int which)
00354 {
00355         word *wp = xp;
00356 
00357         if(which == 0)
00358         {
00359                 *wp = (*ip << 32) | (*wp & 0xffffffff);
00360         }
00361         else
00362         {
00363                 *wp = (*wp & ~0xffffffff) | (*ip & 0xffffffff);
00364         }
00365         if(*ip > X_INT_MAX || *ip < X_INT_MIN)
00366                 return NC_ERANGE;
00367         return ENOERR;
00368 }
00369 #define put_ix_int(xp, ip) cput_int_int((xp), (ip), byteoff(xp))
00370 
00371 int
00372 ncx_get_int_schar(const void *xp, schar *ip)
00373 {
00374         ix_int xx;
00375         get_ix_int(xp, &xx);
00376         *ip = xx;
00377         if(xx > SCHAR_MAX || xx < SCHAR_MIN)
00378                 return NC_ERANGE;
00379         return ENOERR;
00380 }
00381 
00382 int
00383 ncx_get_int_uchar(const void *xp, uchar *ip)
00384 {
00385         ix_int xx;
00386         get_ix_int(xp, &xx);
00387         *ip = xx;
00388         if(xx > UCHAR_MAX || xx < 0)
00389                 return NC_ERANGE;
00390         return ENOERR;
00391 }
00392 
00393 int
00394 ncx_get_int_short(const void *xp, short *ip)
00395 {
00396         ix_int xx;
00397         get_ix_int(xp, &xx);
00398         *ip = xx;
00399         if(xx > SHORT_MAX || xx < SHORT_MIN)
00400                 return NC_ERANGE;
00401         return ENOERR;
00402 }
00403 
00404 int
00405 ncx_get_int_int(const void *xp, int *ip)
00406 {
00407         ix_int xx;
00408         get_ix_int(xp, &xx);
00409         *ip = xx;
00410         return ENOERR;
00411 }
00412 
00413 static void
00414 cget_int_long(const void *xp, long *ip, int which)
00415 {
00416         const long *wp = xp;
00417 
00418         if(which == 0)
00419         {
00420                 *ip = (int)(*wp >> 32);
00421         }
00422         else
00423         {
00424                 *ip = (int)(*wp & 0xffffffff);
00425         }
00426 
00427         if(*ip & 0x80000000)
00428         {
00429                 /* extern is negative */
00430                 *ip |= (~(0xffffffff));
00431         }
00432 }
00433 
00434 int
00435 ncx_get_int_long(const void *xp, long *ip)
00436 {
00437         cget_int_long(xp, ip, byteoff(xp));
00438         return ENOERR;
00439 }
00440 
00441 int
00442 ncx_get_int_float(const void *xp, float *ip)
00443 {
00444         ix_int xx;
00445         get_ix_int(xp, &xx);
00446         *ip = xx;
00447         if(xx > FLT_MAX || xx < (-FLT_MAX))
00448                 return NC_ERANGE;
00449         return ENOERR;
00450 }
00451 
00452 int
00453 ncx_get_int_double(const void *xp, double *ip)
00454 {
00455         ix_int xx;
00456         get_ix_int(xp, &xx);
00457         *ip = xx;
00458         return ENOERR;
00459 }
00460 
00461 int
00462 ncx_put_int_schar(void *xp, const schar *ip)
00463 {
00464         uchar *cp = xp;
00465         if(*ip & 0x80)
00466         {
00467                 *cp++ = 0xff;
00468                 *cp++ = 0xff;
00469                 *cp++ = 0xff;
00470         }
00471         else
00472         {
00473                 *cp++ = 0x00;
00474                 *cp++ = 0x00;
00475                 *cp++ = 0x00;
00476         }
00477         *cp = (uchar)*ip;
00478         return ENOERR;
00479 }
00480 
00481 int
00482 ncx_put_int_uchar(void *xp, const uchar *ip)
00483 {
00484         uchar *cp = xp;
00485         *cp++ = 0x00;
00486         *cp++ = 0x00;
00487         *cp++ = 0x00;
00488         *cp   = *ip;
00489         return ENOERR;
00490 }
00491 
00492 int
00493 ncx_put_int_short(void *xp, const short *ip)
00494 {
00495         ix_int xx = (ix_int)(*ip);
00496         return put_ix_int(xp, &xx);
00497 }
00498 
00499 int
00500 ncx_put_int_int(void *xp, const int *ip)
00501 {
00502         return put_ix_int(xp, ip);
00503 }
00504 
00505 static int
00506 cput_int_long(void *xp, const long *ip, int which)
00507 {
00508         long *wp = xp;
00509 
00510         if(which == 0)
00511         {
00512                 *wp = (*ip << 32) | (*wp & 0xffffffff);
00513         }
00514         else
00515         {
00516                 *wp = (*wp & ~0xffffffff) | (*ip & 0xffffffff);
00517         }
00518         if(*ip > X_INT_MAX || *ip < X_INT_MIN)
00519                 return NC_ERANGE;
00520         return ENOERR;
00521 }
00522 
00523 int
00524 ncx_put_int_long(void *xp, const long *ip)
00525 {
00526         return cput_int_long(xp, ip, byteoff(xp));
00527 }
00528 
00529 int
00530 ncx_put_int_float(void *xp, const float *ip)
00531 {
00532         ix_int xx = (ix_int)(*ip);
00533         const int status = put_ix_int(xp, &xx);
00534         if(status != ENOERR)
00535                 return status;
00536         if(*ip > (double)X_INT_MAX || *ip < (double)X_INT_MIN)
00537                 return NC_ERANGE;
00538         return ENOERR;
00539 }
00540 
00541 int
00542 ncx_put_int_double(void *xp, const double *ip)
00543 {
00544         ix_int xx = (ix_int)(*ip);
00545         const int status = put_ix_int(xp, &xx);
00546         if(status != ENOERR)
00547                 return status;
00548         if(*ip > X_INT_MAX || *ip < X_INT_MIN)
00549                 return NC_ERANGE;
00550         return ENOERR;
00551 }
00552  
00553 
00554 /* x_float */
00555 
00556 #if defined(NO_IEEE_FLOAT)
00557 
00558 struct cray_single {
00559         unsigned int    sign    : 1;
00560         unsigned int     exp    :15;
00561         unsigned int    mant    :48;
00562 };
00563 typedef struct cray_single cray_single;
00564 
00565 static const int cs_ieis_bias = 0x4000 - 0x7f;
00566 
00567 static const int cs_id_bias = 0x4000 - 0x3ff;
00568 
00569 #endif
00570 
00571 struct ieee_single_hi {
00572         unsigned int    sign    : 1;
00573         unsigned int     exp    : 8;
00574         unsigned int    mant    :23;
00575         unsigned int    pad     :32;
00576 };
00577 typedef struct ieee_single_hi ieee_single_hi;
00578 
00579 struct ieee_single_lo {
00580         unsigned int    pad     :32;
00581         unsigned int    sign    : 1;
00582         unsigned int     exp    : 8;
00583         unsigned int    mant    :23;
00584 };
00585 typedef struct ieee_single_lo ieee_single_lo;
00586 
00587 static const int ieee_single_bias = 0x7f;
00588 
00589 
00590 struct ieee_double {
00591         unsigned int    sign    : 1;
00592         unsigned int     exp    :11;
00593         unsigned int    mant    :52;
00594 };
00595 typedef struct ieee_double ieee_double;
00596 
00597 static const int ieee_double_bias = 0x3ff;
00598 
00599 #if FLOAT_USE_IEG
00600 
00601 static void
00602 get_ix_float(const void *xp, float *ip)
00603 {
00604         const int bo = bitoff(xp);
00605         (void) IEG2CRAY(&Cray2_F32, &One, (word *)xp, &bo, ip, &UnitStride);
00606 }
00607 
00608 static int
00609 put_ix_float(void *xp, const float *ip)
00610 {
00611         const int bo = bitoff(xp);
00612         int status = CRAY2IEG(&Cray2_F32, &One, (word *)xp, &bo, ip, &UnitStride);
00613         if(status != 0)
00614                 status = NC_ERANGE;
00615         /* else, status == 0 == ENOERR */
00616         return status;
00617 }
00618 
00619 #else
00620         /* !FLOAT_USE_IEG */
00621 
00622 #if defined(NO_IEEE_FLOAT)
00623 
00624 static void
00625 cget_float_float(const void *xp, float *ip, int which)
00626 {
00627 
00628         if(which == 0)
00629         {
00630                 const ieee_single_hi *isp = (const ieee_single_hi *) xp;
00631                 cray_single *csp = (cray_single *) ip;
00632 
00633                 if(isp->exp == 0)
00634                 {
00635                         /* ieee subnormal */
00636                         *ip = (double)isp->mant;
00637                         if(isp->mant != 0)
00638                         {
00639                                 csp->exp -= (ieee_single_bias + 22);
00640                         }
00641                 }
00642                 else
00643                 {
00644                         csp->exp  = isp->exp + cs_ieis_bias + 1;
00645                         csp->mant = isp->mant << (48 - 1 - 23);
00646                         csp->mant |= (1 << (48 - 1));
00647                 }
00648                 csp->sign = isp->sign;
00649 
00650 
00651         }
00652         else
00653         {
00654                 const ieee_single_lo *isp = (const ieee_single_lo *) xp;
00655                 cray_single *csp = (cray_single *) ip;
00656 
00657                 if(isp->exp == 0)
00658                 {
00659                         /* ieee subnormal */
00660                         *ip = (double)isp->mant;
00661                         if(isp->mant != 0)
00662                         {
00663                                 csp->exp -= (ieee_single_bias + 22);
00664                         }
00665                 }
00666                 else
00667                 {
00668                         csp->exp  = isp->exp + cs_ieis_bias + 1;
00669                         csp->mant = isp->mant << (48 - 1 - 23);
00670                         csp->mant |= (1 << (48 - 1));
00671                 }
00672                 csp->sign = isp->sign;
00673 
00674 
00675         }
00676 }
00677 
00678 static int
00679 cput_float_float(void *xp, const float *ip, int which)
00680 {
00681         int status = ENOERR;
00682         if(which == 0)
00683         {
00684                 ieee_single_hi *isp = (ieee_single_hi*)xp;
00685         const cray_single *csp = (const cray_single *) ip;
00686         int ieee_exp = csp->exp - cs_ieis_bias -1;
00687 
00688         isp->sign = csp->sign;
00689 
00690         if(ieee_exp >= 0xff
00691                         || *ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN)
00692         {
00693                 /* NC_ERANGE => ieee Inf */
00694                 isp->exp = 0xff;
00695                 isp->mant = 0x0;
00696                 return NC_ERANGE;
00697         }
00698         /* else */
00699 
00700         if(ieee_exp > 0)
00701         {
00702                 /* normal ieee representation */
00703                 isp->exp  = ieee_exp;
00704                 /* assumes cray rep is in normal form */
00705                 /* assert(csp->mant & 0x800000000000); */
00706                 isp->mant = (((csp->mant << 1) &
00707                                 0xffffffffffff) >> (48 - 23));
00708         }
00709         else if(ieee_exp > -23)
00710         {
00711                 /* ieee subnormal, right  */
00712                 const int rshift = (48 - 23 - ieee_exp);
00713 
00714                 isp->mant = csp->mant >> rshift;
00715                 isp->exp  = 0;
00716         }
00717         else
00718         {
00719                 /* smaller than ieee can represent */
00720                 isp->exp = 0;
00721                 isp->mant = 0;
00722         }
00723 
00724         }
00725         else
00726         {
00727                 ieee_single_lo *isp = (ieee_single_lo*)xp;
00728         const cray_single *csp = (const cray_single *) ip;
00729         int ieee_exp = csp->exp - cs_ieis_bias -1;
00730 
00731         isp->sign = csp->sign;
00732 
00733         if(ieee_exp >= 0xff
00734                         || *ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN)
00735         {
00736                 /* NC_ERANGE => ieee Inf */
00737                 isp->exp = 0xff;
00738                 isp->mant = 0x0;
00739                 return NC_ERANGE;
00740         }
00741         /* else */
00742 
00743         if(ieee_exp > 0)
00744         {
00745                 /* normal ieee representation */
00746                 isp->exp  = ieee_exp;
00747                 /* assumes cray rep is in normal form */
00748                 /* assert(csp->mant & 0x800000000000); */
00749                 isp->mant = (((csp->mant << 1) &
00750                                 0xffffffffffff) >> (48 - 23));
00751         }
00752         else if(ieee_exp > -23)
00753         {
00754                 /* ieee subnormal, right  */
00755                 const int rshift = (48 - 23 - ieee_exp);
00756 
00757                 isp->mant = csp->mant >> rshift;
00758                 isp->exp  = 0;
00759         }
00760         else
00761         {
00762                 /* smaller than ieee can represent */
00763                 isp->exp = 0;
00764                 isp->mant = 0;
00765         }
00766 
00767         }
00768         return ENOERR;
00769 }
00770 
00771 #define get_ix_float(xp, ip) cget_float_float((xp), (ip), byteoff(xp))
00772 #define put_ix_float(xp, ip) cput_float_float((xp), (ip), byteoff(xp))
00773 
00774 #else
00775         /* IEEE Cray with only doubles */
00776 static void
00777 cget_float_float(const void *xp, float *ip, int which)
00778 {
00779 
00780         ieee_double *idp = (ieee_double *) ip;
00781 
00782         if(which == 0)
00783         {
00784                 const ieee_single_hi *isp = (const ieee_single_hi *) xp;
00785                 if(isp->exp == 0 && isp->mant == 0)
00786                 {
00787                         idp->exp = 0;
00788                         idp->mant = 0;
00789                 }
00790                 else
00791                 {
00792                         idp->exp = isp->exp + (ieee_double_bias - ieee_single_bias);
00793                         idp->mant = isp->mant << (52 - 23);
00794                 }
00795                 idp->sign = isp->sign;
00796         }
00797         else
00798         {
00799                 const ieee_single_lo *isp = (const ieee_single_lo *) xp;
00800                 if(isp->exp == 0 && isp->mant == 0)
00801                 {
00802                         idp->exp = 0;
00803                         idp->mant = 0;
00804                 }
00805                 else
00806                 {
00807                         idp->exp = isp->exp + (ieee_double_bias - ieee_single_bias);
00808                         idp->mant = isp->mant << (52 - 23);
00809                 }
00810                 idp->sign = isp->sign;
00811         }
00812 }
00813 
00814 static int
00815 cput_float_float(void *xp, const float *ip, int which)
00816 {
00817         const ieee_double *idp = (const ieee_double *) ip;
00818         if(which == 0)
00819         {
00820                 ieee_single_hi *isp = (ieee_single_hi*)xp;
00821                 if(idp->exp > (ieee_double_bias - ieee_single_bias))
00822                         isp->exp = idp->exp - (ieee_double_bias - ieee_single_bias);
00823                 else
00824                         isp->exp = 0;
00825                 isp->mant = idp->mant >> (52 - 23);
00826                 isp->sign = idp->sign;
00827         }
00828         else
00829         {
00830                 ieee_single_lo *isp = (ieee_single_lo*)xp;
00831                 if(idp->exp > (ieee_double_bias - ieee_single_bias))
00832                         isp->exp = idp->exp - (ieee_double_bias - ieee_single_bias);
00833                 else
00834                         isp->exp = 0;
00835                 isp->mant = idp->mant >> (52 - 23);
00836                 isp->sign = idp->sign;
00837         }
00838         if(*ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN)
00839                 return NC_ERANGE;
00840         return ENOERR;
00841 }
00842 
00843 #define get_ix_float(xp, ip) cget_float_float((xp), (ip), byteoff(xp))
00844 #define put_ix_float(xp, ip) cput_float_float((xp), (ip), byteoff(xp))
00845 
00846 #endif /* NO_IEEE_FLOAT */
00847 
00848 #endif /* FLOAT_USE_IEG */
00849 
00850 
00851 int
00852 ncx_get_float_schar(const void *xp, schar *ip)
00853 {
00854         float xx;
00855         get_ix_float(xp, &xx);
00856         *ip = (schar) xx;
00857         if(xx > SCHAR_MAX || xx < SCHAR_MIN)
00858                 return NC_ERANGE;
00859         return ENOERR;
00860 }
00861 
00862 int
00863 ncx_get_float_uchar(const void *xp, uchar *ip)
00864 {
00865         float xx;
00866         get_ix_float(xp, &xx);
00867         *ip = (uchar) xx;
00868         if(xx > UCHAR_MAX || xx < 0)
00869                 return NC_ERANGE;
00870         return ENOERR;
00871 }
00872 
00873 int
00874 ncx_get_float_short(const void *xp, short *ip)
00875 {
00876         float xx;
00877         get_ix_float(xp, &xx);
00878         *ip = (short) xx;
00879         if(xx > SHORT_MAX || xx < SHORT_MIN)
00880                 return NC_ERANGE;
00881         return ENOERR;
00882 }
00883 
00884 int
00885 ncx_get_float_int(const void *xp, int *ip)
00886 {
00887         float xx;
00888         get_ix_float(xp, &xx);
00889         *ip = (int) xx;
00890         if(xx > (double)INT_MAX || xx < (double)INT_MIN)
00891                 return NC_ERANGE;
00892         return ENOERR;
00893 }
00894 
00895 int
00896 ncx_get_float_long(const void *xp, long *ip)
00897 {
00898         float xx;
00899         get_ix_float(xp, &xx);
00900         *ip = (long) xx;
00901         if(xx > LONG_MAX || xx < LONG_MIN)
00902                 return NC_ERANGE;
00903         return ENOERR;
00904 }
00905 
00906 int
00907 ncx_get_float_float(const void *xp, float *ip)
00908 {
00909         get_ix_float(xp, ip);
00910         return ENOERR;
00911 }
00912 
00913 int
00914 ncx_get_float_double(const void *xp, double *ip)
00915 {
00916 #if SIZEOF_FLOAT == SIZEOF_DOUBLE && FLT_MANT_DIG == DBL_MANT_DIG
00917         return ncx_get_float_float(xp, (float *)ip);
00918 #else
00919         float xx;
00920         get_ix_float(xp, &xx);
00921         *ip = xx;
00922         return ENOERR;
00923 #endif
00924 }
00925 
00926 
00927 int
00928 ncx_put_float_schar(void *xp, const schar *ip)
00929 {
00930         float xx = (float) *ip;
00931         return put_ix_float(xp, &xx);
00932 }
00933 
00934 int
00935 ncx_put_float_uchar(void *xp, const uchar *ip)
00936 {
00937         float xx = (float) *ip;
00938         return put_ix_float(xp, &xx);
00939 }
00940 
00941 int
00942 ncx_put_float_short(void *xp, const short *ip)
00943 {
00944         float xx = (float) *ip;
00945         return put_ix_float(xp, &xx);
00946 }
00947 
00948 int
00949 ncx_put_float_int(void *xp, const int *ip)
00950 {
00951         float xx = (float) *ip;
00952         return put_ix_float(xp, &xx);
00953 }
00954 
00955 int
00956 ncx_put_float_long(void *xp, const long *ip)
00957 {
00958         float xx = (float) *ip;
00959         return put_ix_float(xp, &xx);
00960 }
00961 
00962 int
00963 ncx_put_float_float(void *xp, const float *ip)
00964 {
00965         return put_ix_float(xp, ip);
00966 }
00967 
00968 int
00969 ncx_put_float_double(void *xp, const double *ip)
00970 {
00971 #if SIZEOF_FLOAT == SIZEOF_DOUBLE && FLT_MANT_DIG == DBL_MANT_DIG
00972         return put_ix_float(xp, (float *)ip);
00973 #else
00974         float xx = (float) *ip;
00975         int status = put_ix_float(xp, &xx);
00976         if(*ip > X_FLOAT_MAX || *ip < X_FLOAT_MIN)
00977                 return NC_ERANGE;
00978         return status;
00979 #endif
00980 }
00981 
00982 /* x_double */
00983 
00984 
00985 #if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE  && !defined(NO_IEEE_FLOAT)
00986 
00987 static void
00988 get_ix_double(const void *xp, double *ip)
00989 {
00990         (void) memcpy(ip, xp, sizeof(double));
00991 }
00992 
00993 static int
00994 put_ix_double(void *xp, const double *ip)
00995 {
00996         (void) memcpy(xp, ip, X_SIZEOF_DOUBLE);
00997         return ENOERR;
00998 }
00999 
01000 #else
01001 
01002 static void
01003 cget_double_double(const void *xp, double *ip)
01004 {
01005         const ieee_double *idp = (const ieee_double *) xp;
01006         cray_single *csp = (cray_single *) ip;
01007 
01008         if(idp->exp == 0)
01009         {
01010                 /* ieee subnormal */
01011                 *ip = (double)idp->mant;
01012                 if(idp->mant != 0)
01013                 {
01014                         csp->exp -= (ieee_double_bias + 51);
01015                 }
01016         }
01017         else
01018         {
01019                 csp->exp  = idp->exp + cs_id_bias + 1;
01020                 csp->mant = idp->mant >> (52 - 48 + 1);
01021                 csp->mant |= (1 << (48 - 1));
01022         }
01023         csp->sign = idp->sign;
01024 }
01025 
01026 static int
01027 cput_double_double(void *xp, const double *ip)
01028 {
01029         ieee_double *idp = (ieee_double *) xp;
01030         const cray_single *csp = (const cray_single *) ip;
01031 
01032         int ieee_exp = csp->exp - cs_id_bias -1;
01033 
01034         idp->sign = csp->sign;
01035 
01036         if(ieee_exp >= 0x7ff)
01037         {
01038                 /* NC_ERANGE => ieee Inf */
01039                 idp->exp = 0x7ff;
01040                 idp->mant = 0x0;
01041                 return NC_ERANGE;
01042         }
01043         /* else */
01044 
01045         if(ieee_exp > 0)
01046         {
01047                 /* normal ieee representation */
01048                 idp->exp  = ieee_exp;
01049                 /* assumes cray rep is in normal form */
01050                 assert(csp->mant & 0x800000000000);
01051                 idp->mant = (((csp->mant << 1) &
01052                                 0xffffffffffff) << (52 - 48));
01053         }
01054         else if(ieee_exp >= (-(52 -48)))
01055         {
01056                 /* ieee subnormal, left  */
01057                 const int lshift = (52 - 48) + ieee_exp;
01058                 idp->mant = csp->mant << lshift;
01059                 idp->exp  = 0;
01060         }
01061         else if(ieee_exp >= -52)
01062         {
01063                 /* ieee subnormal, right  */
01064                 const int rshift = (- (52 - 48) - ieee_exp);
01065 
01066                 idp->mant = csp->mant >> rshift;
01067                 idp->exp  = 0;
01068         }
01069         else
01070         {
01071                 /* smaller than ieee can represent */
01072                 idp->exp = 0;
01073                 idp->mant = 0;
01074         }
01075         return ENOERR;
01076 }
01077 
01078 #define get_ix_double(xp, ip) cget_double_double((xp), (ip))
01079 #define put_ix_double(xp, ip) cput_double_double((xp), (ip))
01080 
01081 #endif /* NO_IEEE_FLOAT */
01082 
01083 int
01084 ncx_get_double_schar(const void *xp, schar *ip)
01085 {
01086         double xx;
01087         get_ix_double(xp, &xx);
01088         *ip = (schar) xx;
01089         if(xx > SCHAR_MAX || xx < SCHAR_MIN)
01090                 return NC_ERANGE;
01091         return ENOERR;
01092 }
01093 
01094 int
01095 ncx_get_double_uchar(const void *xp, uchar *ip)
01096 {
01097         double xx;
01098         get_ix_double(xp, &xx);
01099         *ip = (uchar) xx;
01100         if(xx > UCHAR_MAX || xx < 0)
01101                 return NC_ERANGE;
01102         return ENOERR;
01103 }
01104 
01105 int
01106 ncx_get_double_short(const void *xp, short *ip)
01107 {
01108         double xx;
01109         get_ix_double(xp, &xx);
01110         *ip = (short) xx;
01111         if(xx > SHORT_MAX || xx < SHORT_MIN)
01112                 return NC_ERANGE;
01113         return ENOERR;
01114 }
01115 
01116 int
01117 ncx_get_double_int(const void *xp, int *ip)
01118 {
01119         double xx;
01120         get_ix_double(xp, &xx);
01121         *ip = (int) xx;
01122         if(xx > INT_MAX || xx < INT_MIN)
01123                 return NC_ERANGE;
01124         return ENOERR;
01125 }
01126 
01127 int
01128 ncx_get_double_long(const void *xp, long *ip)
01129 {
01130         double xx;
01131         get_ix_double(xp, &xx);
01132         *ip = (long) xx;
01133         if(xx > LONG_MAX || xx < LONG_MIN)
01134                 return NC_ERANGE;
01135         return ENOERR;
01136 }
01137 
01138 int
01139 ncx_get_double_float(const void *xp, float *ip)
01140 {
01141 #if SIZEOF_FLOAT == SIZEOF_DOUBLE && FLT_MANT_DIG == DBL_MANT_DIG
01142         get_ix_double(xp, (double *)ip);
01143         return ENOERR;
01144 #else
01145         double xx;
01146         get_ix_double(xp, &xx);
01147         if(xx > FLT_MAX || xx < (-FLT_MAX))
01148         {
01149                 *ip = FLT_MAX;
01150                 return NC_ERANGE;
01151         }
01152         if(xx < (-FLT_MAX))
01153         {
01154                 *ip = (-FLT_MAX);
01155                 return NC_ERANGE;
01156         }
01157         *ip = (float) xx;
01158         return ENOERR;
01159 #endif
01160 }
01161 
01162 int
01163 ncx_get_double_double(const void *xp, double *ip)
01164 {
01165         get_ix_double(xp, ip);
01166         return ENOERR;
01167 }
01168 
01169 
01170 int
01171 ncx_put_double_schar(void *xp, const schar *ip)
01172 {
01173         double xx = (double) *ip;
01174         put_ix_double(xp, &xx);
01175         return ENOERR;
01176 }
01177 
01178 int
01179 ncx_put_double_uchar(void *xp, const uchar *ip)
01180 {
01181         double xx = (double) *ip;
01182         put_ix_double(xp, &xx);
01183         return ENOERR;
01184 }
01185 
01186 int
01187 ncx_put_double_short(void *xp, const short *ip)
01188 {
01189         double xx = (double) *ip;
01190         put_ix_double(xp, &xx);
01191         return ENOERR;
01192 }
01193 
01194 int
01195 ncx_put_double_int(void *xp, const int *ip)
01196 {
01197         double xx = (double) *ip;
01198         put_ix_double(xp, &xx);
01199         return ENOERR;
01200 }
01201 
01202 int
01203 ncx_put_double_long(void *xp, const long *ip)
01204 {
01205         double xx = (double) *ip;
01206         put_ix_double(xp, &xx);
01207         /* TODO: Deal with big guys */
01208         return ENOERR;
01209 }
01210 
01211 int
01212 ncx_put_double_float(void *xp, const float *ip)
01213 {
01214 #if SIZEOF_FLOAT == SIZEOF_DOUBLE && FLT_MANT_DIG == DBL_MANT_DIG
01215         put_ix_double(xp, (double *)ip);
01216         return ENOERR;
01217 #else
01218         double xx = (double) *ip;
01219         return put_ix_double(xp, &xx);
01220 #endif
01221 }
01222 
01223 int
01224 ncx_put_double_double(void *xp, const double *ip)
01225 {
01226 #if !defined(NO_IEEE_FLOAT)
01227         put_ix_double(xp, ip);
01228         return ENOERR;
01229 #else
01230         return put_ix_double(xp, ip);
01231 #endif
01232 }
01233 
01234 
01235 /* x_size_t */
01236 
01237 int
01238 ncx_put_size_t(void **xpp, const size_t *ulp)
01239 {
01240         /* similar to put_ix_int() */
01241         uchar *cp = *xpp;
01242                 /* sizes limited to 2^31 -1 in netcdf */
01243         assert(*ulp <= X_SIZE_MAX && (long) (*ulp) >= 0);
01244 
01245         *cp++ = (uchar)((*ulp) >> 24);
01246         *cp++ = (uchar)(((*ulp) & 0x00ff0000) >> 16);
01247         *cp++ = (uchar)(((*ulp) & 0x0000ff00) >>  8);
01248         *cp   = (uchar)((*ulp) & 0x000000ff);
01249 
01250         *xpp = (void *)((char *)(*xpp) + X_SIZEOF_SIZE_T);
01251         return ENOERR;
01252 }
01253 
01254 int
01255 ncx_get_size_t(const void **xpp,  size_t *ulp)
01256 {
01257         /* similar to get_ix_int */
01258         const uchar *cp = *xpp;
01259         assert((*cp & 0x80) == 0); /* sizes limited to 2^31 -1 in netcdf */
01260 
01261         *ulp = *cp++ << 24;
01262         *ulp |= (*cp++ << 16);
01263         *ulp |= (*cp++ << 8);
01264         *ulp |= *cp; 
01265 
01266         *xpp = (const void *)((const char *)(*xpp) + X_SIZEOF_SIZE_T);
01267         return ENOERR;
01268 }
01269 
01270 /* x_off_t */
01271 
01272 int
01273 ncx_put_off_t(void **xpp, const off_t *lp)
01274 {
01275         /* similar to put_ix_int() */
01276         uchar *cp = *xpp;
01277                 /* No negative offsets stored in netcdf */
01278         assert(*lp >= 0 && *lp <= X_OFF_MAX);
01279 
01280         *cp++ = (uchar)((*lp) >> 24);
01281         *cp++ = (uchar)(((*lp) & 0x00ff0000) >> 16);
01282         *cp++ = (uchar)(((*lp) & 0x0000ff00) >>  8);
01283         *cp   = (uchar)((*lp) & 0x000000ff);
01284 
01285         *xpp = (void *)((char *)(*xpp) + X_SIZEOF_OFF_T);
01286         return ENOERR;
01287 }
01288 
01289 int
01290 ncx_get_off_t(const void **xpp, off_t *lp)
01291 {
01292         /* similar to get_ix_int() */
01293         const uchar *cp = *xpp;
01294         assert((*cp & 0x80) == 0); /* No negative offsets stored in netcdf */
01295 
01296         *lp = *cp++ << 24;
01297         *lp |= (*cp++ << 16);
01298         *lp |= (*cp++ << 8);
01299         *lp |= *cp; 
01300 
01301         *xpp = (const void *)((const char *)(*xpp) + X_SIZEOF_OFF_T);
01302         return ENOERR;
01303 }
01304 
01305 
01306 /*
01307  * Aggregate numeric conversion functions.
01308  */
01309 
01310 
01311 
01312 /* schar */
01313 
01314 int
01315 ncx_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
01316 {
01317                 (void) memcpy(tp, *xpp, nelems);
01318         *xpp = (void *)((char *)(*xpp) + nelems);
01319         return ENOERR;
01320 
01321 }
01322 int
01323 ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
01324 {
01325                 (void) memcpy(tp, *xpp, nelems);
01326         *xpp = (void *)((char *)(*xpp) + nelems);
01327         return ENOERR;
01328 
01329 }
01330 int
01331 ncx_getn_schar_short(const void **xpp, size_t nelems, short *tp)
01332 {
01333         schar *xp = (schar *)(*xpp);
01334 
01335         while(nelems-- != 0)
01336         {
01337                 *tp++ = *xp++;
01338         }
01339 
01340         *xpp = (const void *)xp;
01341         return ENOERR;
01342 }
01343 
01344 int
01345 ncx_getn_schar_int(const void **xpp, size_t nelems, int *tp)
01346 {
01347         schar *xp = (schar *)(*xpp);
01348 
01349         while(nelems-- != 0)
01350         {
01351                 *tp++ = *xp++;
01352         }
01353 
01354         *xpp = (const void *)xp;
01355         return ENOERR;
01356 }
01357 
01358 int
01359 ncx_getn_schar_long(const void **xpp, size_t nelems, long *tp)
01360 {
01361         schar *xp = (schar *)(*xpp);
01362 
01363         while(nelems-- != 0)
01364         {
01365                 *tp++ = *xp++;
01366         }
01367 
01368         *xpp = (const void *)xp;
01369         return ENOERR;
01370 }
01371 
01372 int
01373 ncx_getn_schar_float(const void **xpp, size_t nelems, float *tp)
01374 {
01375         schar *xp = (schar *)(*xpp);
01376 
01377         while(nelems-- != 0)
01378         {
01379                 *tp++ = *xp++;
01380         }
01381 
01382         *xpp = (const void *)xp;
01383         return ENOERR;
01384 }
01385 
01386 int
01387 ncx_getn_schar_double(const void **xpp, size_t nelems, double *tp)
01388 {
01389         schar *xp = (schar *)(*xpp);
01390 
01391         while(nelems-- != 0)
01392         {
01393                 *tp++ = *xp++;
01394         }
01395 
01396         *xpp = (const void *)xp;
01397         return ENOERR;
01398 }
01399 
01400 
01401 int
01402 ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *tp)
01403 {
01404                 size_t rndup = nelems % X_ALIGN;
01405 
01406         if(rndup)
01407                 rndup = X_ALIGN - rndup;
01408 
01409         (void) memcpy(tp, *xpp, nelems);
01410         *xpp = (void *)((char *)(*xpp) + nelems + rndup);
01411 
01412         return ENOERR;
01413 
01414 }
01415 int
01416 ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *tp)
01417 {
01418                 size_t rndup = nelems % X_ALIGN;
01419 
01420         if(rndup)
01421                 rndup = X_ALIGN - rndup;
01422 
01423         (void) memcpy(tp, *xpp, nelems);
01424         *xpp = (void *)((char *)(*xpp) + nelems + rndup);
01425 
01426         return ENOERR;
01427 
01428 }
01429 int
01430 ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *tp)
01431 {
01432         size_t rndup = nelems % X_ALIGN;
01433         schar *xp = (schar *)(*xpp);
01434 
01435         if(rndup)
01436                 rndup = X_ALIGN - rndup;
01437 
01438         while(nelems-- != 0)
01439         {
01440                 *tp++ = *xp++;
01441         }
01442 
01443         *xpp = (void *)(xp + rndup);
01444         return ENOERR;
01445 }
01446 
01447 int
01448 ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *tp)
01449 {
01450         size_t rndup = nelems % X_ALIGN;
01451         schar *xp = (schar *)(*xpp);
01452 
01453         if(rndup)
01454                 rndup = X_ALIGN - rndup;
01455 
01456         while(nelems-- != 0)
01457         {
01458                 *tp++ = *xp++;
01459         }
01460 
01461         *xpp = (void *)(xp + rndup);
01462         return ENOERR;
01463 }
01464 
01465 int
01466 ncx_pad_getn_schar_long(const void **xpp, size_t nelems, long *tp)
01467 {
01468         size_t rndup = nelems % X_ALIGN;
01469         schar *xp = (schar *)(*xpp);
01470 
01471         if(rndup)
01472                 rndup = X_ALIGN - rndup;
01473 
01474         while(nelems-- != 0)
01475         {
01476                 *tp++ = *xp++;
01477         }
01478 
01479         *xpp = (void *)(xp + rndup);
01480         return ENOERR;
01481 }
01482 
01483 int
01484 ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *tp)
01485 {
01486         size_t rndup = nelems % X_ALIGN;
01487         schar *xp = (schar *)(*xpp);
01488 
01489         if(rndup)
01490                 rndup = X_ALIGN - rndup;
01491 
01492         while(nelems-- != 0)
01493         {
01494                 *tp++ = *xp++;
01495         }
01496 
01497         *xpp = (void *)(xp + rndup);
01498         return ENOERR;
01499 }
01500 
01501 int
01502 ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *tp)
01503 {
01504         size_t rndup = nelems % X_ALIGN;
01505         schar *xp = (schar *)(*xpp);
01506 
01507         if(rndup)
01508                 rndup = X_ALIGN - rndup;
01509 
01510         while(nelems-- != 0)
01511         {
01512                 *tp++ = *xp++;
01513         }
01514 
01515         *xpp = (void *)(xp + rndup);
01516         return ENOERR;
01517 }
01518 
01519 
01520 int
01521 ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *tp)
01522 {
01523                 (void) memcpy(*xpp, tp, nelems);
01524         *xpp = (void *)((char *)(*xpp) + nelems);
01525 
01526         return ENOERR;
01527 
01528 }
01529 int
01530 ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp)
01531 {
01532                 (void) memcpy(*xpp, tp, nelems);
01533         *xpp = (void *)((char *)(*xpp) + nelems);
01534 
01535         return ENOERR;
01536 
01537 }
01538 int
01539 ncx_putn_schar_short(void **xpp, size_t nelems, const short *tp)
01540 {
01541         int status = ENOERR;
01542         schar *xp = (schar *)(*xpp);
01543 
01544         while(nelems-- != 0)
01545         {
01546                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01547                         status = NC_ERANGE;
01548                 *xp++ = (schar) *tp++;
01549         }
01550 
01551         *xpp = (void *)xp;
01552         return status;
01553 }
01554 
01555 int
01556 ncx_putn_schar_int(void **xpp, size_t nelems, const int *tp)
01557 {
01558         int status = ENOERR;
01559         schar *xp = (schar *)(*xpp);
01560 
01561         while(nelems-- != 0)
01562         {
01563                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01564                         status = NC_ERANGE;
01565                 *xp++ = (schar) *tp++;
01566         }
01567 
01568         *xpp = (void *)xp;
01569         return status;
01570 }
01571 
01572 int
01573 ncx_putn_schar_long(void **xpp, size_t nelems, const long *tp)
01574 {
01575         int status = ENOERR;
01576         schar *xp = (schar *)(*xpp);
01577 
01578         while(nelems-- != 0)
01579         {
01580                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01581                         status = NC_ERANGE;
01582                 *xp++ = (schar) *tp++;
01583         }
01584 
01585         *xpp = (void *)xp;
01586         return status;
01587 }
01588 
01589 int
01590 ncx_putn_schar_float(void **xpp, size_t nelems, const float *tp)
01591 {
01592         int status = ENOERR;
01593         schar *xp = (schar *)(*xpp);
01594 
01595         while(nelems-- != 0)
01596         {
01597                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01598                         status = NC_ERANGE;
01599                 *xp++ = (schar) *tp++;
01600         }
01601 
01602         *xpp = (void *)xp;
01603         return status;
01604 }
01605 
01606 int
01607 ncx_putn_schar_double(void **xpp, size_t nelems, const double *tp)
01608 {
01609         int status = ENOERR;
01610         schar *xp = (schar *)(*xpp);
01611 
01612         while(nelems-- != 0)
01613         {
01614                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01615                         status = NC_ERANGE;
01616                 *xp++ = (schar) *tp++;
01617         }
01618 
01619         *xpp = (void *)xp;
01620         return status;
01621 }
01622 
01623 
01624 int
01625 ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *tp)
01626 {
01627                 size_t rndup = nelems % X_ALIGN;
01628 
01629         if(rndup)
01630                 rndup = X_ALIGN - rndup;
01631 
01632         (void) memcpy(*xpp, tp, nelems);
01633         *xpp = (void *)((char *)(*xpp) + nelems);
01634 
01635         if(rndup)
01636         {
01637                 (void) memcpy(*xpp, nada, rndup);
01638                 *xpp = (void *)((char *)(*xpp) + rndup);
01639         }
01640         
01641         return ENOERR;
01642 
01643 }
01644 int
01645 ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *tp)
01646 {
01647                 size_t rndup = nelems % X_ALIGN;
01648 
01649         if(rndup)
01650                 rndup = X_ALIGN - rndup;
01651 
01652         (void) memcpy(*xpp, tp, nelems);
01653         *xpp = (void *)((char *)(*xpp) + nelems);
01654 
01655         if(rndup)
01656         {
01657                 (void) memcpy(*xpp, nada, rndup);
01658                 *xpp = (void *)((char *)(*xpp) + rndup);
01659         }
01660         
01661         return ENOERR;
01662 
01663 }
01664 int
01665 ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *tp)
01666 {
01667         int status = ENOERR;
01668         size_t rndup = nelems % X_ALIGN;
01669         schar *xp = (schar *)(*xpp);
01670 
01671         if(rndup)
01672                 rndup = X_ALIGN - rndup;
01673 
01674         while(nelems-- != 0)
01675         {
01676                 /* N.B. schar as signed */
01677                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01678                         status = NC_ERANGE;
01679                 *xp++ = (schar) *tp++;
01680         }
01681 
01682 
01683         if(rndup)
01684         {
01685                 (void) memcpy(xp, nada, rndup);
01686                 xp += rndup;
01687         }
01688 
01689         *xpp = (void *)xp;
01690         return status;
01691 }
01692 
01693 int
01694 ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *tp)
01695 {
01696         int status = ENOERR;
01697         size_t rndup = nelems % X_ALIGN;
01698         schar *xp = (schar *)(*xpp);
01699 
01700         if(rndup)
01701                 rndup = X_ALIGN - rndup;
01702 
01703         while(nelems-- != 0)
01704         {
01705                 /* N.B. schar as signed */
01706                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01707                         status = NC_ERANGE;
01708                 *xp++ = (schar) *tp++;
01709         }
01710 
01711 
01712         if(rndup)
01713         {
01714                 (void) memcpy(xp, nada, rndup);
01715                 xp += rndup;
01716         }
01717 
01718         *xpp = (void *)xp;
01719         return status;
01720 }
01721 
01722 int
01723 ncx_pad_putn_schar_long(void **xpp, size_t nelems, const long *tp)
01724 {
01725         int status = ENOERR;
01726         size_t rndup = nelems % X_ALIGN;
01727         schar *xp = (schar *)(*xpp);
01728 
01729         if(rndup)
01730                 rndup = X_ALIGN - rndup;
01731 
01732         while(nelems-- != 0)
01733         {
01734                 /* N.B. schar as signed */
01735                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01736                         status = NC_ERANGE;
01737                 *xp++ = (schar) *tp++;
01738         }
01739 
01740 
01741         if(rndup)
01742         {
01743                 (void) memcpy(xp, nada, rndup);
01744                 xp += rndup;
01745         }
01746 
01747         *xpp = (void *)xp;
01748         return status;
01749 }
01750 
01751 int
01752 ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *tp)
01753 {
01754         int status = ENOERR;
01755         size_t rndup = nelems % X_ALIGN;
01756         schar *xp = (schar *)(*xpp);
01757 
01758         if(rndup)
01759                 rndup = X_ALIGN - rndup;
01760 
01761         while(nelems-- != 0)
01762         {
01763                 /* N.B. schar as signed */
01764                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01765                         status = NC_ERANGE;
01766                 *xp++ = (schar) *tp++;
01767         }
01768 
01769 
01770         if(rndup)
01771         {
01772                 (void) memcpy(xp, nada, rndup);
01773                 xp += rndup;
01774         }
01775 
01776         *xpp = (void *)xp;
01777         return status;
01778 }
01779 
01780 int
01781 ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *tp)
01782 {
01783         int status = ENOERR;
01784         size_t rndup = nelems % X_ALIGN;
01785         schar *xp = (schar *)(*xpp);
01786 
01787         if(rndup)
01788                 rndup = X_ALIGN - rndup;
01789 
01790         while(nelems-- != 0)
01791         {
01792                 /* N.B. schar as signed */
01793                 if(*tp > X_SCHAR_MAX || *tp < X_SCHAR_MIN)
01794                         status = NC_ERANGE;
01795                 *xp++ = (schar) *tp++;
01796         }
01797 
01798 
01799         if(rndup)
01800         {
01801                 (void) memcpy(xp, nada, rndup);
01802                 xp += rndup;
01803         }
01804 
01805         *xpp = (void *)xp;
01806         return status;
01807 }
01808 
01809 
01810 
01811 /* short */
01812 
01813 int
01814 ncx_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
01815 {
01816         const char *xp = *xpp;
01817         int status = ENOERR;
01818 
01819         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
01820         {
01821                 const int lstatus = ncx_get_short_schar(xp, tp);
01822                 if(lstatus != ENOERR)
01823                         status = lstatus;
01824         }
01825 
01826         *xpp = (const void *)xp;
01827         return status;
01828 }
01829 
01830 int
01831 ncx_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
01832 {
01833         const char *xp = *xpp;
01834         int status = ENOERR;
01835 
01836         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
01837         {
01838                 const int lstatus = ncx_get_short_uchar(xp, tp);
01839                 if(lstatus != ENOERR)
01840                         status = lstatus;
01841         }
01842 
01843         *xpp = (const void *)xp;
01844         return status;
01845 }
01846 
01847 #if SHORT_USE_IEG
01848 int
01849 ncx_getn_short_short(const void **xpp, size_t nelems, short *tp)
01850 {
01851         if(nelems > 0)
01852         {
01853                 const int bo = bitoff(*xpp);
01854                 const word *wp = *xpp;
01855                 int ierr;
01856                 *xpp = ((const char *) (*xpp) + nelems * X_SIZEOF_SHORT);
01857                 ierr = IEG2CRAY(&Cray2_I16, &nelems, wp,
01858                                 &bo, tp, &UnitStride);
01859                 assert(ierr >= 0);
01860                 if(ierr > 0)
01861                         return NC_ERANGE;
01862         }
01863         return ENOERR;
01864 }
01865 #else
01866 int
01867 ncx_getn_short_short(const void **xpp, const size_t nelems, short *tp)
01868 {
01869         if(nelems > 0)
01870         {
01871         const word *wp = *xpp;
01872         const short *const last = &tp[nelems -1];
01873         const int rem = word_align(*xpp)/X_SIZEOF_SHORT;
01874         *xpp = ((const char *) (*xpp) + nelems * X_SIZEOF_SHORT);
01875 
01876         switch(rem) {
01877         case 3:
01878                 *tp = (short)((*wp >> 32) & 0xffff);
01879                 if(*tp & 0x8000)
01880                         *tp |= (~(0xffff));
01881                 if(tp == last)
01882                         return ENOERR;
01883                 tp++;
01884                 /*FALLTHRU*/    
01885         case 2:
01886                 *tp = (short)((*wp >> 16) & 0xffff);
01887                 if(*tp & 0x8000)
01888                         *tp |= (~(0xffff));
01889                 if(tp == last)
01890                         return ENOERR;
01891                 tp++;
01892                 /*FALLTHRU*/    
01893         case 1:
01894                 *tp = (short)(*wp & 0xffff);
01895                 if(*tp & 0x8000)
01896                         *tp |= (~(0xffff));
01897                 if(tp == last)
01898                         return ENOERR;
01899                 tp++;
01900                 wp++; /* Note Bene */
01901                 /*FALLTHRU*/    
01902         }
01903 
01904         assert((nelems - rem) != 0);
01905         {
01906                 const int nwords = ((nelems - rem) * X_SIZEOF_SHORT)
01907                                         / sizeof(word);
01908                 const word *const endw = &wp[nwords];
01909 
01910 #pragma _CRI ivdep
01911                 for( ; wp < endw; wp++)
01912                 {
01913 
01914                         *tp = (short)(*wp >> 48);
01915                         if(*tp & 0x8000)
01916                                 *tp |= (~(0xffff));
01917                         tp++;
01918 
01919                         *tp = (short)((*wp >> 32) & 0xffff);
01920                         if(*tp & 0x8000)
01921                                 *tp |= (~(0xffff));
01922                         tp++;
01923 
01924                         *tp = (short)((*wp >> 16) & 0xffff);
01925                         if(*tp & 0x8000)
01926                                 *tp |= (~(0xffff));
01927                         tp++;
01928 
01929                         *tp = (short)(*wp & 0xffff);
01930                         if(*tp & 0x8000)
01931                                 *tp |= (~(0xffff));
01932                         tp++;
01933                 }
01934         }
01935 
01936         if(tp <= last)
01937         {
01938                 *tp = (short)(*wp >> 48);
01939                 if(*tp & 0x8000)
01940                         *tp |= (~(0xffff));
01941                 tp++;
01942         }
01943         if(tp <= last)
01944         {
01945                 *tp = (short)((*wp >> 32) & 0xffff);
01946                 if(*tp & 0x8000)
01947                         *tp |= (~(0xffff));
01948                 tp++;
01949         }
01950         if(tp <= last)
01951         {
01952                 *tp = (short)((*wp >> 16) & 0xffff);
01953                 if(*tp & 0x8000)
01954                         *tp |= (~(0xffff));
01955                 tp++;
01956         }
01957 
01958         }
01959         return ENOERR;
01960 }
01961 #endif
01962 
01963 int
01964 ncx_getn_short_int(const void **xpp, size_t nelems, int *tp)
01965 {
01966         const char *xp = *xpp;
01967         int status = ENOERR;
01968 
01969         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
01970         {
01971                 const int lstatus = ncx_get_short_int(xp, tp);
01972                 if(lstatus != ENOERR)
01973                         status = lstatus;
01974         }
01975 
01976         *xpp = (const void *)xp;
01977         return status;
01978 }
01979 
01980 int
01981 ncx_getn_short_long(const void **xpp, size_t nelems, long *tp)
01982 {
01983         const char *xp = *xpp;
01984         int status = ENOERR;
01985 
01986         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
01987         {
01988                 const int lstatus = ncx_get_short_long(xp, tp);
01989                 if(lstatus != ENOERR)
01990                         status = lstatus;
01991         }
01992 
01993         *xpp = (const void *)xp;
01994         return status;
01995 }
01996 
01997 int
01998 ncx_getn_short_float(const void **xpp, size_t nelems, float *tp)
01999 {
02000         const char *xp = *xpp;
02001         int status = ENOERR;
02002 
02003         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02004         {
02005                 const int lstatus = ncx_get_short_float(xp, tp);
02006                 if(lstatus != ENOERR)
02007                         status = lstatus;
02008         }
02009 
02010         *xpp = (const void *)xp;
02011         return status;
02012 }
02013 
02014 int
02015 ncx_getn_short_double(const void **xpp, size_t nelems, double *tp)
02016 {
02017         const char *xp = *xpp;
02018         int status = ENOERR;
02019 
02020         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02021         {
02022                 const int lstatus = ncx_get_short_double(xp, tp);
02023                 if(lstatus != ENOERR)
02024                         status = lstatus;
02025         }
02026 
02027         *xpp = (const void *)xp;
02028         return status;
02029 }
02030 
02031 
02032 int
02033 ncx_pad_getn_short_schar(const void **xpp, size_t nelems, schar *tp)
02034 {
02035         const size_t rndup = nelems % 2;
02036 
02037         const char *xp = *xpp;
02038         int status = ENOERR;
02039 
02040         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02041         {
02042                 const int lstatus = ncx_get_short_schar(xp, tp);
02043                 if(lstatus != ENOERR)
02044                         status = lstatus;
02045         }
02046 
02047         if(rndup != 0)
02048                 xp += X_SIZEOF_SHORT;
02049                 
02050         *xpp = (void *)xp;
02051         return status;
02052 }
02053 
02054 int
02055 ncx_pad_getn_short_uchar(const void **xpp, size_t nelems, uchar *tp)
02056 {
02057         const size_t rndup = nelems % 2;
02058 
02059         const char *xp = *xpp;
02060         int status = ENOERR;
02061 
02062         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02063         {
02064                 const int lstatus = ncx_get_short_uchar(xp, tp);
02065                 if(lstatus != ENOERR)
02066                         status = lstatus;
02067         }
02068 
02069         if(rndup != 0)
02070                 xp += X_SIZEOF_SHORT;
02071                 
02072         *xpp = (void *)xp;
02073         return status;
02074 }
02075 
02076 int
02077 ncx_pad_getn_short_short(const void **xpp, size_t nelems, short *tp)
02078 {
02079         const size_t rndup = nelems % 2;
02080 
02081         const int status = ncx_getn_short_short(xpp, nelems, tp);
02082 
02083         if(rndup != 0)
02084         {
02085                 *xpp = ((char *) (*xpp) + X_SIZEOF_SHORT);
02086         }
02087                 
02088         return status;
02089 }
02090 
02091 int
02092 ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *tp)
02093 {
02094         const size_t rndup = nelems % 2;
02095 
02096         const char *xp = *xpp;
02097         int status = ENOERR;
02098 
02099         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02100         {
02101                 const int lstatus = ncx_get_short_int(xp, tp);
02102                 if(lstatus != ENOERR)
02103                         status = lstatus;
02104         }
02105 
02106         if(rndup != 0)
02107                 xp += X_SIZEOF_SHORT;
02108                 
02109         *xpp = (void *)xp;
02110         return status;
02111 }
02112 
02113 int
02114 ncx_pad_getn_short_long(const void **xpp, size_t nelems, long *tp)
02115 {
02116         const size_t rndup = nelems % 2;
02117 
02118         const char *xp = *xpp;
02119         int status = ENOERR;
02120 
02121         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02122         {
02123                 const int lstatus = ncx_get_short_long(xp, tp);
02124                 if(lstatus != ENOERR)
02125                         status = lstatus;
02126         }
02127 
02128         if(rndup != 0)
02129                 xp += X_SIZEOF_SHORT;
02130                 
02131         *xpp = (void *)xp;
02132         return status;
02133 }
02134 
02135 int
02136 ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *tp)
02137 {
02138         const size_t rndup = nelems % 2;
02139 
02140         const char *xp = *xpp;
02141         int status = ENOERR;
02142 
02143         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02144         {
02145                 const int lstatus = ncx_get_short_float(xp, tp);
02146                 if(lstatus != ENOERR)
02147                         status = lstatus;
02148         }
02149 
02150         if(rndup != 0)
02151                 xp += X_SIZEOF_SHORT;
02152                 
02153         *xpp = (void *)xp;
02154         return status;
02155 }
02156 
02157 int
02158 ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *tp)
02159 {
02160         const size_t rndup = nelems % 2;
02161 
02162         const char *xp = *xpp;
02163         int status = ENOERR;
02164 
02165         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02166         {
02167                 const int lstatus = ncx_get_short_double(xp, tp);
02168                 if(lstatus != ENOERR)
02169                         status = lstatus;
02170         }
02171 
02172         if(rndup != 0)
02173                 xp += X_SIZEOF_SHORT;
02174                 
02175         *xpp = (void *)xp;
02176         return status;
02177 }
02178 
02179 
02180 int
02181 ncx_putn_short_schar(void **xpp, size_t nelems, const schar *tp)
02182 {
02183         char *xp = *xpp;
02184         int status = ENOERR;
02185 
02186         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02187         {
02188                 const int lstatus = ncx_put_short_schar(xp, tp);
02189                 if(lstatus != ENOERR)
02190                         status = lstatus;
02191         }
02192 
02193         *xpp = (void *)xp;
02194         return status;
02195 }
02196 
02197 int
02198 ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp)
02199 {
02200         char *xp = *xpp;
02201         int status = ENOERR;
02202 
02203         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02204         {
02205                 const int lstatus = ncx_put_short_uchar(xp, tp);
02206                 if(lstatus != ENOERR)
02207                         status = lstatus;
02208         }
02209 
02210         *xpp = (void *)xp;
02211         return status;
02212 }
02213 
02214 #if SHORT_USE_IEG
02215 int
02216 ncx_putn_short_short(void **xpp, size_t nelems, const short *tp)
02217 {
02218         if(nelems > 0)
02219         {
02220                 word *wp = *xpp;
02221                 const int bo = bitoff(*xpp);
02222                 int ierr;
02223         
02224                 *xpp = ((char *) (*xpp) + nelems * X_SIZEOF_SHORT);
02225         
02226                 ierr = CRAY2IEG(&Cray2_I16, &nelems, wp,
02227                                 &bo, tp, &UnitStride);
02228                 assert(ierr >= 0);
02229                 if(ierr > 0)
02230                         return NC_ERANGE;
02231         }
02232         return ENOERR;
02233 }
02234 #else
02235 int
02236 ncx_putn_short_short(void **xpp, const size_t nelems, const short *tp)
02237 {
02238         int status = ENOERR;
02239         if(nelems == 0)
02240                 return status;
02241 {
02242         word *wp = *xpp;
02243         const short *const last = &tp[nelems -1];
02244         const int rem = word_align(*xpp)/X_SIZEOF_SHORT;
02245         *xpp = ((char *) (*xpp) + nelems * X_SIZEOF_SHORT);
02246 
02247         switch(rem) {
02248         case 3:
02249                 *wp = ((*tp << 32) & 0x0000ffff00000000)
02250                             | (*wp & 0xffff0000ffffffff);
02251                 if(*tp > X_SHORT_MAX || *tp < X_SHORT_MIN)
02252                         status = NC_ERANGE;
02253                 if(tp == last)
02254                         return status;
02255                 tp++;
02256                 /*FALLTHRU*/    
02257         case 2:
02258                 *wp = ((*tp << 16) & 0x00000000ffff0000)
02259                             | (*wp & 0xffffffff0000ffff);
02260                 if(*tp > X_SHORT_MAX || *tp < X_SHORT_MIN)
02261                         status = NC_ERANGE;
02262                 if(tp == last)
02263                         return status;
02264                 tp++;
02265                 /*FALLTHRU*/    
02266         case 1:
02267                 *wp = (*tp         & 0x000000000000ffff)   
02268                             | (*wp & 0xffffffffffff0000);
02269                 if(*tp > X_SHORT_MAX || *tp < X_SHORT_MIN)
02270                         status = NC_ERANGE;
02271                 if(tp == last)
02272                         return status;
02273                 tp++;
02274                 wp++; /* Note Bene */
02275                 /*FALLTHRU*/    
02276         }
02277 
02278         assert((nelems - rem) != 0);
02279         {
02280                 const int nwords = ((nelems - rem) * X_SIZEOF_SHORT)
02281                                         / sizeof(word);
02282                 const word *const endw = &wp[nwords];
02283 
02284 #pragma _CRI ivdep
02285                 for( ; wp < endw; wp++)
02286                 {
02287                         *wp =      (*tp      << 48)
02288                                 | ((*(tp +1) << 32) & 0x0000ffff00000000)
02289                                 | ((*(tp +2) << 16) & 0x00000000ffff0000)
02290                                 | ((*(tp +3)      ) & 0x000000000000ffff);
02291 
02292                         { int ii = 0;
02293                         for(; ii < 4; ii++, tp++)
02294                                 if(*tp > X_SHORT_MAX || *tp < X_SHORT_MIN)
02295                                         status = NC_ERANGE;
02296                         }
02297                 }
02298         }
02299 
02300         if(tp <= last)
02301         {
02302                 *wp = (*tp << 48)
02303                             | (*wp & 0x0000ffffffffffff);
02304                 if(*tp > X_SHORT_MAX || *tp < X_SHORT_MIN)
02305                         status = NC_ERANGE;
02306                 tp++;
02307         }
02308         if(tp <= last)
02309         {
02310                 *wp = ((*tp << 32) & 0x0000ffff00000000)
02311                             | (*wp & 0xffff0000ffffffff);
02312                 if(*tp > X_SHORT_MAX || *tp < X_SHORT_MIN)
02313                         status = NC_ERANGE;
02314                 tp++;
02315         }
02316         if(tp <= last)
02317         {
02318                 *wp = ((*tp << 16) & 0x00000000ffff0000)
02319                             | (*wp & 0xffffffff0000ffff);
02320                 if(*tp > X_SHORT_MAX || *tp < X_SHORT_MIN)
02321                         status = NC_ERANGE;
02322         }
02323 
02324         return status;
02325 }
02326 }
02327 #endif
02328 
02329 int
02330 ncx_putn_short_int(void **xpp, size_t nelems, const int *tp)
02331 {
02332         char *xp = *xpp;
02333         int status = ENOERR;
02334 
02335         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02336         {
02337                 const int lstatus = ncx_put_short_int(xp, tp);
02338                 if(lstatus != ENOERR)
02339                         status = lstatus;
02340         }
02341 
02342         *xpp = (void *)xp;
02343         return status;
02344 }
02345 
02346 int
02347 ncx_putn_short_long(void **xpp, size_t nelems, const long *tp)
02348 {
02349         char *xp = *xpp;
02350         int status = ENOERR;
02351 
02352         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02353         {
02354                 const int lstatus = ncx_put_short_long(xp, tp);
02355                 if(lstatus != ENOERR)
02356                         status = lstatus;
02357         }
02358 
02359         *xpp = (void *)xp;
02360         return status;
02361 }
02362 
02363 int
02364 ncx_putn_short_float(void **xpp, size_t nelems, const float *tp)
02365 {
02366         char *xp = *xpp;
02367         int status = ENOERR;
02368 
02369         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02370         {
02371                 const int lstatus = ncx_put_short_float(xp, tp);
02372                 if(lstatus != ENOERR)
02373                         status = lstatus;
02374         }
02375 
02376         *xpp = (void *)xp;
02377         return status;
02378 }
02379 
02380 int
02381 ncx_putn_short_double(void **xpp, size_t nelems, const double *tp)
02382 {
02383         char *xp = *xpp;
02384         int status = ENOERR;
02385 
02386         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02387         {
02388                 const int lstatus = ncx_put_short_double(xp, tp);
02389                 if(lstatus != ENOERR)
02390                         status = lstatus;
02391         }
02392 
02393         *xpp = (void *)xp;
02394         return status;
02395 }
02396 
02397 
02398 int
02399 ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp)
02400 {
02401         const size_t rndup = nelems % 2;
02402 
02403         char *xp = *xpp;
02404         int status = ENOERR;
02405 
02406         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02407         {
02408                 const int lstatus = ncx_put_short_schar(xp, tp);
02409                 if(lstatus != ENOERR)
02410                         status = lstatus;
02411         }
02412 
02413         if(rndup != 0)
02414         {
02415                 (void) memcpy(xp, nada, X_SIZEOF_SHORT);
02416                 xp += X_SIZEOF_SHORT;   
02417         }
02418                 
02419         *xpp = (void *)xp;
02420         return status;
02421 }
02422 
02423 int
02424 ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp)
02425 {
02426         const size_t rndup = nelems % 2;
02427 
02428         char *xp = *xpp;
02429         int status = ENOERR;
02430 
02431         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02432         {
02433                 const int lstatus = ncx_put_short_uchar(xp, tp);
02434                 if(lstatus != ENOERR)
02435                         status = lstatus;
02436         }
02437 
02438         if(rndup != 0)
02439         {
02440                 (void) memcpy(xp, nada, X_SIZEOF_SHORT);
02441                 xp += X_SIZEOF_SHORT;   
02442         }
02443                 
02444         *xpp = (void *)xp;
02445         return status;
02446 }
02447 
02448 int
02449 ncx_pad_putn_short_short(void **xpp, size_t nelems, const short *tp)
02450 {
02451         const size_t rndup = nelems % 2;
02452 
02453         const int status = ncx_putn_short_short(xpp, nelems, tp);
02454 
02455         if(rndup != 0)
02456         {
02457                 *xpp = ((char *) (*xpp) + X_SIZEOF_SHORT);
02458         }
02459                 
02460         return status;
02461 }
02462 
02463 int
02464 ncx_pad_putn_short_int(void **xpp, size_t nelems, const int *tp)
02465 {
02466         const size_t rndup = nelems % 2;
02467 
02468         char *xp = *xpp;
02469         int status = ENOERR;
02470 
02471         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02472         {
02473                 const int lstatus = ncx_put_short_int(xp, tp);
02474                 if(lstatus != ENOERR)
02475                         status = lstatus;
02476         }
02477 
02478         if(rndup != 0)
02479         {
02480                 (void) memcpy(xp, nada, X_SIZEOF_SHORT);
02481                 xp += X_SIZEOF_SHORT;   
02482         }
02483                 
02484         *xpp = (void *)xp;
02485         return status;
02486 }
02487 
02488 int
02489 ncx_pad_putn_short_long(void **xpp, size_t nelems, const long *tp)
02490 {
02491         const size_t rndup = nelems % 2;
02492 
02493         char *xp = *xpp;
02494         int status = ENOERR;
02495 
02496         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02497         {
02498                 const int lstatus = ncx_put_short_long(xp, tp);
02499                 if(lstatus != ENOERR)
02500                         status = lstatus;
02501         }
02502 
02503         if(rndup != 0)
02504         {
02505                 (void) memcpy(xp, nada, X_SIZEOF_SHORT);
02506                 xp += X_SIZEOF_SHORT;   
02507         }
02508                 
02509         *xpp = (void *)xp;
02510         return status;
02511 }
02512 
02513 int
02514 ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp)
02515 {
02516         const size_t rndup = nelems % 2;
02517 
02518         char *xp = *xpp;
02519         int status = ENOERR;
02520 
02521         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02522         {
02523                 const int lstatus = ncx_put_short_float(xp, tp);
02524                 if(lstatus != ENOERR)
02525                         status = lstatus;
02526         }
02527 
02528         if(rndup != 0)
02529         {
02530                 (void) memcpy(xp, nada, X_SIZEOF_SHORT);
02531                 xp += X_SIZEOF_SHORT;   
02532         }
02533                 
02534         *xpp = (void *)xp;
02535         return status;
02536 }
02537 
02538 int
02539 ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp)
02540 {
02541         const size_t rndup = nelems % 2;
02542 
02543         char *xp = *xpp;
02544         int status = ENOERR;
02545 
02546         for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++)
02547         {
02548                 const int lstatus = ncx_put_short_double(xp, tp);
02549                 if(lstatus != ENOERR)
02550                         status = lstatus;
02551         }
02552 
02553         if(rndup != 0)
02554         {
02555                 (void) memcpy(xp, nada, X_SIZEOF_SHORT);
02556                 xp += X_SIZEOF_SHORT;   
02557         }
02558                 
02559         *xpp = (void *)xp;
02560         return status;
02561 }
02562 
02563 
02564 
02565 /* int */
02566 
02567 int
02568 ncx_getn_int_schar(const void **xpp, size_t nelems, schar *tp)
02569 {
02570         const char *xp = *xpp;
02571         int status = ENOERR;
02572 
02573         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02574         {
02575                 const int lstatus = ncx_get_int_schar(xp, tp);
02576                 if(lstatus != ENOERR)
02577                         status = lstatus;
02578         }
02579 
02580         *xpp = (const void *)xp;
02581         return status;
02582 }
02583 
02584 int
02585 ncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *tp)
02586 {
02587         const char *xp = *xpp;
02588         int status = ENOERR;
02589 
02590         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02591         {
02592                 const int lstatus = ncx_get_int_uchar(xp, tp);
02593                 if(lstatus != ENOERR)
02594                         status = lstatus;
02595         }
02596 
02597         *xpp = (const void *)xp;
02598         return status;
02599 }
02600 
02601 int
02602 ncx_getn_int_short(const void **xpp, size_t nelems, short *tp)
02603 {
02604         const char *xp = *xpp;
02605         int status = ENOERR;
02606 
02607         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02608         {
02609                 const int lstatus = ncx_get_int_short(xp, tp);
02610                 if(lstatus != ENOERR)
02611                         status = lstatus;
02612         }
02613 
02614         *xpp = (const void *)xp;
02615         return status;
02616 }
02617 
02618 #if INT_USE_IEG
02619 int
02620 ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
02621 {
02622         if(nelems > 0)
02623         {
02624                 const int bo = bitoff(*xpp);
02625                 const word *wp = *xpp;
02626                 int ierr;
02627                 *xpp = ((const char *) (*xpp) + nelems * X_SIZEOF_INT);
02628                 ierr = IEG2CRAY(&Cray2_I32, &nelems, wp,
02629                                 &bo, tp, &UnitStride);
02630                 assert(ierr >= 0);
02631                 if(ierr > 0)
02632                         return NC_ERANGE;
02633         }
02634         return ENOERR;
02635 }
02636 #else
02637 int
02638 ncx_getn_int_int(const void **xpp, size_t nelems, int *tp)
02639 {
02640         const int bo = byteoff(*xpp);
02641 
02642         if(nelems == 0)
02643                 return ENOERR;
02644 
02645         if(bo != 0)
02646         {
02647                 cget_int_int(*xpp, tp, bo);
02648                 *xpp = ((char *) (*xpp) + X_SIZEOF_INT);
02649                 nelems--;
02650                 if(nelems == 0)
02651                         return ENOERR;
02652                 tp++;
02653         }
02654 
02655         assert(byteoff(*xpp) == 0);
02656 
02657         {
02658                 const int nwords = (nelems * X_SIZEOF_INT)/sizeof(word);
02659                 const word *wp = *xpp;
02660                 const word *const end = &wp[nwords];
02661 
02662 #pragma _CRI ivdep
02663                 for( ; wp < end; wp++, tp += 2)
02664                 {
02665                         cget_int_int(wp, tp, 0);
02666                         cget_int_int(wp, tp + 1, 1);
02667                 }
02668 
02669                 *xpp = ((char *) (*xpp) + nwords * sizeof(word)); 
02670                 nelems -= (nwords * sizeof(word)/X_SIZEOF_INT);
02671                 if(nelems != 0)
02672                 {
02673                         cget_int_int(wp, tp, 0);
02674                         *xpp = ((char *) (*xpp) + X_SIZEOF_INT);
02675                 }
02676         }
02677 
02678         return ENOERR;
02679 }
02680 #endif
02681 
02682 int
02683 ncx_getn_int_long(const void **xpp, size_t nelems, long *tp)
02684 {
02685         const int bo = byteoff(*xpp);
02686 
02687         if(nelems == 0)
02688                 return ENOERR;
02689 
02690         if(bo != 0)
02691         {
02692                 cget_int_long(*xpp, tp, bo);
02693                 *xpp = ((char *) (*xpp) + X_SIZEOF_INT);
02694                 nelems--;
02695                 if(nelems == 0)
02696                         return ENOERR;
02697                 tp++;
02698         }
02699 
02700         assert(byteoff(*xpp) == 0);
02701 
02702         {
02703                 const int nwords = (nelems * X_SIZEOF_INT)/sizeof(word);
02704                 const word *wp = *xpp;
02705                 const word *const end = &wp[nwords];
02706 
02707 #pragma _CRI ivdep
02708                 for( ; wp < end; wp++, tp += 2)
02709                 {
02710                         cget_int_long(wp, tp, 0);
02711                         cget_int_long(wp, tp + 1, 1);
02712                 }
02713 
02714                 *xpp = ((char *) (*xpp) + nwords * sizeof(word)); 
02715                 nelems -= (nwords * sizeof(word)/X_SIZEOF_INT);
02716                 if(nelems != 0)
02717                 {
02718                         cget_int_long(wp, tp, 0);
02719                         *xpp = ((char *) (*xpp) + X_SIZEOF_INT);
02720                 }
02721         }
02722 
02723         return ENOERR;
02724 }
02725 
02726 int
02727 ncx_getn_int_float(const void **xpp, size_t nelems, float *tp)
02728 {
02729         const char *xp = *xpp;
02730         int status = ENOERR;
02731 
02732         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02733         {
02734                 const int lstatus = ncx_get_int_float(xp, tp);
02735                 if(lstatus != ENOERR)
02736                         status = lstatus;
02737         }
02738 
02739         *xpp = (const void *)xp;
02740         return status;
02741 }
02742 
02743 int
02744 ncx_getn_int_double(const void **xpp, size_t nelems, double *tp)
02745 {
02746         const char *xp = *xpp;
02747         int status = ENOERR;
02748 
02749         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02750         {
02751                 const int lstatus = ncx_get_int_double(xp, tp);
02752                 if(lstatus != ENOERR)
02753                         status = lstatus;
02754         }
02755 
02756         *xpp = (const void *)xp;
02757         return status;
02758 }
02759 
02760 
02761 int
02762 ncx_putn_int_schar(void **xpp, size_t nelems, const schar *tp)
02763 {
02764         char *xp = *xpp;
02765         int status = ENOERR;
02766 
02767         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02768         {
02769                 const int lstatus = ncx_put_int_schar(xp, tp);
02770                 if(lstatus != ENOERR)
02771                         status = lstatus;
02772         }
02773 
02774         *xpp = (void *)xp;
02775         return status;
02776 }
02777 
02778 int
02779 ncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *tp)
02780 {
02781         char *xp = *xpp;
02782         int status = ENOERR;
02783 
02784         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02785         {
02786                 const int lstatus = ncx_put_int_uchar(xp, tp);
02787                 if(lstatus != ENOERR)
02788                         status = lstatus;
02789         }
02790 
02791         *xpp = (void *)xp;
02792         return status;
02793 }
02794 
02795 int
02796 ncx_putn_int_short(void **xpp, size_t nelems, const short *tp)
02797 {
02798         char *xp = *xpp;
02799         int status = ENOERR;
02800 
02801         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02802         {
02803                 const int lstatus = ncx_put_int_short(xp, tp);
02804                 if(lstatus != ENOERR)
02805                         status = lstatus;
02806         }
02807 
02808         *xpp = (void *)xp;
02809         return status;
02810 }
02811 
02812 #if INT_USE_IEG
02813 int
02814 ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
02815 {
02816         if(nelems > 0)
02817         {
02818                 word *wp = *xpp;
02819                 const int bo = bitoff(*xpp);
02820                 int ierr;
02821         
02822                 *xpp = ((char *) (*xpp) + nelems * X_SIZEOF_INT);
02823         
02824                 ierr = CRAY2IEG(&Cray2_I32, &nelems, wp,
02825                                 &bo, tp, &UnitStride);
02826                 assert(ierr >= 0);
02827                 if(ierr > 0)
02828                         return NC_ERANGE;
02829         }
02830         return ENOERR;
02831 }
02832 #else
02833 int
02834 ncx_putn_int_int(void **xpp, size_t nelems, const int *tp)
02835 {
02836         int status = ENOERR;
02837         const int bo = byteoff(*xpp);
02838 
02839         if(nelems == 0)
02840                 return ENOERR;
02841 
02842         if(bo != 0)
02843         {
02844                 status = cput_int_int(*xpp, tp, bo);
02845                 *xpp = ((char *) (*xpp) + X_SIZEOF_INT);
02846                 nelems--;
02847                 if(nelems == 0)
02848                         return status;
02849                 tp++;
02850         }
02851 
02852         assert(byteoff(*xpp) == 0);
02853 
02854         {
02855                 const int nwords = (nelems * X_SIZEOF_INT)/sizeof(word);
02856                 word *wp = *xpp;
02857                 const word *const end = &wp[nwords];
02858 
02859 #pragma _CRI ivdep
02860                 for( ; wp < end; wp++, tp += 2)
02861                 {
02862                         int lstatus = cput_int_int(wp, tp, 0);
02863                         if(lstatus != ENOERR)
02864                                 status = lstatus;
02865                         lstatus = cput_int_int(wp, tp + 1, 1);
02866                         if(lstatus != ENOERR)
02867                                 status = lstatus;
02868                 }
02869 
02870                 *xpp = ((char *) (*xpp) + nwords * sizeof(word)); 
02871                 nelems -= (nwords * sizeof(word)/X_SIZEOF_INT);
02872                 if(nelems != 0)
02873                 {
02874                         const int lstatus = cput_int_int(wp, tp, 0);
02875                         if(lstatus != ENOERR)
02876                                 status = lstatus;
02877                         *xpp = ((char *) (*xpp) + X_SIZEOF_INT);
02878                 }
02879         }
02880 
02881         return status;
02882 }
02883 #endif
02884 
02885 int
02886 ncx_putn_int_long(void **xpp, size_t nelems, const long *tp)
02887 {
02888         int status = ENOERR;
02889         const int bo = byteoff(*xpp);
02890 
02891         if(nelems == 0)
02892                 return ENOERR;
02893 
02894         if(bo != 0)
02895         {
02896                 status = cput_int_long(*xpp, tp, bo);
02897                 *xpp = ((char *) (*xpp) + X_SIZEOF_INT);
02898                 nelems--;
02899                 if(nelems == 0)
02900                         return status;
02901                 tp++;
02902         }
02903 
02904         assert(byteoff(*xpp) == 0);
02905 
02906         {
02907                 const int nwords = (nelems * X_SIZEOF_INT)/sizeof(word);
02908                 word *wp = *xpp;
02909                 const word *const end = &wp[nwords];
02910 
02911 #pragma _CRI ivdep
02912                 for( ; wp < end; wp++, tp += 2)
02913                 {
02914                         int lstatus = cput_int_long(wp, tp, 0);
02915                         if(lstatus != ENOERR)
02916                                 status = lstatus;
02917                         lstatus = cput_int_long(wp, tp + 1, 1);
02918                         if(lstatus != ENOERR)
02919                                 status = lstatus;
02920                 }
02921 
02922                 *xpp = ((char *) (*xpp) + nwords * sizeof(word)); 
02923                 nelems -= (nwords * sizeof(word)/X_SIZEOF_INT);
02924                 if(nelems != 0)
02925                 {
02926                         const int lstatus = cput_int_long(wp, tp, 0);
02927                         if(lstatus != ENOERR)
02928                                 status = lstatus;
02929                         *xpp = ((char *) (*xpp) + X_SIZEOF_INT);
02930                 }
02931         }
02932 
02933         return status;
02934 }
02935 
02936 int
02937 ncx_putn_int_float(void **xpp, size_t nelems, const float *tp)
02938 {
02939         char *xp = *xpp;
02940         int status = ENOERR;
02941 
02942         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02943         {
02944                 const int lstatus = ncx_put_int_float(xp, tp);
02945                 if(lstatus != ENOERR)
02946                         status = lstatus;
02947         }
02948 
02949         *xpp = (void *)xp;
02950         return status;
02951 }
02952 
02953 int
02954 ncx_putn_int_double(void **xpp, size_t nelems, const double *tp)
02955 {
02956         char *xp = *xpp;
02957         int status = ENOERR;
02958 
02959         for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++)
02960         {
02961                 const int lstatus = ncx_put_int_double(xp, tp);
02962                 if(lstatus != ENOERR)
02963                         status = lstatus;
02964         }
02965 
02966         *xpp = (void *)xp;
02967         return status;
02968 }
02969 
02970 
02971 
02972 /* float */
02973 
02974 int
02975 ncx_getn_float_schar(const void **xpp, size_t nelems, schar *tp)
02976 {
02977         const char *xp = *xpp;
02978         int status = ENOERR;
02979 
02980         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
02981         {
02982                 const int lstatus = ncx_get_float_schar(xp, tp);
02983                 if(lstatus != ENOERR)
02984                         status = lstatus;
02985         }
02986 
02987         *xpp = (const void *)xp;
02988         return status;
02989 }
02990 
02991 int
02992 ncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *tp)
02993 {
02994         const char *xp = *xpp;
02995         int status = ENOERR;
02996 
02997         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
02998         {
02999                 const int lstatus = ncx_get_float_uchar(xp, tp);
03000                 if(lstatus != ENOERR)
03001                         status = lstatus;
03002         }
03003 
03004         *xpp = (const void *)xp;
03005         return status;
03006 }
03007 
03008 int
03009 ncx_getn_float_short(const void **xpp, size_t nelems, short *tp)
03010 {
03011         const char *xp = *xpp;
03012         int status = ENOERR;
03013 
03014         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03015         {
03016                 const int lstatus = ncx_get_float_short(xp, tp);
03017                 if(lstatus != ENOERR)
03018                         status = lstatus;
03019         }
03020 
03021         *xpp = (const void *)xp;
03022         return status;
03023 }
03024 
03025 int
03026 ncx_getn_float_int(const void **xpp, size_t nelems, int *tp)
03027 {
03028         const char *xp = *xpp;
03029         int status = ENOERR;
03030 
03031         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03032         {
03033                 const int lstatus = ncx_get_float_int(xp, tp);
03034                 if(lstatus != ENOERR)
03035                         status = lstatus;
03036         }
03037 
03038         *xpp = (const void *)xp;
03039         return status;
03040 }
03041 
03042 int
03043 ncx_getn_float_long(const void **xpp, size_t nelems, long *tp)
03044 {
03045         const char *xp = *xpp;
03046         int status = ENOERR;
03047 
03048         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03049         {
03050                 const int lstatus = ncx_get_float_long(xp, tp);
03051                 if(lstatus != ENOERR)
03052                         status = lstatus;
03053         }
03054 
03055         *xpp = (const void *)xp;
03056         return status;
03057 }
03058 
03059 #if FLOAT_USE_IEG
03060 int
03061 ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
03062 {
03063         if(nelems > 0)
03064         {
03065                 const int bo = bitoff(*xpp);
03066                 const word *wp = *xpp;
03067                 int ierr;
03068                 *xpp = ((const char *) (*xpp) + nelems * X_SIZEOF_FLOAT);
03069                 ierr = IEG2CRAY(&Cray2_F32, &nelems, wp,
03070                                 &bo, tp, &UnitStride);
03071                 assert(ierr >= 0);
03072                 if(ierr > 0)
03073                         return NC_ERANGE;
03074         }
03075         return ENOERR;
03076 
03077 }
03078 #else
03079 int
03080 ncx_getn_float_float(const void **xpp, size_t nelems, float *tp)
03081 {
03082         const int bo = byteoff(*xpp);
03083 
03084         if(nelems == 0)
03085                 return ENOERR;
03086 
03087         if(bo != 0)
03088         {
03089                 cget_float_float(*xpp, tp, bo);
03090                 *xpp = ((char *) (*xpp) + X_SIZEOF_FLOAT);
03091                 nelems--;
03092                 if(nelems == 0)
03093                         return ENOERR;
03094                 tp++;
03095         }
03096 
03097         assert(byteoff(*xpp) == 0);
03098 
03099         {
03100                 const int nwords = (nelems * X_SIZEOF_FLOAT)/sizeof(word);
03101                 const word *wp = *xpp;
03102                 const word *const end = &wp[nwords];
03103 
03104 #pragma _CRI ivdep
03105                 for( ; wp < end; wp++, tp += 2)
03106                 {
03107                         cget_float_float(wp, tp, 0);
03108                         cget_float_float(wp, tp + 1, 1);
03109                 }
03110 
03111                 *xpp = ((char *) (*xpp) + nwords * sizeof(word)); 
03112                 nelems -= (nwords * sizeof(word)/X_SIZEOF_FLOAT);
03113                 if(nelems != 0)
03114                 {
03115                         cget_float_float(wp, tp, 0);
03116                         *xpp = ((char *) (*xpp) + X_SIZEOF_FLOAT);
03117                 }
03118         }
03119 
03120         return ENOERR;
03121 }
03122 #endif
03123 
03124 int
03125 ncx_getn_float_double(const void **xpp, size_t nelems, double *tp)
03126 {
03127         const char *xp = *xpp;
03128         int status = ENOERR;
03129 
03130         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03131         {
03132                 const int lstatus = ncx_get_float_double(xp, tp);
03133                 if(lstatus != ENOERR)
03134                         status = lstatus;
03135         }
03136 
03137         *xpp = (const void *)xp;
03138         return status;
03139 }
03140 
03141 
03142 int
03143 ncx_putn_float_schar(void **xpp, size_t nelems, const schar *tp)
03144 {
03145         char *xp = *xpp;
03146         int status = ENOERR;
03147 
03148         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03149         {
03150                 const int lstatus = ncx_put_float_schar(xp, tp);
03151                 if(lstatus != ENOERR)
03152                         status = lstatus;
03153         }
03154 
03155         *xpp = (void *)xp;
03156         return status;
03157 }
03158 
03159 int
03160 ncx_putn_float_uchar(void **xpp, size_t nelems, const uchar *tp)
03161 {
03162         char *xp = *xpp;
03163         int status = ENOERR;
03164 
03165         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03166         {
03167                 const int lstatus = ncx_put_float_uchar(xp, tp);
03168                 if(lstatus != ENOERR)
03169                         status = lstatus;
03170         }
03171 
03172         *xpp = (void *)xp;
03173         return status;
03174 }
03175 
03176 int
03177 ncx_putn_float_short(void **xpp, size_t nelems, const short *tp)
03178 {
03179         char *xp = *xpp;
03180         int status = ENOERR;
03181 
03182         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03183         {
03184                 const int lstatus = ncx_put_float_short(xp, tp);
03185                 if(lstatus != ENOERR)
03186                         status = lstatus;
03187         }
03188 
03189         *xpp = (void *)xp;
03190         return status;
03191 }
03192 
03193 int
03194 ncx_putn_float_int(void **xpp, size_t nelems, const int *tp)
03195 {
03196         char *xp = *xpp;
03197         int status = ENOERR;
03198 
03199         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03200         {
03201                 const int lstatus = ncx_put_float_int(xp, tp);
03202                 if(lstatus != ENOERR)
03203                         status = lstatus;
03204         }
03205 
03206         *xpp = (void *)xp;
03207         return status;
03208 }
03209 
03210 int
03211 ncx_putn_float_long(void **xpp, size_t nelems, const long *tp)
03212 {
03213         char *xp = *xpp;
03214         int status = ENOERR;
03215 
03216         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03217         {
03218                 const int lstatus = ncx_put_float_long(xp, tp);
03219                 if(lstatus != ENOERR)
03220                         status = lstatus;
03221         }
03222 
03223         *xpp = (void *)xp;
03224         return status;
03225 }
03226 
03227 #if FLOAT_USE_IEG
03228 int
03229 ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
03230 {
03231         if(nelems > 0)
03232         {
03233                 word *wp = *xpp;
03234                 const int bo = bitoff(*xpp);
03235                 int ierr;
03236         
03237                 *xpp = ((char *) (*xpp) + nelems * X_SIZEOF_FLOAT);
03238         
03239                 ierr = CRAY2IEG(&Cray2_F32, &nelems, wp,
03240                                 &bo, tp, &UnitStride);
03241                 assert(ierr >= 0);
03242                 if(ierr > 0)
03243                         return NC_ERANGE;
03244         }
03245         return ENOERR;
03246 }
03247 #else
03248 int
03249 ncx_putn_float_float(void **xpp, size_t nelems, const float *tp)
03250 {
03251         int status = ENOERR;
03252         const int bo = byteoff(*xpp);
03253 
03254         if(nelems == 0)
03255                 return ENOERR;
03256 
03257         if(bo != 0)
03258         {
03259                 status = cput_float_float(*xpp, tp, bo);
03260                 *xpp = ((char *) (*xpp) + X_SIZEOF_FLOAT);
03261                 nelems--;
03262                 if(nelems == 0)
03263                         return status;
03264                 tp++;
03265         }
03266 
03267         assert(byteoff(*xpp) == 0);
03268 
03269         {
03270                 const int nwords = (nelems * X_SIZEOF_FLOAT)/sizeof(word);
03271                 word *wp = *xpp;
03272                 const word *const end = &wp[nwords];
03273 
03274 #pragma _CRI ivdep
03275                 for( ; wp < end; wp++, tp += 2)
03276                 {
03277                         int lstatus = cput_float_float(wp, tp, 0);
03278                         if(lstatus != ENOERR)
03279                                 status = lstatus;
03280                         lstatus = cput_float_float(wp, tp + 1, 1);
03281                         if(lstatus != ENOERR)
03282                                 status = lstatus;
03283                 }
03284 
03285                 *xpp = ((char *) (*xpp) + nwords * sizeof(word)); 
03286                 nelems -= (nwords * sizeof(word)/X_SIZEOF_FLOAT);
03287                 if(nelems != 0)
03288                 {
03289                         const int lstatus = cput_float_float(wp, tp, 0);
03290                         if(lstatus != ENOERR)
03291                                 status = lstatus;
03292                         *xpp = ((char *) (*xpp) + X_SIZEOF_FLOAT);
03293                 }
03294         }
03295 
03296         return status;
03297 }
03298 #endif
03299 
03300 int
03301 ncx_putn_float_double(void **xpp, size_t nelems, const double *tp)
03302 {
03303         char *xp = *xpp;
03304         int status = ENOERR;
03305 
03306         for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
03307         {
03308                 const int lstatus = ncx_put_float_double(xp, tp);
03309                 if(lstatus != ENOERR)
03310                         status = lstatus;
03311         }
03312 
03313         *xpp = (void *)xp;
03314         return status;
03315 }
03316 
03317 
03318 
03319 /* double */
03320 
03321 int
03322 ncx_getn_double_schar(const void **xpp, size_t nelems, schar *tp)
03323 {
03324         const char *xp = *xpp;
03325         int status = ENOERR;
03326 
03327         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03328         {
03329                 const int lstatus = ncx_get_double_schar(xp, tp);
03330                 if(lstatus != ENOERR)
03331                         status = lstatus;
03332         }
03333 
03334         *xpp = (const void *)xp;
03335         return status;
03336 }
03337 
03338 int
03339 ncx_getn_double_uchar(const void **xpp, size_t nelems, uchar *tp)
03340 {
03341         const char *xp = *xpp;
03342         int status = ENOERR;
03343 
03344         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03345         {
03346                 const int lstatus = ncx_get_double_uchar(xp, tp);
03347                 if(lstatus != ENOERR)
03348                         status = lstatus;
03349         }
03350 
03351         *xpp = (const void *)xp;
03352         return status;
03353 }
03354 
03355 int
03356 ncx_getn_double_short(const void **xpp, size_t nelems, short *tp)
03357 {
03358         const char *xp = *xpp;
03359         int status = ENOERR;
03360 
03361         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03362         {
03363                 const int lstatus = ncx_get_double_short(xp, tp);
03364                 if(lstatus != ENOERR)
03365                         status = lstatus;
03366         }
03367 
03368         *xpp = (const void *)xp;
03369         return status;
03370 }
03371 
03372 int
03373 ncx_getn_double_int(const void **xpp, size_t nelems, int *tp)
03374 {
03375         const char *xp = *xpp;
03376         int status = ENOERR;
03377 
03378         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03379         {
03380                 const int lstatus = ncx_get_double_int(xp, tp);
03381                 if(lstatus != ENOERR)
03382                         status = lstatus;
03383         }
03384 
03385         *xpp = (const void *)xp;
03386         return status;
03387 }
03388 
03389 int
03390 ncx_getn_double_long(const void **xpp, size_t nelems, long *tp)
03391 {
03392         const char *xp = *xpp;
03393         int status = ENOERR;
03394 
03395         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03396         {
03397                 const int lstatus = ncx_get_double_long(xp, tp);
03398                 if(lstatus != ENOERR)
03399                         status = lstatus;
03400         }
03401 
03402         *xpp = (const void *)xp;
03403         return status;
03404 }
03405 
03406 #if DOUBLE_USE_IEG
03407 int
03408 ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
03409 {
03410         const size_t noff = byteoff(*xpp);
03411         int ierr;
03412 
03413         if(nelems == 0)
03414                 return ENOERR;
03415 
03416         if(noff != 0)
03417         {
03418                 /* (*xpp) not word aligned, forced to make a copy */
03419                 word *xbuf = (word*)malloc(nelems*sizeof(word));
03420                 if (xbuf == NULL)
03421                         return NC_ENOMEM;
03422                 (void) memcpy(xbuf, *xpp, nelems * X_SIZEOF_DOUBLE);
03423                 ierr = IEG2CRAY(&Cray2_F64, &nelems, xbuf,
03424                         &Zero, tp, &UnitStride);
03425                 (void)free(xbuf);
03426         }
03427         else
03428         {
03429                 ierr = IEG2CRAY(&Cray2_F64, &nelems, *xpp,
03430                                 &Zero, tp, &UnitStride);
03431         }
03432 
03433         *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
03434 
03435         assert(ierr >= 0);
03436 
03437         return ierr > 0 ? NC_ERANGE : ENOERR;
03438 }
03439 #elif X_SIZEOF_DOUBLE == SIZEOF_DOUBLE  && !defined(NO_IEEE_FLOAT)
03440 int
03441 ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
03442 {
03443         (void) memcpy(tp, *xpp, nelems * X_SIZEOF_DOUBLE);
03444         *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
03445         return ENOERR;
03446 }
03447 #else
03448 int
03449 ncx_getn_double_double(const void **xpp, size_t nelems, double *tp)
03450 {
03451         const size_t noff = byteoff(*xpp);
03452 
03453         if(nelems == 0)
03454                 return ENOERR;
03455 
03456         if(noff != 0)
03457         {
03458                 /* (*xpp) not word aligned, forced to make a copy */
03459                 word *xbuf = (word*)malloc(nelems*sizeof(word));
03460                 if (xbuf == NULL)
03461                 {
03462                         return NC_ENOMEM;
03463                 }
03464                 else
03465                 {
03466                         const word *wp = xbuf;
03467                         const word *const end = &wp[nelems];
03468 
03469                         (void) memcpy(
03470                                 (void*)xbuf, *xpp, nelems * X_SIZEOF_DOUBLE);
03471 
03472 #pragma _CRI ivdep
03473                         for( ; wp < end; wp++, tp++)
03474                         {
03475                                 cget_double_double(wp, tp);
03476                         }
03477 
03478                         (void)free(xbuf);
03479                 }
03480         }
03481         else
03482         {
03483                 const word *wp = *xpp;
03484                 const word *const end = &wp[nelems];
03485 
03486 #pragma _CRI ivdep
03487                 for( ; wp < end; wp++, tp++)
03488                 {
03489                         cget_double_double(wp, tp);
03490                 }
03491 
03492         }
03493         *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
03494         return ENOERR;
03495 }
03496 #endif
03497 
03498 int
03499 ncx_getn_double_float(const void **xpp, size_t nelems, float *tp)
03500 {
03501 #if SIZEOF_FLOAT == SIZEOF_DOUBLE && FLT_MANT_DIG == DBL_MANT_DIG
03502         return ncx_getn_double_double(xpp, nelems, (double *)tp);
03503 #else
03504         const char *xp = *xpp;
03505         int status = ENOERR;
03506 
03507         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03508         {
03509                 const int lstatus = ncx_get_double_float(xp, tp);
03510                 if(lstatus != ENOERR)
03511                         status = lstatus;
03512         }
03513 
03514         *xpp = (const void *)xp;
03515         return status;
03516 #endif
03517 }
03518 
03519 
03520 int
03521 ncx_putn_double_schar(void **xpp, size_t nelems, const schar *tp)
03522 {
03523         char *xp = *xpp;
03524         int status = ENOERR;
03525 
03526         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03527         {
03528                 const int lstatus = ncx_put_double_schar(xp, tp);
03529                 if(lstatus != ENOERR)
03530                         status = lstatus;
03531         }
03532 
03533         *xpp = (void *)xp;
03534         return status;
03535 }
03536 
03537 int
03538 ncx_putn_double_uchar(void **xpp, size_t nelems, const uchar *tp)
03539 {
03540         char *xp = *xpp;
03541         int status = ENOERR;
03542 
03543         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03544         {
03545                 const int lstatus = ncx_put_double_uchar(xp, tp);
03546                 if(lstatus != ENOERR)
03547                         status = lstatus;
03548         }
03549 
03550         *xpp = (void *)xp;
03551         return status;
03552 }
03553 
03554 int
03555 ncx_putn_double_short(void **xpp, size_t nelems, const short *tp)
03556 {
03557         char *xp = *xpp;
03558         int status = ENOERR;
03559 
03560         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03561         {
03562                 const int lstatus = ncx_put_double_short(xp, tp);
03563                 if(lstatus != ENOERR)
03564                         status = lstatus;
03565         }
03566 
03567         *xpp = (void *)xp;
03568         return status;
03569 }
03570 
03571 int
03572 ncx_putn_double_int(void **xpp, size_t nelems, const int *tp)
03573 {
03574         char *xp = *xpp;
03575         int status = ENOERR;
03576 
03577         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03578         {
03579                 const int lstatus = ncx_put_double_int(xp, tp);
03580                 if(lstatus != ENOERR)
03581                         status = lstatus;
03582         }
03583 
03584         *xpp = (void *)xp;
03585         return status;
03586 }
03587 
03588 int
03589 ncx_putn_double_long(void **xpp, size_t nelems, const long *tp)
03590 {
03591         char *xp = *xpp;
03592         int status = ENOERR;
03593 
03594         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03595         {
03596                 const int lstatus = ncx_put_double_long(xp, tp);
03597                 if(lstatus != ENOERR)
03598                         status = lstatus;
03599         }
03600 
03601         *xpp = (void *)xp;
03602         return status;
03603 }
03604 
03605 #if DOUBLE_USE_IEG
03606 int
03607 ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
03608 {
03609         const size_t noff = byteoff(*xpp);
03610         int ierr;
03611 
03612         if(nelems == 0)
03613                 return ENOERR;
03614 
03615         if(noff != 0)
03616         {
03617                 /* (*xpp) not word aligned, forced to make a copy */
03618                 word *xbuf = (word*)malloc(nelems*sizeof(word));
03619                 if (xbuf == NULL)
03620                         return NC_ENOMEM;
03621                 ierr = CRAY2IEG(&Cray2_F64, &nelems, xbuf,
03622                         &Zero, tp, &UnitStride);
03623                 assert(ierr >= 0);
03624                 (void) memcpy(*xpp, xbuf, nelems * X_SIZEOF_DOUBLE);
03625                 (void)free(xbuf);
03626         }
03627         else
03628         {
03629                 ierr = CRAY2IEG(&Cray2_F64, &nelems, *xpp,
03630                                 &Zero, tp, &UnitStride);
03631                 assert(ierr >= 0);
03632         }
03633 
03634         *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
03635 
03636         return ierr > 0 ? NC_ERANGE : ENOERR;
03637 }
03638 #elif X_SIZEOF_DOUBLE == SIZEOF_DOUBLE  && !defined(NO_IEEE_FLOAT)
03639 int
03640 ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
03641 {
03642         const size_t noff = byteoff(*xpp);
03643         (void) memcpy(*xpp, tp, nelems * X_SIZEOF_DOUBLE);
03644         *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
03645         return ENOERR;
03646 }
03647 #else
03648 int
03649 ncx_putn_double_double(void **xpp, size_t nelems, const double *tp)
03650 {
03651         int status = ENOERR;
03652         const size_t noff = byteoff(*xpp);
03653 
03654         if(nelems == 0)
03655                 return ENOERR;
03656 
03657         if(noff != 0)
03658         {
03659                 /* (*xpp) not word aligned, forced to make a copy */
03660                 word *xbuf = (word*)malloc(nelems*sizeof(word));
03661                 if (xbuf == NULL)
03662                 {
03663                         return NC_ENOMEM;
03664                 }
03665                 else
03666                 {
03667                         word *wp = xbuf;
03668                         const word *const end = &wp[nelems];
03669 
03670 #pragma _CRI ivdep
03671                         for( ; wp < end; wp++, tp++)
03672                         {
03673                                 const int lstatus = cput_double_double(wp, tp);
03674                                 if(lstatus != ENOERR)
03675                                         status = lstatus;
03676                         }
03677 
03678                         (void) memcpy(
03679                                 *xpp, (void*)xbuf, nelems * X_SIZEOF_DOUBLE);
03680                         (void)free(xbuf);
03681                 }
03682         }
03683         else
03684         {
03685                 word *wp = *xpp;
03686                 const word *const end = &wp[nelems];
03687 
03688 #pragma _CRI ivdep
03689                 for( ; wp < end; wp++, tp++)
03690                 {
03691                         const int lstatus = cput_double_double(wp, tp);
03692                         if(lstatus != ENOERR)
03693                                 status = lstatus;
03694                 }
03695 
03696         }
03697 
03698         *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_DOUBLE);
03699         return status;
03700 }
03701 #endif
03702 
03703 int
03704 ncx_putn_double_float(void **xpp, size_t nelems, const float *tp)
03705 {
03706 #if SIZEOF_FLOAT == SIZEOF_DOUBLE && FLT_MANT_DIG == DBL_MANT_DIG
03707         return ncx_putn_double_double(xpp, nelems, (double *)tp);
03708 #else
03709         char *xp = *xpp;
03710         int status = ENOERR;
03711 
03712         for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
03713         {
03714                 const int lstatus = ncx_put_double_float(xp, tp);
03715                 if(lstatus != ENOERR)
03716                         status = lstatus;
03717         }
03718 
03719         *xpp = (void *)xp;
03720         return status;
03721 #endif
03722 }
03723 
03724 
03725 
03726 /*
03727  * Other aggregate conversion functions.
03728  */
03729 
03730 /* text */
03731 
03732 int
03733 ncx_getn_text(const void **xpp, size_t nelems, char *tp)
03734 {
03735         (void) memcpy(tp, *xpp, nelems);
03736         *xpp = (void *)((char *)(*xpp) + nelems);
03737         return ENOERR;
03738 
03739 }
03740 
03741 int
03742 ncx_pad_getn_text(const void **xpp, size_t nelems, char *tp)
03743 {
03744         size_t rndup = nelems % X_ALIGN;
03745 
03746         if(rndup)
03747                 rndup = X_ALIGN - rndup;
03748 
03749         (void) memcpy(tp, *xpp, nelems);
03750         *xpp = (void *)((char *)(*xpp) + nelems + rndup);
03751 
03752         return ENOERR;
03753 
03754 }
03755 
03756 int
03757 ncx_putn_text(void **xpp, size_t nelems, const char *tp)
03758 {
03759         (void) memcpy(*xpp, tp, nelems);
03760         *xpp = (void *)((char *)(*xpp) + nelems);
03761 
03762         return ENOERR;
03763 
03764 }
03765 
03766 int
03767 ncx_pad_putn_text(void **xpp, size_t nelems, const char *tp)
03768 {
03769         size_t rndup = nelems % X_ALIGN;
03770 
03771         if(rndup)
03772                 rndup = X_ALIGN - rndup;
03773 
03774         (void) memcpy(*xpp, tp, nelems);
03775         *xpp = (void *)((char *)(*xpp) + nelems);
03776 
03777         if(rndup)
03778         {
03779                 (void) memcpy(*xpp, nada, rndup);
03780                 *xpp = (void *)((char *)(*xpp) + rndup);
03781         }
03782         
03783         return ENOERR;
03784 
03785 }
03786 
03787 
03788 /* opaque */
03789 
03790 int
03791 ncx_getn_void(const void **xpp, size_t nelems, void *tp)
03792 {
03793         (void) memcpy(tp, *xpp, nelems);
03794         *xpp = (void *)((char *)(*xpp) + nelems);
03795         return ENOERR;
03796 
03797 }
03798 
03799 int
03800 ncx_pad_getn_void(const void **xpp, size_t nelems, void *tp)
03801 {
03802         size_t rndup = nelems % X_ALIGN;
03803 
03804         if(rndup)
03805                 rndup = X_ALIGN - rndup;
03806 
03807         (void) memcpy(tp, *xpp, nelems);
03808         *xpp = (void *)((char *)(*xpp) + nelems + rndup);
03809 
03810         return ENOERR;
03811 
03812 }
03813 
03814 int
03815 ncx_putn_void(void **xpp, size_t nelems, const void *tp)
03816 {
03817         (void) memcpy(*xpp, tp, nelems);
03818         *xpp = (void *)((char *)(*xpp) + nelems);
03819 
03820         return ENOERR;
03821 
03822 }
03823 
03824 int
03825 ncx_pad_putn_void(void **xpp, size_t nelems, const void *tp)
03826 {
03827         size_t rndup = nelems % X_ALIGN;
03828 
03829         if(rndup)
03830                 rndup = X_ALIGN - rndup;
03831 
03832         (void) memcpy(*xpp, tp, nelems);
03833         *xpp = (void *)((char *)(*xpp) + nelems);
03834 
03835         if(rndup)
03836         {
03837                 (void) memcpy(*xpp, nada, rndup);
03838                 *xpp = (void *)((char *)(*xpp) + rndup);
03839         }
03840         
03841         return ENOERR;
03842 
03843 }
 

Powered by Plone

This site conforms to the following standards: