Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
testcvt.c
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 #include <stdio.h>
00037 #include "arith.h"
00038 
00039 #ifndef _CRAY
00040 main(int argc, char *argv[])
00041 {
00042    printf("%s:  cannot be run on this host machine type.\n", argv[0]);
00043    exit (0);
00044 }
00045 #else  /* _CRAY */
00046 
00047 /* We're running on a Cray machine */
00048 
00049 #if _RELEASE < 4
00050 #error  Must be compiled with Cray Standard C Compiler, version 4.0 or later.
00051 #endif
00052 
00053 /* evaluates to true if a signed int exceeds 46 bits of precision */
00054 #define INT_OVERFLOWS_46_BITS(OPND) \
00055    (((OPND) & 0xffffe00000000000) != 0xffffe00000000000 && \
00056     ((OPND) & 0xffffe00000000000) != 0)
00057 
00058 
00059 typedef unsigned long UINT64;
00060 typedef signed long SINT64;
00061 typedef signed int SINT46;
00062 typedef unsigned short UINT32;
00063 typedef signed short SINT32;
00064 typedef unsigned char UINT8;
00065 typedef signed char SINT8;
00066 
00067 typedef struct {
00068         unsigned int part1: 16;
00069         unsigned int part2: 16;
00070         unsigned int part3: 16;
00071         unsigned int part4: 16;
00072 } AR_INT_64;
00073 
00074 AR_INT_64 cool_64_ints[] =
00075 {
00076    /* march a one bit though a positive 64-bit int */
00077    {0x0000, 0x0000, 0x0000, 0x0000},
00078    {0x0000, 0x0000, 0x0000, 0x0001},
00079    {0x0000, 0x0000, 0x0000, 0x0002},
00080    {0x0000, 0x0000, 0x0000, 0x0004},
00081    {0x0000, 0x0000, 0x0000, 0x0008},
00082    {0x0000, 0x0000, 0x0000, 0x0010},
00083    {0x0000, 0x0000, 0x0000, 0x0020},
00084    {0x0000, 0x0000, 0x0000, 0x0040},
00085    {0x0000, 0x0000, 0x0000, 0x0080},
00086    {0x0000, 0x0000, 0x0000, 0x0100},
00087    {0x0000, 0x0000, 0x0000, 0x0200},
00088    {0x0000, 0x0000, 0x0000, 0x0400},
00089    {0x0000, 0x0000, 0x0000, 0x0800},
00090    {0x0000, 0x0000, 0x0000, 0x1000},
00091    {0x0000, 0x0000, 0x0000, 0x2000},
00092    {0x0000, 0x0000, 0x0000, 0x4000},
00093    {0x0000, 0x0000, 0x0000, 0x8000},
00094    {0x0000, 0x0000, 0x0001, 0x0000},
00095    {0x0000, 0x0000, 0x0002, 0x0000},
00096    {0x0000, 0x0000, 0x0004, 0x0000},
00097    {0x0000, 0x0000, 0x0008, 0x0000},
00098    {0x0000, 0x0000, 0x0010, 0x0000},
00099    {0x0000, 0x0000, 0x0020, 0x0000},
00100    {0x0000, 0x0000, 0x0040, 0x0000},
00101    {0x0000, 0x0000, 0x0080, 0x0000},
00102    {0x0000, 0x0000, 0x0100, 0x0000},
00103    {0x0000, 0x0000, 0x0200, 0x0000},
00104    {0x0000, 0x0000, 0x0400, 0x0000},
00105    {0x0000, 0x0000, 0x0800, 0x0000},
00106    {0x0000, 0x0000, 0x1000, 0x0000},
00107    {0x0000, 0x0000, 0x2000, 0x0000},
00108    {0x0000, 0x0000, 0x4000, 0x0000},
00109    {0x0000, 0x0000, 0x8000, 0x0000},
00110    {0x0000, 0x0001, 0x0000, 0x0000},
00111    {0x0000, 0x0002, 0x0000, 0x0000},
00112    {0x0000, 0x0004, 0x0000, 0x0000},
00113    {0x0000, 0x0008, 0x0000, 0x0000},
00114    {0x0000, 0x0010, 0x0000, 0x0000},
00115    {0x0000, 0x0020, 0x0000, 0x0000},
00116    {0x0000, 0x0040, 0x0000, 0x0000},
00117    {0x0000, 0x0080, 0x0000, 0x0000},
00118    {0x0000, 0x0100, 0x0000, 0x0000},
00119    {0x0000, 0x0200, 0x0000, 0x0000},
00120    {0x0000, 0x0400, 0x0000, 0x0000},
00121    {0x0000, 0x0800, 0x0000, 0x0000},
00122    {0x0000, 0x1000, 0x0000, 0x0000},
00123    {0x0000, 0x2000, 0x0000, 0x0000},
00124    {0x0000, 0x4000, 0x0000, 0x0000},
00125    {0x0000, 0x8000, 0x0000, 0x0000},
00126    {0x0001, 0x0000, 0x0000, 0x0000},
00127    {0x0002, 0x0000, 0x0000, 0x0000},
00128    {0x0004, 0x0000, 0x0000, 0x0000},
00129    {0x0008, 0x0000, 0x0000, 0x0000},
00130    {0x0010, 0x0000, 0x0000, 0x0000},
00131    {0x0020, 0x0000, 0x0000, 0x0000},
00132    {0x0040, 0x0000, 0x0000, 0x0000},
00133    {0x0080, 0x0000, 0x0000, 0x0000},
00134    {0x0100, 0x0000, 0x0000, 0x0000},
00135    {0x0200, 0x0000, 0x0000, 0x0000},
00136    {0x0400, 0x0000, 0x0000, 0x0000},
00137    {0x0800, 0x0000, 0x0000, 0x0000},
00138    {0x1000, 0x0000, 0x0000, 0x0000},
00139    {0x2000, 0x0000, 0x0000, 0x0000},
00140    {0x4000, 0x0000, 0x0000, 0x0000},
00141    {0x8000, 0x0000, 0x0000, 0x0000},
00142 
00143    /* march a one bit though a negative 64-bit int */
00144 /* {0x8000, 0x0000, 0x0000, 0x0000}, */  /* already have this one */
00145    {0x8000, 0x0000, 0x0000, 0x0001},
00146    {0x8000, 0x0000, 0x0000, 0x0002},
00147    {0x8000, 0x0000, 0x0000, 0x0004},
00148    {0x8000, 0x0000, 0x0000, 0x0008},
00149    {0x8000, 0x0000, 0x0000, 0x0010},
00150    {0x8000, 0x0000, 0x0000, 0x0020},
00151    {0x8000, 0x0000, 0x0000, 0x0040},
00152    {0x8000, 0x0000, 0x0000, 0x0080},
00153    {0x8000, 0x0000, 0x0000, 0x0100},
00154    {0x8000, 0x0000, 0x0000, 0x0200},
00155    {0x8000, 0x0000, 0x0000, 0x0400},
00156    {0x8000, 0x0000, 0x0000, 0x0800},
00157    {0x8000, 0x0000, 0x0000, 0x1000},
00158    {0x8000, 0x0000, 0x0000, 0x2000},
00159    {0x8000, 0x0000, 0x0000, 0x4000},
00160    {0x8000, 0x0000, 0x0000, 0x8000},
00161    {0x8000, 0x0000, 0x0001, 0x0000},
00162    {0x8000, 0x0000, 0x0002, 0x0000},
00163    {0x8000, 0x0000, 0x0004, 0x0000},
00164    {0x8000, 0x0000, 0x0008, 0x0000},
00165    {0x8000, 0x0000, 0x0010, 0x0000},
00166    {0x8000, 0x0000, 0x0020, 0x0000},
00167    {0x8000, 0x0000, 0x0040, 0x0000},
00168    {0x8000, 0x0000, 0x0080, 0x0000},
00169    {0x8000, 0x0000, 0x0100, 0x0000},
00170    {0x8000, 0x0000, 0x0200, 0x0000},
00171    {0x8000, 0x0000, 0x0400, 0x0000},
00172    {0x8000, 0x0000, 0x0800, 0x0000},
00173    {0x8000, 0x0000, 0x1000, 0x0000},
00174    {0x8000, 0x0000, 0x2000, 0x0000},
00175    {0x8000, 0x0000, 0x4000, 0x0000},
00176    {0x8000, 0x0000, 0x8000, 0x0000},
00177    {0x8000, 0x0001, 0x0000, 0x0000},
00178    {0x8000, 0x0002, 0x0000, 0x0000},
00179    {0x8000, 0x0004, 0x0000, 0x0000},
00180    {0x8000, 0x0008, 0x0000, 0x0000},
00181    {0x8000, 0x0010, 0x0000, 0x0000},
00182    {0x8000, 0x0020, 0x0000, 0x0000},
00183    {0x8000, 0x0040, 0x0000, 0x0000},
00184    {0x8000, 0x0080, 0x0000, 0x0000},
00185    {0x8000, 0x0100, 0x0000, 0x0000},
00186    {0x8000, 0x0200, 0x0000, 0x0000},
00187    {0x8000, 0x0400, 0x0000, 0x0000},
00188    {0x8000, 0x0800, 0x0000, 0x0000},
00189    {0x8000, 0x1000, 0x0000, 0x0000},
00190    {0x8000, 0x2000, 0x0000, 0x0000},
00191    {0x8000, 0x4000, 0x0000, 0x0000},
00192    {0x8000, 0x8000, 0x0000, 0x0000},
00193    {0x8001, 0x0000, 0x0000, 0x0000},
00194    {0x8002, 0x0000, 0x0000, 0x0000},
00195    {0x8004, 0x0000, 0x0000, 0x0000},
00196    {0x8008, 0x0000, 0x0000, 0x0000},
00197    {0x8010, 0x0000, 0x0000, 0x0000},
00198    {0x8020, 0x0000, 0x0000, 0x0000},
00199    {0x8040, 0x0000, 0x0000, 0x0000},
00200    {0x8080, 0x0000, 0x0000, 0x0000},
00201    {0x8100, 0x0000, 0x0000, 0x0000},
00202    {0x8200, 0x0000, 0x0000, 0x0000},
00203    {0x8400, 0x0000, 0x0000, 0x0000},
00204    {0x8800, 0x0000, 0x0000, 0x0000},
00205    {0x9000, 0x0000, 0x0000, 0x0000},
00206    {0xa000, 0x0000, 0x0000, 0x0000},
00207    {0xc000, 0x0000, 0x0000, 0x0000},
00208 /* {0x8000, 0x0000, 0x0000, 0x0000}, */  /* already have this one */
00209 
00210    /* shift 64 one bits through a 64-bit positive int */
00211 /* {0x0000, 0x0000, 0x0000, 0x0001}, */  /* already have this one */
00212    {0x0000, 0x0000, 0x0000, 0x0003},
00213    {0x0000, 0x0000, 0x0000, 0x0007},
00214    {0x0000, 0x0000, 0x0000, 0x000f},
00215    {0x0000, 0x0000, 0x0000, 0x001f},
00216    {0x0000, 0x0000, 0x0000, 0x003f},
00217    {0x0000, 0x0000, 0x0000, 0x007f},
00218    {0x0000, 0x0000, 0x0000, 0x00ff},
00219    {0x0000, 0x0000, 0x0000, 0x01ff},
00220    {0x0000, 0x0000, 0x0000, 0x03ff},
00221    {0x0000, 0x0000, 0x0000, 0x07ff},
00222    {0x0000, 0x0000, 0x0000, 0x0fff},
00223    {0x0000, 0x0000, 0x0000, 0x1fff},
00224    {0x0000, 0x0000, 0x0000, 0x3fff},
00225    {0x0000, 0x0000, 0x0000, 0x7fff},
00226    {0x0000, 0x0000, 0x0000, 0xffff},
00227    {0x0000, 0x0000, 0x0001, 0xffff},
00228    {0x0000, 0x0000, 0x0003, 0xffff},
00229    {0x0000, 0x0000, 0x0007, 0xffff},
00230    {0x0000, 0x0000, 0x000f, 0xffff},
00231    {0x0000, 0x0000, 0x001f, 0xffff},
00232    {0x0000, 0x0000, 0x003f, 0xffff},
00233    {0x0000, 0x0000, 0x007f, 0xffff},
00234    {0x0000, 0x0000, 0x00ff, 0xffff},
00235    {0x0000, 0x0000, 0x01ff, 0xffff},
00236    {0x0000, 0x0000, 0x03ff, 0xffff},
00237    {0x0000, 0x0000, 0x07ff, 0xffff},
00238    {0x0000, 0x0000, 0x0fff, 0xffff},
00239    {0x0000, 0x0000, 0x1fff, 0xffff},
00240    {0x0000, 0x0000, 0x3fff, 0xffff},
00241    {0x0000, 0x0000, 0x7fff, 0xffff},
00242    {0x0000, 0x0000, 0xffff, 0xffff},
00243    {0x0000, 0x0001, 0xffff, 0xffff},
00244    {0x0000, 0x0003, 0xffff, 0xffff},
00245    {0x0000, 0x0007, 0xffff, 0xffff},
00246    {0x0000, 0x000f, 0xffff, 0xffff},
00247    {0x0000, 0x001f, 0xffff, 0xffff},
00248    {0x0000, 0x003f, 0xffff, 0xffff},
00249    {0x0000, 0x007f, 0xffff, 0xffff},
00250    {0x0000, 0x00ff, 0xffff, 0xffff},
00251    {0x0000, 0x01ff, 0xffff, 0xffff},
00252    {0x0000, 0x03ff, 0xffff, 0xffff},
00253    {0x0000, 0x07ff, 0xffff, 0xffff},
00254    {0x0000, 0x0fff, 0xffff, 0xffff},
00255    {0x0000, 0x1fff, 0xffff, 0xffff},
00256    {0x0000, 0x3fff, 0xffff, 0xffff},
00257    {0x0000, 0x7fff, 0xffff, 0xffff},
00258    {0x0000, 0xffff, 0xffff, 0xffff},
00259    {0x0001, 0xffff, 0xffff, 0xffff},
00260    {0x0003, 0xffff, 0xffff, 0xffff},
00261    {0x0007, 0xffff, 0xffff, 0xffff},
00262    {0x000f, 0xffff, 0xffff, 0xffff},
00263    {0x001f, 0xffff, 0xffff, 0xffff},
00264    {0x003f, 0xffff, 0xffff, 0xffff},
00265    {0x007f, 0xffff, 0xffff, 0xffff},
00266    {0x00ff, 0xffff, 0xffff, 0xffff},
00267    {0x01ff, 0xffff, 0xffff, 0xffff},
00268    {0x03ff, 0xffff, 0xffff, 0xffff},
00269    {0x07ff, 0xffff, 0xffff, 0xffff},
00270    {0x0fff, 0xffff, 0xffff, 0xffff},
00271    {0x1fff, 0xffff, 0xffff, 0xffff},
00272    {0x3fff, 0xffff, 0xffff, 0xffff},
00273    {0x7fff, 0xffff, 0xffff, 0xffff},
00274    {0x7fff, 0xffff, 0xffff, 0xfffe},
00275    {0x7fff, 0xffff, 0xffff, 0xfffc},
00276    {0x7fff, 0xffff, 0xffff, 0xfff8},
00277    {0x7fff, 0xffff, 0xffff, 0xfff0},
00278    {0x7fff, 0xffff, 0xffff, 0xffe0},
00279    {0x7fff, 0xffff, 0xffff, 0xffc0},
00280    {0x7fff, 0xffff, 0xffff, 0xff80},
00281    {0x7fff, 0xffff, 0xffff, 0xff00},
00282    {0x7fff, 0xffff, 0xffff, 0xfe00},
00283    {0x7fff, 0xffff, 0xffff, 0xfc00},
00284    {0x7fff, 0xffff, 0xffff, 0xf800},
00285    {0x7fff, 0xffff, 0xffff, 0xf000},
00286    {0x7fff, 0xffff, 0xffff, 0xe000},
00287    {0x7fff, 0xffff, 0xffff, 0xc000},
00288    {0x7fff, 0xffff, 0xffff, 0x8000},
00289    {0x7fff, 0xffff, 0xffff, 0x0000},
00290    {0x7fff, 0xffff, 0xfffe, 0x0000},
00291    {0x7fff, 0xffff, 0xfffc, 0x0000},
00292    {0x7fff, 0xffff, 0xfff8, 0x0000},
00293    {0x7fff, 0xffff, 0xfff0, 0x0000},
00294    {0x7fff, 0xffff, 0xffe0, 0x0000},
00295    {0x7fff, 0xffff, 0xffc0, 0x0000},
00296    {0x7fff, 0xffff, 0xff80, 0x0000},
00297    {0x7fff, 0xffff, 0xff00, 0x0000},
00298    {0x7fff, 0xffff, 0xfe00, 0x0000},
00299    {0x7fff, 0xffff, 0xfc00, 0x0000},
00300    {0x7fff, 0xffff, 0xf800, 0x0000},
00301    {0x7fff, 0xffff, 0xf000, 0x0000},
00302    {0x7fff, 0xffff, 0xe000, 0x0000},
00303    {0x7fff, 0xffff, 0xc000, 0x0000},
00304    {0x7fff, 0xffff, 0x8000, 0x0000},
00305    {0x7fff, 0xffff, 0x0000, 0x0000},
00306    {0x7fff, 0xfffe, 0x0000, 0x0000},
00307    {0x7fff, 0xfffc, 0x0000, 0x0000},
00308    {0x7fff, 0xfff8, 0x0000, 0x0000},
00309    {0x7fff, 0xfff0, 0x0000, 0x0000},
00310    {0x7fff, 0xffe0, 0x0000, 0x0000},
00311    {0x7fff, 0xffc0, 0x0000, 0x0000},
00312    {0x7fff, 0xff80, 0x0000, 0x0000},
00313    {0x7fff, 0xff00, 0x0000, 0x0000},
00314    {0x7fff, 0xfe00, 0x0000, 0x0000},
00315    {0x7fff, 0xfc00, 0x0000, 0x0000},
00316    {0x7fff, 0xf800, 0x0000, 0x0000},
00317    {0x7fff, 0xf000, 0x0000, 0x0000},
00318    {0x7fff, 0xe000, 0x0000, 0x0000},
00319    {0x7fff, 0xc000, 0x0000, 0x0000},
00320    {0x7fff, 0x8000, 0x0000, 0x0000},
00321    {0x7fff, 0x0000, 0x0000, 0x0000},
00322    {0x7ffe, 0x0000, 0x0000, 0x0000},
00323    {0x7ffc, 0x0000, 0x0000, 0x0000},
00324    {0x7ff8, 0x0000, 0x0000, 0x0000},
00325    {0x7ff0, 0x0000, 0x0000, 0x0000},
00326    {0x7fe0, 0x0000, 0x0000, 0x0000},
00327    {0x7fc0, 0x0000, 0x0000, 0x0000},
00328    {0x7f80, 0x0000, 0x0000, 0x0000},
00329    {0x7f00, 0x0000, 0x0000, 0x0000},
00330    {0x7e00, 0x0000, 0x0000, 0x0000},
00331    {0x7c00, 0x0000, 0x0000, 0x0000},
00332    {0x7800, 0x0000, 0x0000, 0x0000},
00333    {0x7000, 0x0000, 0x0000, 0x0000},
00334    {0x6000, 0x0000, 0x0000, 0x0000},
00335    {0x4000, 0x0000, 0x0000, 0x0000},
00336 
00337    /* shift 64 one bits through a 64-bit negative int */
00338    {0x8000, 0x0000, 0x0000, 0x0001},
00339    {0x8000, 0x0000, 0x0000, 0x0003},
00340    {0x8000, 0x0000, 0x0000, 0x0007},
00341    {0x8000, 0x0000, 0x0000, 0x000f},
00342    {0x8000, 0x0000, 0x0000, 0x001f},
00343    {0x8000, 0x0000, 0x0000, 0x003f},
00344    {0x8000, 0x0000, 0x0000, 0x007f},
00345    {0x8000, 0x0000, 0x0000, 0x00ff},
00346    {0x8000, 0x0000, 0x0000, 0x01ff},
00347    {0x8000, 0x0000, 0x0000, 0x03ff},
00348    {0x8000, 0x0000, 0x0000, 0x07ff},
00349    {0x8000, 0x0000, 0x0000, 0x0fff},
00350    {0x8000, 0x0000, 0x0000, 0x1fff},
00351    {0x8000, 0x0000, 0x0000, 0x3fff},
00352    {0x8000, 0x0000, 0x0000, 0x7fff},
00353    {0x8000, 0x0000, 0x0000, 0xffff},
00354    {0x8000, 0x0000, 0x0001, 0xffff},
00355    {0x8000, 0x0000, 0x0003, 0xffff},
00356    {0x8000, 0x0000, 0x0007, 0xffff},
00357    {0x8000, 0x0000, 0x000f, 0xffff},
00358    {0x8000, 0x0000, 0x001f, 0xffff},
00359    {0x8000, 0x0000, 0x003f, 0xffff},
00360    {0x8000, 0x0000, 0x007f, 0xffff},
00361    {0x8000, 0x0000, 0x00ff, 0xffff},
00362    {0x8000, 0x0000, 0x01ff, 0xffff},
00363    {0x8000, 0x0000, 0x03ff, 0xffff},
00364    {0x8000, 0x0000, 0x07ff, 0xffff},
00365    {0x8000, 0x0000, 0x0fff, 0xffff},
00366    {0x8000, 0x0000, 0x1fff, 0xffff},
00367    {0x8000, 0x0000, 0x3fff, 0xffff},
00368    {0x8000, 0x0000, 0x7fff, 0xffff},
00369    {0x8000, 0x0000, 0xffff, 0xffff},
00370    {0x8000, 0x0001, 0xffff, 0xffff},
00371    {0x8000, 0x0003, 0xffff, 0xffff},
00372    {0x8000, 0x0007, 0xffff, 0xffff},
00373    {0x8000, 0x000f, 0xffff, 0xffff},
00374    {0x8000, 0x001f, 0xffff, 0xffff},
00375    {0x8000, 0x003f, 0xffff, 0xffff},
00376    {0x8000, 0x007f, 0xffff, 0xffff},
00377    {0x8000, 0x00ff, 0xffff, 0xffff},
00378    {0x8000, 0x01ff, 0xffff, 0xffff},
00379    {0x8000, 0x03ff, 0xffff, 0xffff},
00380    {0x8000, 0x07ff, 0xffff, 0xffff},
00381    {0x8000, 0x0fff, 0xffff, 0xffff},
00382    {0x8000, 0x1fff, 0xffff, 0xffff},
00383    {0x8000, 0x3fff, 0xffff, 0xffff},
00384    {0x8000, 0x7fff, 0xffff, 0xffff},
00385    {0x8000, 0xffff, 0xffff, 0xffff},
00386    {0x8001, 0xffff, 0xffff, 0xffff},
00387    {0x8003, 0xffff, 0xffff, 0xffff},
00388    {0x8007, 0xffff, 0xffff, 0xffff},
00389    {0x800f, 0xffff, 0xffff, 0xffff},
00390    {0x801f, 0xffff, 0xffff, 0xffff},
00391    {0x803f, 0xffff, 0xffff, 0xffff},
00392    {0x807f, 0xffff, 0xffff, 0xffff},
00393    {0x80ff, 0xffff, 0xffff, 0xffff},
00394    {0x81ff, 0xffff, 0xffff, 0xffff},
00395    {0x83ff, 0xffff, 0xffff, 0xffff},
00396    {0x87ff, 0xffff, 0xffff, 0xffff},
00397    {0x8fff, 0xffff, 0xffff, 0xffff},
00398    {0x9fff, 0xffff, 0xffff, 0xffff},
00399    {0xbfff, 0xffff, 0xffff, 0xffff},
00400    {0xffff, 0xffff, 0xffff, 0xffff},
00401    {0xffff, 0xffff, 0xffff, 0xfffe},
00402    {0xffff, 0xffff, 0xffff, 0xfffc},
00403    {0xffff, 0xffff, 0xffff, 0xfff8},
00404    {0xffff, 0xffff, 0xffff, 0xfff0},
00405    {0xffff, 0xffff, 0xffff, 0xffe0},
00406    {0xffff, 0xffff, 0xffff, 0xffc0},
00407    {0xffff, 0xffff, 0xffff, 0xff80},
00408    {0xffff, 0xffff, 0xffff, 0xff00},
00409    {0xffff, 0xffff, 0xffff, 0xfe00},
00410    {0xffff, 0xffff, 0xffff, 0xfc00},
00411    {0xffff, 0xffff, 0xffff, 0xf800},
00412    {0xffff, 0xffff, 0xffff, 0xf000},
00413    {0xffff, 0xffff, 0xffff, 0xe000},
00414    {0xffff, 0xffff, 0xffff, 0xc000},
00415    {0xffff, 0xffff, 0xffff, 0x8000},
00416    {0xffff, 0xffff, 0xffff, 0x0000},
00417    {0xffff, 0xffff, 0xfffe, 0x0000},
00418    {0xffff, 0xffff, 0xfffc, 0x0000},
00419    {0xffff, 0xffff, 0xfff8, 0x0000},
00420    {0xffff, 0xffff, 0xfff0, 0x0000},
00421    {0xffff, 0xffff, 0xffe0, 0x0000},
00422    {0xffff, 0xffff, 0xffc0, 0x0000},
00423    {0xffff, 0xffff, 0xff80, 0x0000},
00424    {0xffff, 0xffff, 0xff00, 0x0000},
00425    {0xffff, 0xffff, 0xfe00, 0x0000},
00426    {0xffff, 0xffff, 0xfc00, 0x0000},
00427    {0xffff, 0xffff, 0xf800, 0x0000},
00428    {0xffff, 0xffff, 0xf000, 0x0000},
00429    {0xffff, 0xffff, 0xe000, 0x0000},
00430    {0xffff, 0xffff, 0xc000, 0x0000},
00431    {0xffff, 0xffff, 0x8000, 0x0000},
00432    {0xffff, 0xffff, 0x0000, 0x0000},
00433    {0xffff, 0xfffe, 0x0000, 0x0000},
00434    {0xffff, 0xfffc, 0x0000, 0x0000},
00435    {0xffff, 0xfff8, 0x0000, 0x0000},
00436    {0xffff, 0xfff0, 0x0000, 0x0000},
00437    {0xffff, 0xffe0, 0x0000, 0x0000},
00438    {0xffff, 0xffc0, 0x0000, 0x0000},
00439    {0xffff, 0xff80, 0x0000, 0x0000},
00440    {0xffff, 0xff00, 0x0000, 0x0000},
00441    {0xffff, 0xfe00, 0x0000, 0x0000},
00442    {0xffff, 0xfc00, 0x0000, 0x0000},
00443    {0xffff, 0xf800, 0x0000, 0x0000},
00444    {0xffff, 0xf000, 0x0000, 0x0000},
00445    {0xffff, 0xe000, 0x0000, 0x0000},
00446    {0xffff, 0xc000, 0x0000, 0x0000},
00447    {0xffff, 0x8000, 0x0000, 0x0000},
00448    {0xffff, 0x0000, 0x0000, 0x0000},
00449    {0xfffe, 0x0000, 0x0000, 0x0000},
00450    {0xfffc, 0x0000, 0x0000, 0x0000},
00451    {0xfff8, 0x0000, 0x0000, 0x0000},
00452    {0xfff0, 0x0000, 0x0000, 0x0000},
00453    {0xffe0, 0x0000, 0x0000, 0x0000},
00454    {0xffc0, 0x0000, 0x0000, 0x0000},
00455    {0xff80, 0x0000, 0x0000, 0x0000},
00456    {0xff00, 0x0000, 0x0000, 0x0000},
00457    {0xfe00, 0x0000, 0x0000, 0x0000},
00458    {0xfc00, 0x0000, 0x0000, 0x0000},
00459    {0xf800, 0x0000, 0x0000, 0x0000},
00460    {0xf000, 0x0000, 0x0000, 0x0000},
00461    {0xe000, 0x0000, 0x0000, 0x0000},
00462    {0xc000, 0x0000, 0x0000, 0x0000}
00463 };
00464 int num_cool_64_ints = sizeof(cool_64_ints)/sizeof(AR_INT_64);
00465 
00466 AR_INT_64 cool_32_ints[] =
00467 {
00468    /* march a one bit though a positive 32-bit int */
00469    {0x0000, 0x0000, 0x0000, 0x0000},
00470    {0x0000, 0x0000, 0x0000, 0x0001},
00471    {0x0000, 0x0000, 0x0000, 0x0002},
00472    {0x0000, 0x0000, 0x0000, 0x0004},
00473    {0x0000, 0x0000, 0x0000, 0x0008},
00474    {0x0000, 0x0000, 0x0000, 0x0010},
00475    {0x0000, 0x0000, 0x0000, 0x0020},
00476    {0x0000, 0x0000, 0x0000, 0x0040},
00477    {0x0000, 0x0000, 0x0000, 0x0080},
00478    {0x0000, 0x0000, 0x0000, 0x0100},
00479    {0x0000, 0x0000, 0x0000, 0x0200},
00480    {0x0000, 0x0000, 0x0000, 0x0400},
00481    {0x0000, 0x0000, 0x0000, 0x0800},
00482    {0x0000, 0x0000, 0x0000, 0x1000},
00483    {0x0000, 0x0000, 0x0000, 0x2000},
00484    {0x0000, 0x0000, 0x0000, 0x4000},
00485    {0x0000, 0x0000, 0x0000, 0x8000},
00486    {0x0000, 0x0000, 0x0001, 0x0000},
00487    {0x0000, 0x0000, 0x0002, 0x0000},
00488    {0x0000, 0x0000, 0x0004, 0x0000},
00489    {0x0000, 0x0000, 0x0008, 0x0000},
00490    {0x0000, 0x0000, 0x0010, 0x0000},
00491    {0x0000, 0x0000, 0x0020, 0x0000},
00492    {0x0000, 0x0000, 0x0040, 0x0000},
00493    {0x0000, 0x0000, 0x0080, 0x0000},
00494    {0x0000, 0x0000, 0x0100, 0x0000},
00495    {0x0000, 0x0000, 0x0200, 0x0000},
00496    {0x0000, 0x0000, 0x0400, 0x0000},
00497    {0x0000, 0x0000, 0x0800, 0x0000},
00498    {0x0000, 0x0000, 0x1000, 0x0000},
00499    {0x0000, 0x0000, 0x2000, 0x0000},
00500    {0x0000, 0x0000, 0x4000, 0x0000},
00501    {0x0000, 0x0000, 0x8000, 0x0000},
00502 
00503    /* march a one bit though a negative 32-bit int */
00504 /* {0x0000, 0x0000, 0x8000, 0x0000}, */  /* already have this one */
00505    {0x0000, 0x0000, 0x8000, 0x0001},
00506    {0x0000, 0x0000, 0x8000, 0x0002},
00507    {0x0000, 0x0000, 0x8000, 0x0004},
00508    {0x0000, 0x0000, 0x8000, 0x0008},
00509    {0x0000, 0x0000, 0x8000, 0x0010},
00510    {0x0000, 0x0000, 0x8000, 0x0020},
00511    {0x0000, 0x0000, 0x8000, 0x0040},
00512    {0x0000, 0x0000, 0x8000, 0x0080},
00513    {0x0000, 0x0000, 0x8000, 0x0100},
00514    {0x0000, 0x0000, 0x8000, 0x0200},
00515    {0x0000, 0x0000, 0x8000, 0x0400},
00516    {0x0000, 0x0000, 0x8000, 0x0800},
00517    {0x0000, 0x0000, 0x8000, 0x1000},
00518    {0x0000, 0x0000, 0x8000, 0x2000},
00519    {0x0000, 0x0000, 0x8000, 0x4000},
00520    {0x0000, 0x0000, 0x8000, 0x8000},
00521    {0x0000, 0x0000, 0x8001, 0x0000},
00522    {0x0000, 0x0000, 0x8002, 0x0000},
00523    {0x0000, 0x0000, 0x8004, 0x0000},
00524    {0x0000, 0x0000, 0x8008, 0x0000},
00525    {0x0000, 0x0000, 0x8010, 0x0000},
00526    {0x0000, 0x0000, 0x8020, 0x0000},
00527    {0x0000, 0x0000, 0x8040, 0x0000},
00528    {0x0000, 0x0000, 0x8080, 0x0000},
00529    {0x0000, 0x0000, 0x8100, 0x0000},
00530    {0x0000, 0x0000, 0x8200, 0x0000},
00531    {0x0000, 0x0000, 0x8400, 0x0000},
00532    {0x0000, 0x0000, 0x8800, 0x0000},
00533    {0x0000, 0x0000, 0x9000, 0x0000},
00534    {0x0000, 0x0000, 0xa000, 0x0000},
00535    {0x0000, 0x0000, 0xc000, 0x0000},
00536 /* {0x0000, 0x0000, 0x8000, 0x0000}, */  /* already have this one */
00537 
00538    /* shift 32 one bits through a 32-bit positive int */
00539 /* {0x0000, 0x0000, 0x0000, 0x0001}, */  /* already have this one */
00540    {0x0000, 0x0000, 0x0000, 0x0003},
00541    {0x0000, 0x0000, 0x0000, 0x0007},
00542    {0x0000, 0x0000, 0x0000, 0x000f},
00543    {0x0000, 0x0000, 0x0000, 0x001f},
00544    {0x0000, 0x0000, 0x0000, 0x003f},
00545    {0x0000, 0x0000, 0x0000, 0x007f},
00546    {0x0000, 0x0000, 0x0000, 0x00ff},
00547    {0x0000, 0x0000, 0x0000, 0x01ff},
00548    {0x0000, 0x0000, 0x0000, 0x03ff},
00549    {0x0000, 0x0000, 0x0000, 0x07ff},
00550    {0x0000, 0x0000, 0x0000, 0x0fff},
00551    {0x0000, 0x0000, 0x0000, 0x1fff},
00552    {0x0000, 0x0000, 0x0000, 0x3fff},
00553    {0x0000, 0x0000, 0x0000, 0x7fff},
00554    {0x0000, 0x0000, 0x0000, 0xffff},
00555    {0x0000, 0x0000, 0x0001, 0xffff},
00556    {0x0000, 0x0000, 0x0003, 0xffff},
00557    {0x0000, 0x0000, 0x0007, 0xffff},
00558    {0x0000, 0x0000, 0x000f, 0xffff},
00559    {0x0000, 0x0000, 0x001f, 0xffff},
00560    {0x0000, 0x0000, 0x003f, 0xffff},
00561    {0x0000, 0x0000, 0x007f, 0xffff},
00562    {0x0000, 0x0000, 0x00ff, 0xffff},
00563    {0x0000, 0x0000, 0x01ff, 0xffff},
00564    {0x0000, 0x0000, 0x03ff, 0xffff},
00565    {0x0000, 0x0000, 0x07ff, 0xffff},
00566    {0x0000, 0x0000, 0x0fff, 0xffff},
00567    {0x0000, 0x0000, 0x1fff, 0xffff},
00568    {0x0000, 0x0000, 0x3fff, 0xffff},
00569    {0x0000, 0x0000, 0x7fff, 0xffff},
00570    {0x0000, 0x0000, 0x7fff, 0xfffe},
00571    {0x0000, 0x0000, 0x7fff, 0xfffc},
00572    {0x0000, 0x0000, 0x7fff, 0xfff8},
00573    {0x0000, 0x0000, 0x7fff, 0xfff0},
00574    {0x0000, 0x0000, 0x7fff, 0xffe0},
00575    {0x0000, 0x0000, 0x7fff, 0xffc0},
00576    {0x0000, 0x0000, 0x7fff, 0xff80},
00577    {0x0000, 0x0000, 0x7fff, 0xff00},
00578    {0x0000, 0x0000, 0x7fff, 0xfe00},
00579    {0x0000, 0x0000, 0x7fff, 0xfc00},
00580    {0x0000, 0x0000, 0x7fff, 0xf800},
00581    {0x0000, 0x0000, 0x7fff, 0xf000},
00582    {0x0000, 0x0000, 0x7fff, 0xe000},
00583    {0x0000, 0x0000, 0x7fff, 0xc000},
00584    {0x0000, 0x0000, 0x7fff, 0x8000},
00585    {0x0000, 0x0000, 0x7fff, 0x0000},
00586    {0x0000, 0x0000, 0x7ffe, 0x0000},
00587    {0x0000, 0x0000, 0x7ffc, 0x0000},
00588    {0x0000, 0x0000, 0x7ff8, 0x0000},
00589    {0x0000, 0x0000, 0x7ff0, 0x0000},
00590    {0x0000, 0x0000, 0x7fe0, 0x0000},
00591    {0x0000, 0x0000, 0x7fc0, 0x0000},
00592    {0x0000, 0x0000, 0x7f80, 0x0000},
00593    {0x0000, 0x0000, 0x7f00, 0x0000},
00594    {0x0000, 0x0000, 0x7e00, 0x0000},
00595    {0x0000, 0x0000, 0x7c00, 0x0000},
00596    {0x0000, 0x0000, 0x7800, 0x0000},
00597    {0x0000, 0x0000, 0x7000, 0x0000},
00598    {0x0000, 0x0000, 0x6000, 0x0000},
00599    {0x0000, 0x0000, 0x4000, 0x0000},
00600 
00601    /* shift 32 one bits through a 32-bit negative int */
00602    {0x0000, 0x0000, 0x8000, 0x0001},
00603    {0x0000, 0x0000, 0x8000, 0x0003},
00604    {0x0000, 0x0000, 0x8000, 0x0007},
00605    {0x0000, 0x0000, 0x8000, 0x000f},
00606    {0x0000, 0x0000, 0x8000, 0x001f},
00607    {0x0000, 0x0000, 0x8000, 0x003f},
00608    {0x0000, 0x0000, 0x8000, 0x007f},
00609    {0x0000, 0x0000, 0x8000, 0x00ff},
00610    {0x0000, 0x0000, 0x8000, 0x01ff},
00611    {0x0000, 0x0000, 0x8000, 0x03ff},
00612    {0x0000, 0x0000, 0x8000, 0x07ff},
00613    {0x0000, 0x0000, 0x8000, 0x0fff},
00614    {0x0000, 0x0000, 0x8000, 0x1fff},
00615    {0x0000, 0x0000, 0x8000, 0x3fff},
00616    {0x0000, 0x0000, 0x8000, 0x7fff},
00617    {0x0000, 0x0000, 0x8000, 0xffff},
00618    {0x0000, 0x0000, 0x8001, 0xffff},
00619    {0x0000, 0x0000, 0x8003, 0xffff},
00620    {0x0000, 0x0000, 0x8007, 0xffff},
00621    {0x0000, 0x0000, 0x800f, 0xffff},
00622    {0x0000, 0x0000, 0x801f, 0xffff},
00623    {0x0000, 0x0000, 0x803f, 0xffff},
00624    {0x0000, 0x0000, 0x807f, 0xffff},
00625    {0x0000, 0x0000, 0x80ff, 0xffff},
00626    {0x0000, 0x0000, 0x81ff, 0xffff},
00627    {0x0000, 0x0000, 0x83ff, 0xffff},
00628    {0x0000, 0x0000, 0x87ff, 0xffff},
00629    {0x0000, 0x0000, 0x8fff, 0xffff},
00630    {0x0000, 0x0000, 0x9fff, 0xffff},
00631    {0x0000, 0x0000, 0xbfff, 0xffff},
00632    {0x0000, 0x0000, 0xffff, 0xffff},
00633    {0x0000, 0x0000, 0xffff, 0xfffe},
00634    {0x0000, 0x0000, 0xffff, 0xfffc},
00635    {0x0000, 0x0000, 0xffff, 0xfff8},
00636    {0x0000, 0x0000, 0xffff, 0xfff0},
00637    {0x0000, 0x0000, 0xffff, 0xffe0},
00638    {0x0000, 0x0000, 0xffff, 0xffc0},
00639    {0x0000, 0x0000, 0xffff, 0xff80},
00640    {0x0000, 0x0000, 0xffff, 0xff00},
00641    {0x0000, 0x0000, 0xffff, 0xfe00},
00642    {0x0000, 0x0000, 0xffff, 0xfc00},
00643    {0x0000, 0x0000, 0xffff, 0xf800},
00644    {0x0000, 0x0000, 0xffff, 0xf000},
00645    {0x0000, 0x0000, 0xffff, 0xe000},
00646    {0x0000, 0x0000, 0xffff, 0xc000},
00647    {0x0000, 0x0000, 0xffff, 0x8000},
00648    {0x0000, 0x0000, 0xffff, 0x0000},
00649    {0x0000, 0x0000, 0xfffe, 0x0000},
00650    {0x0000, 0x0000, 0xfffc, 0x0000},
00651    {0x0000, 0x0000, 0xfff8, 0x0000},
00652    {0x0000, 0x0000, 0xfff0, 0x0000},
00653    {0x0000, 0x0000, 0xffe0, 0x0000},
00654    {0x0000, 0x0000, 0xffc0, 0x0000},
00655    {0x0000, 0x0000, 0xff80, 0x0000},
00656    {0x0000, 0x0000, 0xff00, 0x0000},
00657    {0x0000, 0x0000, 0xfe00, 0x0000},
00658    {0x0000, 0x0000, 0xfc00, 0x0000},
00659    {0x0000, 0x0000, 0xf800, 0x0000},
00660    {0x0000, 0x0000, 0xf000, 0x0000},
00661    {0x0000, 0x0000, 0xe000, 0x0000},
00662    {0x0000, 0x0000, 0xc000, 0x0000},
00663    {0x0000, 0x0000, 0x8000, 0x0000}
00664 };
00665 int num_cool_32_ints = sizeof(cool_32_ints)/sizeof(AR_INT_64);
00666 
00667 AR_INT_64 cool_24_ints[] =
00668 {
00669    /* march a one bit though a positive 24-bit int */
00670    {0x0000, 0x0000, 0x0000, 0x0000},
00671    {0x0000, 0x0000, 0x0000, 0x0001},
00672    {0x0000, 0x0000, 0x0000, 0x0002},
00673    {0x0000, 0x0000, 0x0000, 0x0004},
00674    {0x0000, 0x0000, 0x0000, 0x0008},
00675    {0x0000, 0x0000, 0x0000, 0x0010},
00676    {0x0000, 0x0000, 0x0000, 0x0020},
00677    {0x0000, 0x0000, 0x0000, 0x0040},
00678    {0x0000, 0x0000, 0x0000, 0x0080},
00679    {0x0000, 0x0000, 0x0000, 0x0100},
00680    {0x0000, 0x0000, 0x0000, 0x0200},
00681    {0x0000, 0x0000, 0x0000, 0x0400},
00682    {0x0000, 0x0000, 0x0000, 0x0800},
00683    {0x0000, 0x0000, 0x0000, 0x1000},
00684    {0x0000, 0x0000, 0x0000, 0x2000},
00685    {0x0000, 0x0000, 0x0000, 0x4000},
00686    {0x0000, 0x0000, 0x0000, 0x8000},
00687    {0x0000, 0x0000, 0x0001, 0x0000},
00688    {0x0000, 0x0000, 0x0002, 0x0000},
00689    {0x0000, 0x0000, 0x0004, 0x0000},
00690    {0x0000, 0x0000, 0x0008, 0x0000},
00691    {0x0000, 0x0000, 0x0010, 0x0000},
00692    {0x0000, 0x0000, 0x0020, 0x0000},
00693    {0x0000, 0x0000, 0x0040, 0x0000},
00694    {0x0000, 0x0000, 0x0080, 0x0000},
00695 
00696    /* march a one bit though a negative 24-bit int */
00697 /* {0x0000, 0x0000, 0x0080, 0x0000}, */  /* already have this one */
00698    {0x0000, 0x0000, 0x0080, 0x0001},
00699    {0x0000, 0x0000, 0x0080, 0x0002},
00700    {0x0000, 0x0000, 0x0080, 0x0004},
00701    {0x0000, 0x0000, 0x0080, 0x0008},
00702    {0x0000, 0x0000, 0x0080, 0x0010},
00703    {0x0000, 0x0000, 0x0080, 0x0020},
00704    {0x0000, 0x0000, 0x0080, 0x0040},
00705    {0x0000, 0x0000, 0x0080, 0x0080},
00706    {0x0000, 0x0000, 0x0080, 0x0100},
00707    {0x0000, 0x0000, 0x0080, 0x0200},
00708    {0x0000, 0x0000, 0x0080, 0x0400},
00709    {0x0000, 0x0000, 0x0080, 0x0800},
00710    {0x0000, 0x0000, 0x0080, 0x1000},
00711    {0x0000, 0x0000, 0x0080, 0x2000},
00712    {0x0000, 0x0000, 0x0080, 0x4000},
00713    {0x0000, 0x0000, 0x0080, 0x8000},
00714    {0x0000, 0x0000, 0x0081, 0x0000},
00715    {0x0000, 0x0000, 0x0082, 0x0000},
00716    {0x0000, 0x0000, 0x0084, 0x0000},
00717    {0x0000, 0x0000, 0x0088, 0x0000},
00718    {0x0000, 0x0000, 0x0090, 0x0000},
00719    {0x0000, 0x0000, 0x00a0, 0x0000},
00720    {0x0000, 0x0000, 0x00c0, 0x0000},
00721 /* {0x0000, 0x0000, 0x0080, 0x0000}, */  /* already have this one */
00722 
00723    /* shift 24 one bits through a 24-bit positive int */
00724 /* {0x0000, 0x0000, 0x0000, 0x0001}, */  /* already have this one */
00725    {0x0000, 0x0000, 0x0000, 0x0003},
00726    {0x0000, 0x0000, 0x0000, 0x0007},
00727    {0x0000, 0x0000, 0x0000, 0x000f},
00728    {0x0000, 0x0000, 0x0000, 0x001f},
00729    {0x0000, 0x0000, 0x0000, 0x003f},
00730    {0x0000, 0x0000, 0x0000, 0x007f},
00731    {0x0000, 0x0000, 0x0000, 0x00ff},
00732    {0x0000, 0x0000, 0x0000, 0x01ff},
00733    {0x0000, 0x0000, 0x0000, 0x03ff},
00734    {0x0000, 0x0000, 0x0000, 0x07ff},
00735    {0x0000, 0x0000, 0x0000, 0x0fff},
00736    {0x0000, 0x0000, 0x0000, 0x1fff},
00737    {0x0000, 0x0000, 0x0000, 0x3fff},
00738    {0x0000, 0x0000, 0x0000, 0x7fff},
00739    {0x0000, 0x0000, 0x0000, 0xffff},
00740    {0x0000, 0x0000, 0x0001, 0xffff},
00741    {0x0000, 0x0000, 0x0003, 0xffff},
00742    {0x0000, 0x0000, 0x0007, 0xffff},
00743    {0x0000, 0x0000, 0x000f, 0xffff},
00744    {0x0000, 0x0000, 0x001f, 0xffff},
00745    {0x0000, 0x0000, 0x003f, 0xffff},
00746    {0x0000, 0x0000, 0x007f, 0xffff},
00747    {0x0000, 0x0000, 0x007f, 0xfffe},
00748    {0x0000, 0x0000, 0x007f, 0xfffc},
00749    {0x0000, 0x0000, 0x007f, 0xfff8},
00750    {0x0000, 0x0000, 0x007f, 0xfff0},
00751    {0x0000, 0x0000, 0x007f, 0xffe0},
00752    {0x0000, 0x0000, 0x007f, 0xffc0},
00753    {0x0000, 0x0000, 0x007f, 0xff80},
00754    {0x0000, 0x0000, 0x007f, 0xff00},
00755    {0x0000, 0x0000, 0x007f, 0xfe00},
00756    {0x0000, 0x0000, 0x007f, 0xfc00},
00757    {0x0000, 0x0000, 0x007f, 0xf800},
00758    {0x0000, 0x0000, 0x007f, 0xf000},
00759    {0x0000, 0x0000, 0x007f, 0xe000},
00760    {0x0000, 0x0000, 0x007f, 0xc000},
00761    {0x0000, 0x0000, 0x007f, 0x8000},
00762    {0x0000, 0x0000, 0x007f, 0x0000},
00763    {0x0000, 0x0000, 0x007e, 0x0000},
00764    {0x0000, 0x0000, 0x007c, 0x0000},
00765    {0x0000, 0x0000, 0x0078, 0x0000},
00766    {0x0000, 0x0000, 0x0070, 0x0000},
00767    {0x0000, 0x0000, 0x0060, 0x0000},
00768    {0x0000, 0x0000, 0x0040, 0x0000},
00769 
00770    /* shift 24 one bits through a 24-bit negative int */
00771    {0x0000, 0x0000, 0x0080, 0x0001},
00772    {0x0000, 0x0000, 0x0080, 0x0003},
00773    {0x0000, 0x0000, 0x0080, 0x0007},
00774    {0x0000, 0x0000, 0x0080, 0x000f},
00775    {0x0000, 0x0000, 0x0080, 0x001f},
00776    {0x0000, 0x0000, 0x0080, 0x003f},
00777    {0x0000, 0x0000, 0x0080, 0x007f},
00778    {0x0000, 0x0000, 0x0080, 0x00ff},
00779    {0x0000, 0x0000, 0x0080, 0x01ff},
00780    {0x0000, 0x0000, 0x0080, 0x03ff},
00781    {0x0000, 0x0000, 0x0080, 0x07ff},
00782    {0x0000, 0x0000, 0x0080, 0x0fff},
00783    {0x0000, 0x0000, 0x0080, 0x1fff},
00784    {0x0000, 0x0000, 0x0080, 0x3fff},
00785    {0x0000, 0x0000, 0x0080, 0x7fff},
00786    {0x0000, 0x0000, 0x0080, 0xffff},
00787    {0x0000, 0x0000, 0x0081, 0xffff},
00788    {0x0000, 0x0000, 0x0083, 0xffff},
00789    {0x0000, 0x0000, 0x0087, 0xffff},
00790    {0x0000, 0x0000, 0x008f, 0xffff},
00791    {0x0000, 0x0000, 0x009f, 0xffff},
00792    {0x0000, 0x0000, 0x00bf, 0xffff},
00793    {0x0000, 0x0000, 0x00ff, 0xffff},
00794    {0x0000, 0x0000, 0x00ff, 0xfffe},
00795    {0x0000, 0x0000, 0x00ff, 0xfffc},
00796    {0x0000, 0x0000, 0x00ff, 0xfff8},
00797    {0x0000, 0x0000, 0x00ff, 0xfff0},
00798    {0x0000, 0x0000, 0x00ff, 0xffe0},
00799    {0x0000, 0x0000, 0x00ff, 0xffc0},
00800    {0x0000, 0x0000, 0x00ff, 0xff80},
00801    {0x0000, 0x0000, 0x00ff, 0xff00},
00802    {0x0000, 0x0000, 0x00ff, 0xfe00},
00803    {0x0000, 0x0000, 0x00ff, 0xfc00},
00804    {0x0000, 0x0000, 0x00ff, 0xf800},
00805    {0x0000, 0x0000, 0x00ff, 0xf000},
00806    {0x0000, 0x0000, 0x00ff, 0xe000},
00807    {0x0000, 0x0000, 0x00ff, 0xc000},
00808    {0x0000, 0x0000, 0x00ff, 0x8000},
00809    {0x0000, 0x0000, 0x00ff, 0x0000},
00810    {0x0000, 0x0000, 0x00fe, 0x0000},
00811    {0x0000, 0x0000, 0x00fc, 0x0000},
00812    {0x0000, 0x0000, 0x00f8, 0x0000},
00813    {0x0000, 0x0000, 0x00f0, 0x0000},
00814    {0x0000, 0x0000, 0x00e0, 0x0000},
00815    {0x0000, 0x0000, 0x00c0, 0x0000},
00816    {0x0000, 0x0000, 0x0080, 0x0000}
00817 };
00818 int num_cool_24_ints = sizeof(cool_24_ints)/sizeof(AR_INT_64);
00819 
00820 AR_INT_64 cool_8_ints[] =
00821 {
00822    /* march a one bit though a positive 8-bit int */
00823    {0x0000, 0x0000, 0x0000, 0x0000},
00824    {0x0000, 0x0000, 0x0000, 0x0001},
00825    {0x0000, 0x0000, 0x0000, 0x0002},
00826    {0x0000, 0x0000, 0x0000, 0x0004},
00827    {0x0000, 0x0000, 0x0000, 0x0008},
00828    {0x0000, 0x0000, 0x0000, 0x0010},
00829    {0x0000, 0x0000, 0x0000, 0x0020},
00830    {0x0000, 0x0000, 0x0000, 0x0040},
00831    {0x0000, 0x0000, 0x0000, 0x0080},
00832 
00833    /* march a one bit though a negative 8-bit int */
00834 /* {0x0000, 0x0000, 0x0000, 0x0080}, */  /* already have this one */
00835    {0x0000, 0x0000, 0x0000, 0x0081},
00836    {0x0000, 0x0000, 0x0000, 0x0082},
00837    {0x0000, 0x0000, 0x0000, 0x0084},
00838    {0x0000, 0x0000, 0x0000, 0x0088},
00839    {0x0000, 0x0000, 0x0000, 0x0090},
00840    {0x0000, 0x0000, 0x0000, 0x00a0},
00841    {0x0000, 0x0000, 0x0000, 0x00c0},
00842 /* {0x0000, 0x0000, 0x0000, 0x0080}, */  /* already have this one */
00843 
00844    /* shift 8 one bits through a 8-bit positive int */
00845 /* {0x0000, 0x0000, 0x0000, 0x0001}, */  /* already have this one */
00846    {0x0000, 0x0000, 0x0000, 0x0003},
00847    {0x0000, 0x0000, 0x0000, 0x0007},
00848    {0x0000, 0x0000, 0x0000, 0x000f},
00849    {0x0000, 0x0000, 0x0000, 0x001f},
00850    {0x0000, 0x0000, 0x0000, 0x003f},
00851    {0x0000, 0x0000, 0x0000, 0x007f},
00852    {0x0000, 0x0000, 0x0000, 0x007e},
00853    {0x0000, 0x0000, 0x0000, 0x007c},
00854    {0x0000, 0x0000, 0x0000, 0x0078},
00855    {0x0000, 0x0000, 0x0000, 0x0070},
00856    {0x0000, 0x0000, 0x0000, 0x0060},
00857    {0x0000, 0x0000, 0x0000, 0x0040},
00858 
00859    /* shift 8 one bits through a 8-bit negative int */
00860    {0x0000, 0x0000, 0x0000, 0x0081},
00861    {0x0000, 0x0000, 0x0000, 0x0083},
00862    {0x0000, 0x0000, 0x0000, 0x0087},
00863    {0x0000, 0x0000, 0x0000, 0x008f},
00864    {0x0000, 0x0000, 0x0000, 0x009f},
00865    {0x0000, 0x0000, 0x0000, 0x00bf},
00866    {0x0000, 0x0000, 0x0000, 0x00ff},
00867    {0x0000, 0x0000, 0x0000, 0x00fe},
00868    {0x0000, 0x0000, 0x0000, 0x00fc},
00869    {0x0000, 0x0000, 0x0000, 0x00f8},
00870    {0x0000, 0x0000, 0x0000, 0x00f0},
00871    {0x0000, 0x0000, 0x0000, 0x00e0},
00872    {0x0000, 0x0000, 0x0000, 0x00c0},
00873    {0x0000, 0x0000, 0x0000, 0x0080}
00874 };
00875 int num_cool_8_ints = sizeof(cool_8_ints)/sizeof(AR_INT_64);
00876 
00877 
00878 AR_TYPE ar_types[] =
00879 {
00880    AR_Int_8_S,
00881    AR_Int_8_U,
00882    AR_Int_24_S,
00883    AR_Int_24_U,
00884    AR_Int_32_S,
00885    AR_Int_32_U,
00886    AR_Int_46_S,
00887    AR_Int_64_S,
00888    AR_Int_64_U
00889 };
00890 int num_ar_types = sizeof(ar_types) / sizeof(AR_TYPE);
00891 
00892 
00893 SINT64 act_result[sizeof(cool_64_ints)/sizeof(AR_INT_64)];
00894 int act_status[sizeof(cool_64_ints)/sizeof(AR_INT_64)];
00895 
00896 AR_INT_64 test_result[sizeof(cool_64_ints)/sizeof(AR_INT_64)];
00897 int test_status[sizeof(cool_64_ints)/sizeof(AR_INT_64)];
00898 
00899 AR_TYPE uint64_artype = AR_Int_64_U;
00900 AR_TYPE sint64_artype = AR_Int_64_S;
00901 AR_TYPE sint46_artype = AR_Int_46_S;
00902 AR_TYPE uint32_artype = AR_Int_32_U;
00903 AR_TYPE sint32_artype = AR_Int_32_S;
00904 AR_TYPE uint24_artype = AR_Int_24_U;
00905 AR_TYPE sint24_artype = AR_Int_24_S;
00906 AR_TYPE uint8_artype = AR_Int_8_U;
00907 AR_TYPE sint8_artype = AR_Int_8_S;
00908 
00909 
00910 main()
00911 {
00912    test_64_U();
00913    test_64_S();
00914    test_46_S();
00915    test_32_U();
00916    test_32_S();
00917    test_24_U();
00918    test_24_S();
00919    test_8_U();
00920    test_8_S();
00921 }
00922 
00923 
00924 test_64_U()
00925 {
00926    int i;
00927 
00928 
00929    printf(" Testing convert:  UNSIGNED 64 INT -> UNSIGNED 64 INT :  ");
00930 
00931    for (i=0; i<num_cool_64_ints; i++)
00932    {
00933       act_result[i] = (UINT64)(UINT64)(*(UINT64 *)&cool_64_ints[i]);
00934       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
00935 
00936       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
00937                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
00938 
00939       if (*(SINT64 *)&test_result[i] != act_result[i])
00940       {
00941          printf(" ERROR:  incorrect result at %d\n", i);
00942          abort();
00943       }
00944 
00945       if (act_status[i] != test_status[i])
00946       {
00947          printf(" ERROR:  incorrect status at %d\n", i);
00948          abort();
00949       }
00950    }
00951    printf("PASSED\n");
00952 
00953 
00954    printf(" Testing convert:  UNSIGNED 64 INT ->   SIGNED 64 INT :  ");
00955 
00956    for (i=0; i<num_cool_64_ints; i++)
00957    {
00958       act_result[i] = (UINT64)(SINT64)(*(UINT64 *)&cool_64_ints[i]);
00959       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
00960       if (cool_64_ints[i].part1 & 0x8000) {
00961          act_status[i] |= AR_STAT_NEGATIVE | AR_STAT_SEMIVALID;
00962          if((cool_64_ints[i].part1 & 0x7fff) || cool_64_ints[i].part2 ||
00963             cool_64_ints[i].part3 || cool_64_ints[i].part4)
00964            act_status[i] |=  AR_STAT_OVERFLOW;
00965       }
00966 
00967       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
00968                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
00969 
00970       if (*(SINT64 *)&test_result[i] != act_result[i])
00971       {
00972          printf(" ERROR:  incorrect result at %d\n", i);
00973          abort();
00974       }
00975 
00976       if (act_status[i] != test_status[i])
00977       {
00978          printf(" ERROR:  incorrect status at %d\n", i);
00979          abort();
00980       }
00981    }
00982    printf("PASSED\n");
00983 
00984 
00985    printf(" Testing convert:  UNSIGNED 64 INT ->   SIGNED 46 INT :  ");
00986 
00987    for (i=0; i<num_cool_64_ints; i++)
00988    {
00989       act_result[i] = (UINT64)(SINT46)(*(UINT64 *)&cool_64_ints[i]);
00990       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
00991       if (cool_64_ints[i].part1 & 0x8000) {
00992          act_status[i] |= AR_STAT_NEGATIVE | AR_STAT_SEMIVALID;
00993          if((cool_64_ints[i].part1 & 0x7fff) || cool_64_ints[i].part2 ||
00994             cool_64_ints[i].part3 || cool_64_ints[i].part4)
00995            act_status[i] |=  AR_STAT_OVERFLOW;
00996       }
00997       else if (INT_OVERFLOWS_46_BITS(act_result[i]))
00998       {  /* int too big for 46-bit int */
00999          act_status[i] |= AR_STAT_OVERFLOW;
01000       }
01001 
01002       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
01003                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
01004 
01005       if (*(SINT64 *)&test_result[i] != act_result[i])
01006       {
01007          printf(" ERROR:  incorrect result at %d\n", i);
01008          abort();
01009       }
01010 
01011       if (act_status[i] != test_status[i])
01012       {
01013          printf(" ERROR:  incorrect status at %d\n", i);
01014          abort();
01015       }
01016    }
01017    printf("PASSED\n");
01018 
01019 
01020    printf(" Testing convert:  UNSIGNED 64 INT -> UNSIGNED 32 INT :  ");
01021 
01022    for (i=0; i<num_cool_64_ints; i++)
01023    {
01024       act_result[i] = (UINT64)(UINT32)(*(UINT64 *)&cool_64_ints[i]);
01025       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01026 
01027       if (*(UINT64 *)&cool_64_ints[i] !=
01028                (UINT64)(UINT32)*(UINT64 *)&cool_64_ints[i])
01029       {   /* result cast back to original type does not match original value */
01030          act_status[i] |= AR_STAT_OVERFLOW;
01031       }
01032 
01033       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
01034                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
01035 
01036       if (*(SINT64 *)&test_result[i] != act_result[i])
01037       {
01038          printf(" ERROR:  incorrect result at %d\n", i);
01039          abort();
01040       }
01041 
01042       if (act_status[i] != test_status[i])
01043       {
01044          printf(" ERROR:  incorrect status at %d\n", i);
01045          abort();
01046       }
01047    }
01048    printf("PASSED\n");
01049 
01050 
01051    printf(" Testing convert:  UNSIGNED 64 INT ->   SIGNED 32 INT :  ");
01052 
01053    for (i=0; i<num_cool_64_ints; i++)
01054    {
01055       act_result[i] = (*(UINT64 *)&cool_64_ints[i]) & 0xffffffff;
01056       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01057       if ((SINT32)(*(UINT64 *)&cool_64_ints[i]) < 0) {
01058          act_status[i] |= AR_STAT_NEGATIVE;
01059       }
01060 
01061       if (((SINT32)*(UINT64 *)&cool_64_ints[i] < 0) ^
01062           (        *(UINT64 *)&cool_64_ints[i] < 0))
01063       {   /* sign before and after cast does not match */
01064          act_status[i] |= AR_STAT_OVERFLOW;
01065       }
01066       else if (*(UINT64 *)&cool_64_ints[i] !=
01067                (UINT64)(SINT32)*(UINT64 *)&cool_64_ints[i])
01068       {   /* result cast back to original type does not match original value */
01069          act_status[i] |= AR_STAT_OVERFLOW;
01070       }
01071 
01072       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
01073                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
01074 
01075       if (*(SINT64 *)&test_result[i] != act_result[i])
01076       {
01077          printf(" ERROR:  incorrect result at %d\n", i);
01078          abort();
01079       }
01080 
01081       if (act_status[i] != test_status[i])
01082       {
01083          printf(" ERROR:  incorrect status at %d\n", i);
01084          abort();
01085       }
01086    }
01087    printf("PASSED\n");
01088 
01089 
01090    printf(" Testing convert:  UNSIGNED 64 INT -> UNSIGNED 24 INT :  ");
01091 
01092    for (i=0; i<num_cool_64_ints; i++)
01093    {
01094       act_result[i] = (*(UINT64 *)&cool_64_ints[i]) & 0xffffff;
01095       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01096 
01097       if (*(UINT64 *)&cool_64_ints[i] != (UINT64)act_result[i])
01098       {   /* result cast back to original type does not match original value */
01099          act_status[i] |= AR_STAT_OVERFLOW;
01100       }
01101 
01102       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
01103                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
01104 
01105       if (*(SINT64 *)&test_result[i] != act_result[i])
01106       {
01107          printf(" ERROR:  incorrect result at %d\n", i);
01108          abort();
01109       }
01110 
01111       if (act_status[i] != test_status[i])
01112       {
01113          printf(" ERROR:  incorrect status at %d\n", i);
01114          abort();
01115       }
01116    }
01117    printf("PASSED\n");
01118 
01119 
01120    printf(" Testing convert:  UNSIGNED 64 INT ->   SIGNED 24 INT :  ");
01121 
01122    for (i=0; i<num_cool_64_ints; i++)
01123    {
01124       act_result[i] = (*(UINT64 *)&cool_64_ints[i]) & 0xffffff;
01125       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01126       if ((*(UINT64 *)&cool_64_ints[i]) & 0x800000) {
01127          act_status[i] |= AR_STAT_NEGATIVE;
01128       }
01129 
01130       if (((*(UINT64 *)&cool_64_ints[i] & 0x800000) != 0) ^
01131            (*(UINT64 *)&cool_64_ints[i] < 0))
01132       {   /* sign before and after cast does not match */
01133          act_status[i] |= AR_STAT_OVERFLOW;
01134       }
01135       else if (*(UINT64 *)&cool_64_ints[i] !=
01136                ((act_result[i] & 0x800000) ?
01137                                         act_result[i] | 0xffffffffff000000 :
01138                                         act_result[i]))
01139       {   /* result cast back to original type does not match original value */
01140          act_status[i] |= AR_STAT_OVERFLOW;
01141       }
01142 
01143       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
01144                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
01145 
01146       if (*(SINT64 *)&test_result[i] != act_result[i])
01147       {
01148          printf(" ERROR:  incorrect result at %d\n", i);
01149          abort();
01150       }
01151 
01152       if (act_status[i] != test_status[i])
01153       {
01154          printf(" ERROR:  incorrect status at %d\n", i);
01155          abort();
01156       }
01157    }
01158    printf("PASSED\n");
01159 
01160 
01161    printf(" Testing convert:  UNSIGNED 64 INT -> UNSIGNED  8 INT :  ");
01162 
01163    for (i=0; i<num_cool_64_ints; i++)
01164    {
01165       act_result[i] = (UINT64)(UINT8)(*(UINT64 *)&cool_64_ints[i]);
01166       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01167 
01168       if (*(UINT64 *)&cool_64_ints[i] !=
01169                (UINT64)(UINT8)*(UINT64 *)&cool_64_ints[i])
01170       {   /* result cast back to original type does not match original value */
01171          act_status[i] |= AR_STAT_OVERFLOW;
01172       }
01173 
01174       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
01175                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
01176 
01177       if (*(SINT64 *)&test_result[i] != act_result[i])
01178       {
01179          printf(" ERROR:  incorrect result at %d\n", i);
01180          abort();
01181       }
01182 
01183       if (act_status[i] != test_status[i])
01184       {
01185          printf(" ERROR:  incorrect status at %d\n", i);
01186          abort();
01187       }
01188    }
01189    printf("PASSED\n");
01190 
01191 
01192    printf(" Testing convert:  UNSIGNED 64 INT ->   SIGNED  8 INT :  ");
01193 
01194    for (i=0; i<num_cool_64_ints; i++)
01195    {
01196       act_result[i] = (*(UINT64 *)&cool_64_ints[i]) & 0xff;
01197       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01198       if ((SINT8)(*(UINT64 *)&cool_64_ints[i]) < 0) {
01199          act_status[i] |= AR_STAT_NEGATIVE;
01200       }
01201 
01202       if (((SINT8)*(UINT64 *)&cool_64_ints[i] < 0) ^
01203           (       *(UINT64 *)&cool_64_ints[i] < 0))
01204       {   /* sign before and after cast does not match */
01205          act_status[i] |= AR_STAT_OVERFLOW;
01206       }
01207       else if (*(UINT64 *)&cool_64_ints[i] !=
01208                (UINT64)(SINT8)*(UINT64 *)&cool_64_ints[i])
01209       {   /* result cast back to original type does not match original value */
01210          act_status[i] |= AR_STAT_OVERFLOW;
01211       }
01212 
01213       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
01214                                   (AR_DATA *)&cool_64_ints[i], &uint64_artype);
01215 
01216       if (*(SINT64 *)&test_result[i] != act_result[i])
01217       {
01218          printf(" ERROR:  incorrect result at %d\n", i);
01219          abort();
01220       }
01221 
01222       if (act_status[i] != test_status[i])
01223       {
01224          printf(" ERROR:  incorrect status at %d\n", i);
01225          abort();
01226       }
01227    }
01228    printf("PASSED\n");
01229 }  /* test_64_U */
01230 
01231 
01232 test_64_S()
01233 {
01234    int i;
01235 
01236 
01237    printf(" Testing convert:    SIGNED 64 INT -> UNSIGNED 64 INT :  ");
01238 
01239    for (i=0; i<num_cool_64_ints; i++)
01240    {
01241       act_result[i] = (UINT64)(UINT64)(*(SINT64 *)&cool_64_ints[i]);
01242       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01243 
01244       if (((UINT64)*(SINT64 *)&cool_64_ints[i] < 0) ^
01245           (        *(SINT64 *)&cool_64_ints[i] < 0))
01246       {   /* sign before and after cast does not match */
01247          act_status[i] |= AR_STAT_SEMIVALID;
01248          if((cool_64_ints[i].part1 & 0x7fff) || cool_64_ints[i].part2 ||
01249             cool_64_ints[i].part3 || cool_64_ints[i].part4)
01250            act_status[i] |=  AR_STAT_OVERFLOW;
01251       }
01252       else if (*(SINT64 *)&cool_64_ints[i] !=
01253                (SINT64)(UINT64)*(SINT64 *)&cool_64_ints[i])
01254       {   /* result cast back to original type does not match original value */
01255          act_status[i] |= AR_STAT_OVERFLOW;
01256       }
01257 
01258       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
01259                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01260 
01261       if (*(SINT64 *)&test_result[i] != act_result[i])
01262       {
01263          printf(" ERROR:  incorrect result at %d\n", i);
01264          abort();
01265       }
01266 
01267       if (act_status[i] != test_status[i])
01268       {
01269          printf(" ERROR:  incorrect status at %d\n", i);
01270          abort();
01271       }
01272    }
01273    printf("PASSED\n");
01274 
01275 
01276    printf(" Testing convert:    SIGNED 64 INT ->   SIGNED 64 INT :  ");
01277 
01278    for (i=0; i<num_cool_64_ints; i++)
01279    {
01280       act_result[i] = (UINT64)(SINT64)(*(SINT64 *)&cool_64_ints[i]);
01281       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01282       if ((SINT64)(*(SINT64 *)&cool_64_ints[i]) < 0) {
01283          act_status[i] |= AR_STAT_NEGATIVE;
01284       }
01285 
01286       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
01287                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01288 
01289       if (*(SINT64 *)&test_result[i] != act_result[i])
01290       {
01291          printf(" ERROR:  incorrect result at %d\n", i);
01292          abort();
01293       }
01294 
01295       if (act_status[i] != test_status[i])
01296       {
01297          printf(" ERROR:  incorrect status at %d\n", i);
01298          abort();
01299       }
01300    }
01301    printf("PASSED\n");
01302 
01303 
01304    printf(" Testing convert:    SIGNED 64 INT ->   SIGNED 46 INT :  ");
01305 
01306    for (i=0; i<num_cool_64_ints; i++)
01307    {
01308       act_result[i] = (UINT64)(SINT46)(*(SINT64 *)&cool_64_ints[i]);
01309       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01310       if ((SINT46)(*(SINT64 *)&cool_64_ints[i]) < 0) {
01311          act_status[i] |= AR_STAT_NEGATIVE;
01312       }
01313 
01314       if (INT_OVERFLOWS_46_BITS(act_result[i]))
01315       {  /* int too big for 46-bit int */
01316          act_status[i] |= AR_STAT_OVERFLOW;
01317       }
01318 
01319       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
01320                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01321 
01322       if (*(SINT64 *)&test_result[i] != act_result[i])
01323       {
01324          printf(" ERROR:  incorrect result at %d\n", i);
01325          abort();
01326       }
01327 
01328       if (act_status[i] != test_status[i])
01329       {
01330          printf(" ERROR:  incorrect status at %d\n", i);
01331          abort();
01332       }
01333    }
01334    printf("PASSED\n");
01335 
01336 
01337    printf(" Testing convert:    SIGNED 64 INT -> UNSIGNED 32 INT :  ");
01338 
01339    for (i=0; i<num_cool_64_ints; i++)
01340    {
01341       act_result[i] = (UINT64)(UINT32)(*(SINT64 *)&cool_64_ints[i]);
01342       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01343 
01344       if (((UINT32)*(SINT64 *)&cool_64_ints[i] < 0) ^
01345           (        *(SINT64 *)&cool_64_ints[i] < 0))
01346       {   /* sign before and after cast does not match */
01347          act_status[i] |= AR_STAT_OVERFLOW;
01348       }
01349       else if (*(SINT64 *)&cool_64_ints[i] !=
01350                (SINT64)(UINT32)*(SINT64 *)&cool_64_ints[i])
01351       {   /* result cast back to original type does not match original value */
01352          act_status[i] |= AR_STAT_OVERFLOW;
01353       }
01354 
01355       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
01356                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01357 
01358       if (*(SINT64 *)&test_result[i] != act_result[i])
01359       {
01360          printf(" ERROR:  incorrect result at %d\n", i);
01361          abort();
01362       }
01363 
01364       if (act_status[i] != test_status[i])
01365       {
01366          printf(" ERROR:  incorrect status at %d\n", i);
01367          abort();
01368       }
01369    }
01370    printf("PASSED\n");
01371 
01372 
01373    printf(" Testing convert:    SIGNED 64 INT ->   SIGNED 32 INT :  ");
01374 
01375    for (i=0; i<num_cool_64_ints; i++)
01376    {
01377       act_result[i] = (*(SINT64 *)&cool_64_ints[i]) & 0xffffffff;
01378       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01379       if ((SINT32)(*(SINT64 *)&cool_64_ints[i]) < 0) {
01380          act_status[i] |= AR_STAT_NEGATIVE;
01381       }
01382 
01383       if (((SINT32)*(SINT64 *)&cool_64_ints[i] < 0) ^
01384           (        *(SINT64 *)&cool_64_ints[i] < 0))
01385       {   /* sign before and after cast does not match */
01386          act_status[i] |= AR_STAT_OVERFLOW;
01387       }
01388       else if (*(SINT64 *)&cool_64_ints[i] !=
01389                (SINT64)(SINT32)*(SINT64 *)&cool_64_ints[i])
01390       {   /* result cast back to original type does not match original value */
01391          act_status[i] |= AR_STAT_OVERFLOW;
01392       }
01393 
01394       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
01395                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01396 
01397       if (*(SINT64 *)&test_result[i] != act_result[i])
01398       {
01399          printf(" ERROR:  incorrect result at %d\n", i);
01400          abort();
01401       }
01402 
01403       if (act_status[i] != test_status[i])
01404       {
01405          printf(" ERROR:  incorrect status at %d\n", i);
01406          abort();
01407       }
01408    }
01409    printf("PASSED\n");
01410 
01411 
01412    printf(" Testing convert:    SIGNED 64 INT -> UNSIGNED 24 INT :  ");
01413 
01414    for (i=0; i<num_cool_64_ints; i++)
01415    {
01416       act_result[i] = (*(SINT64 *)&cool_64_ints[i]) & 0xffffff;
01417       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01418 
01419       if (0 ^ (*(SINT64 *)&cool_64_ints[i] < 0))
01420       {   /* sign before and after cast does not match */
01421           /* UNSIGNED 24 bit is always positive */
01422          act_status[i] |= AR_STAT_OVERFLOW;
01423       }
01424       else if (*(SINT64 *)&cool_64_ints[i] != (SINT64)act_result[i])
01425       {   /* result cast back to original type does not match original value */
01426          act_status[i] |= AR_STAT_OVERFLOW;
01427       }
01428 
01429       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
01430                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01431 
01432       if (*(SINT64 *)&test_result[i] != act_result[i])
01433       {
01434          printf(" ERROR:  incorrect result at %d\n", i);
01435          abort();
01436       }
01437 
01438       if (act_status[i] != test_status[i])
01439       {
01440          printf(" ERROR:  incorrect status at %d\n", i);
01441          abort();
01442       }
01443    }
01444    printf("PASSED\n");
01445 
01446 
01447    printf(" Testing convert:    SIGNED 64 INT ->   SIGNED 24 INT :  ");
01448 
01449    for (i=0; i<num_cool_64_ints; i++)
01450    {
01451       act_result[i] = (*(SINT64 *)&cool_64_ints[i]) & 0xffffff;
01452       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01453       if ((*(SINT64 *)&cool_64_ints[i]) & 0x800000) {
01454          act_status[i] |= AR_STAT_NEGATIVE;
01455       }
01456 
01457       if (((*(SINT64 *)&cool_64_ints[i] & 0x800000) != 0) ^
01458            (*(SINT64 *)&cool_64_ints[i] < 0))
01459       {   /* sign before and after cast does not match */
01460          act_status[i] |= AR_STAT_OVERFLOW;
01461       }
01462       else if (*(SINT64 *)&cool_64_ints[i] !=
01463                ((act_result[i] & 0x800000) ?
01464                                         act_result[i] | 0xffffffffff000000 :
01465                                         act_result[i]))
01466       {   /* result cast back to original type does not match original value */
01467          act_status[i] |= AR_STAT_OVERFLOW;
01468       }
01469 
01470       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
01471                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01472 
01473       if (*(SINT64 *)&test_result[i] != act_result[i])
01474       {
01475          printf(" ERROR:  incorrect result at %d\n", i);
01476          abort();
01477       }
01478 
01479       if (act_status[i] != test_status[i])
01480       {
01481          printf(" ERROR:  incorrect status at %d\n", i);
01482          abort();
01483       }
01484    }
01485    printf("PASSED\n");
01486 
01487 
01488    printf(" Testing convert:    SIGNED 64 INT -> UNSIGNED  8 INT :  ");
01489 
01490    for (i=0; i<num_cool_64_ints; i++)
01491    {
01492       act_result[i] = (UINT64)(UINT8)(*(SINT64 *)&cool_64_ints[i]);
01493       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01494 
01495       if (((UINT8)*(SINT64 *)&cool_64_ints[i] < 0) ^
01496           (       *(SINT64 *)&cool_64_ints[i] < 0))
01497       {   /* sign before and after cast does not match */
01498          act_status[i] |= AR_STAT_OVERFLOW;
01499       }
01500       else if (*(SINT64 *)&cool_64_ints[i] !=
01501                (SINT64)(UINT8)*(SINT64 *)&cool_64_ints[i])
01502       {   /* result cast back to original type does not match original value */
01503          act_status[i] |= AR_STAT_OVERFLOW;
01504       }
01505 
01506       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
01507                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01508 
01509       if (*(SINT64 *)&test_result[i] != act_result[i])
01510       {
01511          printf(" ERROR:  incorrect result at %d\n", i);
01512          abort();
01513       }
01514 
01515       if (act_status[i] != test_status[i])
01516       {
01517          printf(" ERROR:  incorrect status at %d\n", i);
01518          abort();
01519       }
01520    }
01521    printf("PASSED\n");
01522 
01523 
01524    printf(" Testing convert:    SIGNED 64 INT ->   SIGNED  8 INT :  ");
01525 
01526    for (i=0; i<num_cool_64_ints; i++)
01527    {
01528       act_result[i] = (*(SINT64 *)&cool_64_ints[i]) & 0xff;
01529       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01530       if ((SINT8)(*(SINT64 *)&cool_64_ints[i]) < 0) {
01531          act_status[i] |= AR_STAT_NEGATIVE;
01532       }
01533 
01534       if (((SINT8)*(SINT64 *)&cool_64_ints[i] < 0) ^
01535           (       *(SINT64 *)&cool_64_ints[i] < 0))
01536       {   /* sign before and after cast does not match */
01537          act_status[i] |= AR_STAT_OVERFLOW;
01538       }
01539       else if (*(SINT64 *)&cool_64_ints[i] !=
01540                (SINT64)(SINT8)*(SINT64 *)&cool_64_ints[i])
01541       {   /* result cast back to original type does not match original value */
01542          act_status[i] |= AR_STAT_OVERFLOW;
01543       }
01544 
01545       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
01546                                   (AR_DATA *)&cool_64_ints[i], &sint64_artype);
01547 
01548       if (*(SINT64 *)&test_result[i] != act_result[i])
01549       {
01550          printf(" ERROR:  incorrect result at %d\n", i);
01551          abort();
01552       }
01553 
01554       if (act_status[i] != test_status[i])
01555       {
01556          printf(" ERROR:  incorrect status at %d\n", i);
01557          abort();
01558       }
01559    }
01560    printf("PASSED\n");
01561 }  /* test_64_S */
01562 
01563 
01564 test_46_S()
01565 {
01566    int i;
01567 
01568 
01569    printf(" Testing convert:    SIGNED 46 INT -> UNSIGNED 64 INT :  ");
01570 
01571    for (i=0; i<num_cool_64_ints; i++)
01572    {
01573       act_result[i] = (UINT64)(UINT64)(*(SINT64 *)&cool_64_ints[i]);
01574       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01575 
01576       if (((UINT64)*(SINT64 *)&cool_64_ints[i] < 0) ^
01577           (        *(SINT64 *)&cool_64_ints[i] < 0))
01578       {   /* sign before and after cast does not match */
01579          act_status[i] |= AR_STAT_SEMIVALID;
01580          if((cool_64_ints[i].part1 & 0x7fff) || cool_64_ints[i].part2 ||
01581             cool_64_ints[i].part3 || cool_64_ints[i].part4)
01582            act_status[i] |=  AR_STAT_OVERFLOW;
01583       }
01584       else if (*(SINT64 *)&cool_64_ints[i] !=
01585                (SINT64)(UINT64)*(SINT64 *)&cool_64_ints[i])
01586       {   /* result cast back to original type does not match original value */
01587          act_status[i] |= AR_STAT_OVERFLOW;
01588       }
01589 
01590       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
01591                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01592 
01593       if (*(SINT64 *)&test_result[i] != act_result[i])
01594       {
01595          printf(" ERROR:  incorrect result at %d\n", i);
01596          abort();
01597       }
01598 
01599       if (act_status[i] != test_status[i])
01600       {
01601          printf(" ERROR:  incorrect status at %d\n", i);
01602          abort();
01603       }
01604    }
01605    printf("PASSED\n");
01606 
01607 
01608    printf(" Testing convert:    SIGNED 46 INT ->   SIGNED 64 INT :  ");
01609 
01610    for (i=0; i<num_cool_64_ints; i++)
01611    {
01612       act_result[i] = (UINT64)(SINT64)(*(SINT64 *)&cool_64_ints[i]);
01613       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01614       if ((SINT64)(*(SINT64 *)&cool_64_ints[i]) < 0) {
01615          act_status[i] |= AR_STAT_NEGATIVE;
01616       }
01617 
01618       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
01619                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01620 
01621       if (*(SINT64 *)&test_result[i] != act_result[i])
01622       {
01623          printf(" ERROR:  incorrect result at %d\n", i);
01624          abort();
01625       }
01626 
01627       if (act_status[i] != test_status[i])
01628       {
01629          printf(" ERROR:  incorrect status at %d\n", i);
01630          abort();
01631       }
01632    }
01633    printf("PASSED\n");
01634 
01635 
01636    printf(" Testing convert:    SIGNED 46 INT ->   SIGNED 46 INT :  ");
01637 
01638    for (i=0; i<num_cool_64_ints; i++)
01639    {
01640       act_result[i] = (UINT64)(SINT46)(*(SINT64 *)&cool_64_ints[i]);
01641       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01642       if ((SINT46)(*(SINT64 *)&cool_64_ints[i]) < 0) {
01643          act_status[i] |= AR_STAT_NEGATIVE;
01644       }
01645 
01646       if (INT_OVERFLOWS_46_BITS(act_result[i]))
01647       {  /* int too big for 46-bit int */
01648          act_status[i] |= AR_STAT_OVERFLOW;
01649       }
01650 
01651       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
01652                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01653 
01654       if (*(SINT64 *)&test_result[i] != act_result[i])
01655       {
01656          printf(" ERROR:  incorrect result at %d\n", i);
01657          abort();
01658       }
01659 
01660       if (act_status[i] != test_status[i])
01661       {
01662          printf(" ERROR:  incorrect status at %d\n", i);
01663          abort();
01664       }
01665    }
01666    printf("PASSED\n");
01667 
01668 
01669    printf(" Testing convert:    SIGNED 46 INT -> UNSIGNED 32 INT :  ");
01670 
01671    for (i=0; i<num_cool_64_ints; i++)
01672    {
01673       act_result[i] = (UINT64)(UINT32)(*(SINT64 *)&cool_64_ints[i]);
01674       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01675 
01676       if (((UINT32)*(SINT64 *)&cool_64_ints[i] < 0) ^
01677           (        *(SINT64 *)&cool_64_ints[i] < 0))
01678       {   /* sign before and after cast does not match */
01679          act_status[i] |= AR_STAT_OVERFLOW;
01680       }
01681       else if (*(SINT64 *)&cool_64_ints[i] !=
01682                (SINT64)(UINT32)*(SINT64 *)&cool_64_ints[i])
01683       {   /* result cast back to original type does not match original value */
01684          act_status[i] |= AR_STAT_OVERFLOW;
01685       }
01686 
01687       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
01688                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01689 
01690       if (*(SINT64 *)&test_result[i] != act_result[i])
01691       {
01692          printf(" ERROR:  incorrect result at %d\n", i);
01693          abort();
01694       }
01695 
01696       if (act_status[i] != test_status[i])
01697       {
01698          printf(" ERROR:  incorrect status at %d\n", i);
01699          abort();
01700       }
01701    }
01702    printf("PASSED\n");
01703 
01704 
01705    printf(" Testing convert:    SIGNED 46 INT ->   SIGNED 32 INT :  ");
01706 
01707    for (i=0; i<num_cool_64_ints; i++)
01708    {
01709       act_result[i] = (*(SINT64 *)&cool_64_ints[i]) &0xffffffff;
01710       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01711       if ((SINT32)(*(SINT64 *)&cool_64_ints[i]) < 0) {
01712          act_status[i] |= AR_STAT_NEGATIVE;
01713       }
01714 
01715       if (((SINT32)*(SINT64 *)&cool_64_ints[i] < 0) ^
01716           (        *(SINT64 *)&cool_64_ints[i] < 0))
01717       {   /* sign before and after cast does not match */
01718          act_status[i] |= AR_STAT_OVERFLOW;
01719       }
01720       else if (*(SINT64 *)&cool_64_ints[i] !=
01721                (SINT64)(SINT32)*(SINT64 *)&cool_64_ints[i])
01722       {   /* result cast back to original type does not match original value */
01723          act_status[i] |= AR_STAT_OVERFLOW;
01724       }
01725 
01726       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
01727                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01728 
01729       if (*(SINT64 *)&test_result[i] != act_result[i])
01730       {
01731          printf(" ERROR:  incorrect result at %d\n", i);
01732          abort();
01733       }
01734 
01735       if (act_status[i] != test_status[i])
01736       {
01737          printf(" ERROR:  incorrect status at %d\n", i);
01738          abort();
01739       }
01740    }
01741    printf("PASSED\n");
01742 
01743 
01744    printf(" Testing convert:    SIGNED 46 INT -> UNSIGNED 24 INT :  ");
01745 
01746    for (i=0; i<num_cool_64_ints; i++)
01747    {
01748       act_result[i] = (*(SINT64 *)&cool_64_ints[i]) & 0xffffff;
01749       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01750 
01751       if (0 ^ (*(SINT64 *)&cool_64_ints[i] < 0))
01752       {   /* sign before and after cast does not match */
01753           /* UNSIGNED 24 bit is always positive */
01754          act_status[i] |= AR_STAT_OVERFLOW;
01755       }
01756       else if (*(SINT64 *)&cool_64_ints[i] != (SINT64)act_result[i])
01757       {   /* result cast back to original type does not match original value */
01758          act_status[i] |= AR_STAT_OVERFLOW;
01759       }
01760 
01761       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
01762                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01763 
01764       if (*(SINT64 *)&test_result[i] != act_result[i])
01765       {
01766          printf(" ERROR:  incorrect result at %d\n", i);
01767          abort();
01768       }
01769 
01770       if (act_status[i] != test_status[i])
01771       {
01772          printf(" ERROR:  incorrect status at %d\n", i);
01773          abort();
01774       }
01775    }
01776    printf("PASSED\n");
01777 
01778 
01779    printf(" Testing convert:    SIGNED 46 INT ->   SIGNED 24 INT :  ");
01780 
01781    for (i=0; i<num_cool_64_ints; i++)
01782    {
01783       act_result[i] = (*(SINT64 *)&cool_64_ints[i]) & 0xffffff;
01784       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01785       if ((*(SINT64 *)&cool_64_ints[i]) & 0x800000) {
01786          act_status[i] |= AR_STAT_NEGATIVE;
01787       }
01788 
01789       if (((*(SINT64 *)&cool_64_ints[i] & 0x800000) != 0) ^
01790            (*(SINT64 *)&cool_64_ints[i] < 0))
01791       {   /* sign before and after cast does not match */
01792          act_status[i] |= AR_STAT_OVERFLOW;
01793       }
01794       else if (*(SINT64 *)&cool_64_ints[i] !=
01795                ((act_result[i] & 0x800000) ?
01796                                         act_result[i] | 0xffffffffff000000 :
01797                                         act_result[i]))
01798       {   /* result cast back to original type does not match original value */
01799          act_status[i] |= AR_STAT_OVERFLOW;
01800       }
01801 
01802       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
01803                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01804 
01805       if (*(SINT64 *)&test_result[i] != act_result[i])
01806       {
01807          printf(" ERROR:  incorrect result at %d\n", i);
01808          abort();
01809       }
01810 
01811       if (act_status[i] != test_status[i])
01812       {
01813          printf(" ERROR:  incorrect status at %d\n", i);
01814          abort();
01815       }
01816    }
01817    printf("PASSED\n");
01818 
01819 
01820    printf(" Testing convert:    SIGNED 46 INT -> UNSIGNED  8 INT :  ");
01821 
01822    for (i=0; i<num_cool_64_ints; i++)
01823    {
01824       act_result[i] = (UINT64)(UINT8)(*(SINT64 *)&cool_64_ints[i]);
01825       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01826 
01827       if (((UINT8)*(SINT64 *)&cool_64_ints[i] < 0) ^
01828           (       *(SINT64 *)&cool_64_ints[i] < 0))
01829       {   /* sign before and after cast does not match */
01830          act_status[i] |= AR_STAT_OVERFLOW;
01831       }
01832       else if (*(SINT64 *)&cool_64_ints[i] !=
01833                (SINT64)(UINT8)*(SINT64 *)&cool_64_ints[i])
01834       {   /* result cast back to original type does not match original value */
01835          act_status[i] |= AR_STAT_OVERFLOW;
01836       }
01837 
01838       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
01839                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01840 
01841       if (*(SINT64 *)&test_result[i] != act_result[i])
01842       {
01843          printf(" ERROR:  incorrect result at %d\n", i);
01844          abort();
01845       }
01846 
01847       if (act_status[i] != test_status[i])
01848       {
01849          printf(" ERROR:  incorrect status at %d\n", i);
01850          abort();
01851       }
01852    }
01853    printf("PASSED\n");
01854 
01855 
01856    printf(" Testing convert:    SIGNED 46 INT ->   SIGNED  8 INT :  ");
01857 
01858    for (i=0; i<num_cool_64_ints; i++)
01859    {
01860       act_result[i] = (*(SINT64 *)&cool_64_ints[i]) & 0xff;
01861       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01862       if ((SINT8)(*(SINT64 *)&cool_64_ints[i]) < 0) {
01863          act_status[i] |= AR_STAT_NEGATIVE;
01864       }
01865 
01866       if (((SINT8)*(SINT64 *)&cool_64_ints[i] < 0) ^
01867           (       *(SINT64 *)&cool_64_ints[i] < 0))
01868       {   /* sign before and after cast does not match */
01869          act_status[i] |= AR_STAT_OVERFLOW;
01870       }
01871       else if (*(SINT64 *)&cool_64_ints[i] !=
01872                (SINT64)(SINT8)*(SINT64 *)&cool_64_ints[i])
01873       {   /* result cast back to original type does not match original value */
01874          act_status[i] |= AR_STAT_OVERFLOW;
01875       }
01876 
01877       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
01878                                   (AR_DATA *)&cool_64_ints[i], &sint46_artype);
01879 
01880       if (*(SINT64 *)&test_result[i] != act_result[i])
01881       {
01882          printf(" ERROR:  incorrect result at %d\n", i);
01883          abort();
01884       }
01885 
01886       if (act_status[i] != test_status[i])
01887       {
01888          printf(" ERROR:  incorrect status at %d\n", i);
01889          abort();
01890       }
01891    }
01892    printf("PASSED\n");
01893 }  /* test_46_S */
01894 
01895 
01896 test_32_U()
01897 {
01898    int i;
01899 
01900 
01901    printf(" Testing convert:  UNSIGNED 32 INT -> UNSIGNED 64 INT :  ");
01902 
01903    for (i=0; i<num_cool_32_ints; i++)
01904    {
01905       act_result[i] = (UINT64)(UINT64)(*(UINT32 *)&cool_32_ints[i]);
01906       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01907 
01908       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
01909                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
01910 
01911       if (*(SINT64 *)&test_result[i] != act_result[i])
01912       {
01913          printf(" ERROR:  incorrect result at %d\n", i);
01914          abort();
01915       }
01916 
01917       if (act_status[i] != test_status[i])
01918       {
01919          printf(" ERROR:  incorrect status at %d\n", i);
01920          abort();
01921       }
01922    }
01923    printf("PASSED\n");
01924 
01925 
01926    printf(" Testing convert:  UNSIGNED 32 INT ->   SIGNED 64 INT :  ");
01927 
01928    for (i=0; i<num_cool_32_ints; i++)
01929    {
01930       act_result[i] = (UINT64)(SINT64)(*(UINT32 *)&cool_32_ints[i]);
01931       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01932 
01933       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
01934                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
01935 
01936       if (*(SINT64 *)&test_result[i] != act_result[i])
01937       {
01938          printf(" ERROR:  incorrect result at %d\n", i);
01939          abort();
01940       }
01941 
01942       if (act_status[i] != test_status[i])
01943       {
01944          printf(" ERROR:  incorrect status at %d\n", i);
01945          abort();
01946       }
01947    }
01948    printf("PASSED\n");
01949 
01950 
01951    printf(" Testing convert:  UNSIGNED 32 INT ->   SIGNED 46 INT :  ");
01952 
01953    for (i=0; i<num_cool_32_ints; i++)
01954    {
01955       act_result[i] = (UINT64)(SINT46)(*(UINT32 *)&cool_32_ints[i]);
01956       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01957 
01958       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
01959                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
01960 
01961       if (*(SINT64 *)&test_result[i] != act_result[i])
01962       {
01963          printf(" ERROR:  incorrect result at %d\n", i);
01964          abort();
01965       }
01966 
01967       if (act_status[i] != test_status[i])
01968       {
01969          printf(" ERROR:  incorrect status at %d\n", i);
01970          abort();
01971       }
01972    }
01973    printf("PASSED\n");
01974 
01975 
01976    printf(" Testing convert:  UNSIGNED 32 INT -> UNSIGNED 32 INT :  ");
01977 
01978    for (i=0; i<num_cool_32_ints; i++)
01979    {
01980       act_result[i] = (UINT64)(UINT32)(*(UINT32 *)&cool_32_ints[i]);
01981       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
01982 
01983       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
01984                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
01985 
01986       if (*(SINT64 *)&test_result[i] != act_result[i])
01987       {
01988          printf(" ERROR:  incorrect result at %d\n", i);
01989          abort();
01990       }
01991 
01992       if (act_status[i] != test_status[i])
01993       {
01994          printf(" ERROR:  incorrect status at %d\n", i);
01995          abort();
01996       }
01997    }
01998    printf("PASSED\n");
01999 
02000 
02001    printf(" Testing convert:  UNSIGNED 32 INT ->   SIGNED 32 INT :  ");
02002 
02003    for (i=0; i<num_cool_32_ints; i++)
02004    {
02005       act_result[i] = (*(UINT32 *)&cool_32_ints[i]) & 0xffffffff;
02006       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02007 
02008       if (cool_32_ints[i].part3 & 0x8000) {
02009          act_status[i] |= AR_STAT_NEGATIVE | AR_STAT_SEMIVALID;
02010          if((cool_32_ints[i].part3 & 0x7fff) || cool_32_ints[i].part4)
02011            act_status[i] |=  AR_STAT_OVERFLOW;
02012       }
02013 
02014       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
02015                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
02016 
02017       if (*(SINT64 *)&test_result[i] != act_result[i])
02018       {
02019          printf(" ERROR:  incorrect result at %d\n", i);
02020          abort();
02021       }
02022 
02023       if (act_status[i] != test_status[i])
02024       {
02025          printf(" ERROR:  incorrect status at %d\n", i);
02026          abort();
02027       }
02028    }
02029    printf("PASSED\n");
02030 
02031 
02032    printf(" Testing convert:  UNSIGNED 32 INT -> UNSIGNED 24 INT :  ");
02033 
02034    for (i=0; i<num_cool_32_ints; i++)
02035    {
02036       act_result[i] = (*(UINT32 *)&cool_32_ints[i]) & 0xffffff;
02037       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02038 
02039       if (0 ^ (*(UINT32 *)&cool_32_ints[i] < 0))
02040       {   /* sign before and after cast does not match */
02041           /* UNSIGNED 24 bit is always positive */
02042          act_status[i] |= AR_STAT_OVERFLOW;
02043       }
02044       else if (*(UINT32 *)&cool_32_ints[i] != (UINT64)act_result[i])
02045       {   /* result cast back to original type does not match original value */
02046          act_status[i] |= AR_STAT_OVERFLOW;
02047       }
02048 
02049       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
02050                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
02051 
02052       if (*(SINT64 *)&test_result[i] != act_result[i])
02053       {
02054          printf(" ERROR:  incorrect result at %d\n", i);
02055          abort();
02056       }
02057 
02058       if (act_status[i] != test_status[i])
02059       {
02060          printf(" ERROR:  incorrect status at %d\n", i);
02061          abort();
02062       }
02063    }
02064    printf("PASSED\n");
02065 
02066 
02067    printf(" Testing convert:  UNSIGNED 32 INT ->   SIGNED 24 INT :  ");
02068 
02069    for (i=0; i<num_cool_32_ints; i++)
02070    {
02071       act_result[i] = (*(UINT32 *)&cool_32_ints[i]) & 0xffffff;
02072       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02073       if ((*(UINT32 *)&cool_32_ints[i]) & 0x800000) {
02074          act_status[i] |= AR_STAT_NEGATIVE;
02075       }
02076 
02077       if (((*(UINT32 *)&cool_32_ints[i] & 0x800000) != 0) ^
02078            (*(UINT32 *)&cool_32_ints[i] < 0))
02079       {   /* sign before and after cast does not match */
02080          act_status[i] |= AR_STAT_OVERFLOW;
02081       }
02082       else if (*(UINT32 *)&cool_32_ints[i] !=
02083                ((act_result[i] & 0x800000) ?
02084                                         act_result[i] | 0xffffffffff000000 :
02085                                         act_result[i]))
02086       {   /* result cast back to original type does not match original value */
02087          act_status[i] |= AR_STAT_OVERFLOW;
02088       }
02089 
02090       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
02091                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
02092 
02093       if (*(SINT64 *)&test_result[i] != act_result[i])
02094       {
02095          printf(" ERROR:  incorrect result at %d\n", i);
02096          abort();
02097       }
02098 
02099       if (act_status[i] != test_status[i])
02100       {
02101          printf(" ERROR:  incorrect status at %d\n", i);
02102          abort();
02103       }
02104    }
02105    printf("PASSED\n");
02106 
02107 
02108    printf(" Testing convert:  UNSIGNED 32 INT -> UNSIGNED  8 INT :  ");
02109 
02110    for (i=0; i<num_cool_32_ints; i++)
02111    {
02112       act_result[i] = (UINT64)(UINT8)(*(UINT32 *)&cool_32_ints[i]);
02113       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02114 
02115       if (((UINT8)*(UINT32 *)&cool_32_ints[i] < 0) ^
02116           (       *(UINT32 *)&cool_32_ints[i] < 0))
02117       {   /* sign before and after cast does not match */
02118          act_status[i] |= AR_STAT_OVERFLOW;
02119       }
02120       else if (*(UINT32 *)&cool_32_ints[i] !=
02121                (UINT32)(UINT8)*(UINT32 *)&cool_32_ints[i])
02122       {   /* result cast back to original type does not match original value */
02123          act_status[i] |= AR_STAT_OVERFLOW;
02124       }
02125 
02126       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
02127                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
02128 
02129       if (*(SINT64 *)&test_result[i] != act_result[i])
02130       {
02131          printf(" ERROR:  incorrect result at %d\n", i);
02132          abort();
02133       }
02134 
02135       if (act_status[i] != test_status[i])
02136       {
02137          printf(" ERROR:  incorrect status at %d\n", i);
02138          abort();
02139       }
02140    }
02141    printf("PASSED\n");
02142 
02143 
02144    printf(" Testing convert:  UNSIGNED 32 INT ->   SIGNED  8 INT :  ");
02145 
02146    for (i=0; i<num_cool_32_ints; i++)
02147    {
02148       act_result[i] = (*(UINT32 *)&cool_32_ints[i]) & 0xff;
02149       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02150       if ((SINT8)(*(UINT32 *)&cool_32_ints[i]) < 0) {
02151          act_status[i] |= AR_STAT_NEGATIVE;
02152       }
02153 
02154       if (((SINT8)*(UINT32 *)&cool_32_ints[i] < 0) ^
02155           (       *(UINT32 *)&cool_32_ints[i] < 0))
02156       {   /* sign before and after cast does not match */
02157          act_status[i] |= AR_STAT_OVERFLOW;
02158       }
02159       else if (*(UINT32 *)&cool_32_ints[i] !=
02160                (UINT32)(SINT8)*(UINT32 *)&cool_32_ints[i])
02161       {   /* result cast back to original type does not match original value */
02162          act_status[i] |= AR_STAT_OVERFLOW;
02163       }
02164 
02165       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
02166                                   (AR_DATA *)&cool_32_ints[i], &uint32_artype);
02167 
02168       if (*(SINT64 *)&test_result[i] != act_result[i])
02169       {
02170          printf(" ERROR:  incorrect result at %d\n", i);
02171          abort();
02172       }
02173 
02174       if (act_status[i] != test_status[i])
02175       {
02176          printf(" ERROR:  incorrect status at %d\n", i);
02177          abort();
02178       }
02179    }
02180    printf("PASSED\n");
02181 }  /* test_32_U */
02182 
02183 
02184 test_32_S()
02185 {
02186    int i;
02187 
02188 
02189    printf(" Testing convert:    SIGNED 32 INT -> UNSIGNED 64 INT :  ");
02190 
02191    for (i=0; i<num_cool_32_ints; i++)
02192    {
02193       act_result[i] = (UINT64)(UINT64)(*(SINT32 *)&cool_32_ints[i]);
02194       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02195 
02196       if (*(SINT32 *)&cool_32_ints[i] < 0)
02197       {
02198          act_status[i] |= AR_STAT_OVERFLOW;
02199       }
02200 
02201       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
02202                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02203 
02204       if (*(SINT64 *)&test_result[i] != act_result[i])
02205       {
02206          printf(" ERROR:  incorrect result at %d\n", i);
02207          abort();
02208       }
02209 
02210       if (act_status[i] != test_status[i])
02211       {
02212          printf(" ERROR:  incorrect status at %d\n", i);
02213          abort();
02214       }
02215    }
02216    printf("PASSED\n");
02217 
02218 
02219    printf(" Testing convert:    SIGNED 32 INT ->   SIGNED 64 INT :  ");
02220 
02221    for (i=0; i<num_cool_32_ints; i++)
02222    {
02223       act_result[i] = (UINT64)(SINT64)(*(SINT32 *)&cool_32_ints[i]);
02224       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02225       if ((SINT64)(*(SINT32 *)&cool_32_ints[i]) < 0) {
02226          act_status[i] |= AR_STAT_NEGATIVE;
02227       }
02228 
02229       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
02230                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02231 
02232       if (*(SINT64 *)&test_result[i] != act_result[i])
02233       {
02234          printf(" ERROR:  incorrect result at %d\n", i);
02235          abort();
02236       }
02237 
02238       if (act_status[i] != test_status[i])
02239       {
02240          printf(" ERROR:  incorrect status at %d\n", i);
02241          abort();
02242       }
02243    }
02244    printf("PASSED\n");
02245 
02246 
02247    printf(" Testing convert:    SIGNED 32 INT ->   SIGNED 46 INT :  ");
02248 
02249    for (i=0; i<num_cool_32_ints; i++)
02250    {
02251       act_result[i] = (UINT64)(SINT46)(*(SINT32 *)&cool_32_ints[i]);
02252       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02253       if ((SINT46)(*(SINT32 *)&cool_32_ints[i]) < 0) {
02254          act_status[i] |= AR_STAT_NEGATIVE;
02255       }
02256 
02257       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
02258                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02259 
02260       if (*(SINT64 *)&test_result[i] != act_result[i])
02261       {
02262          printf(" ERROR:  incorrect result at %d\n", i);
02263          abort();
02264       }
02265 
02266       if (act_status[i] != test_status[i])
02267       {
02268          printf(" ERROR:  incorrect status at %d\n", i);
02269          abort();
02270       }
02271    }
02272    printf("PASSED\n");
02273 
02274 
02275    printf(" Testing convert:    SIGNED 32 INT -> UNSIGNED 32 INT :  ");
02276 
02277    for (i=0; i<num_cool_32_ints; i++)
02278    {
02279       act_result[i] = (UINT64)(UINT32)(*(SINT32 *)&cool_32_ints[i]);
02280       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02281 
02282       if (cool_32_ints[i].part3 & 0x8000)
02283       {
02284          act_status[i] |= AR_STAT_SEMIVALID;
02285          if((cool_32_ints[i].part3 & 0x7fff) || cool_32_ints[i].part4)
02286            act_status[i] |=  AR_STAT_OVERFLOW;
02287       }
02288 
02289       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
02290                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02291 
02292       if (*(SINT64 *)&test_result[i] != act_result[i])
02293       {
02294          printf(" ERROR:  incorrect result at %d\n", i);
02295          abort();
02296       }
02297 
02298       if (act_status[i] != test_status[i])
02299       {
02300          printf(" ERROR:  incorrect status at %d\n", i);
02301          abort();
02302       }
02303    }
02304    printf("PASSED\n");
02305 
02306 
02307    printf(" Testing convert:    SIGNED 32 INT ->   SIGNED 32 INT :  ");
02308 
02309    for (i=0; i<num_cool_32_ints; i++)
02310    {
02311       act_result[i] = (*(SINT32 *)&cool_32_ints[i]) &0xffffffff;
02312       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02313       if ((SINT32)(*(SINT32 *)&cool_32_ints[i]) < 0) {
02314          act_status[i] |= AR_STAT_NEGATIVE;
02315       }
02316 
02317       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
02318                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02319 
02320       if (*(SINT64 *)&test_result[i] != act_result[i])
02321       {
02322          printf(" ERROR:  incorrect result at %d\n", i);
02323          abort();
02324       }
02325 
02326       if (act_status[i] != test_status[i])
02327       {
02328          printf(" ERROR:  incorrect status at %d\n", i);
02329          abort();
02330       }
02331    }
02332    printf("PASSED\n");
02333 
02334 
02335    printf(" Testing convert:    SIGNED 32 INT -> UNSIGNED 24 INT :  ");
02336 
02337    for (i=0; i<num_cool_32_ints; i++)
02338    {
02339       act_result[i] = (*(SINT32 *)&cool_32_ints[i]) & 0xffffff;
02340       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02341 
02342       if (0 ^ (*(SINT32 *)&cool_32_ints[i] < 0))
02343       {   /* sign before and after cast does not match */
02344           /* UNSIGNED 24 bit is always positive */
02345          act_status[i] |= AR_STAT_OVERFLOW;
02346       }
02347       else if (*(SINT32 *)&cool_32_ints[i] != (SINT64)act_result[i])
02348       {   /* result cast back to original type does not match original value */
02349          act_status[i] |= AR_STAT_OVERFLOW;
02350       }
02351 
02352       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
02353                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02354 
02355       if (*(SINT64 *)&test_result[i] != act_result[i])
02356       {
02357          printf(" ERROR:  incorrect result at %d\n", i);
02358          abort();
02359       }
02360 
02361       if (act_status[i] != test_status[i])
02362       {
02363          printf(" ERROR:  incorrect status at %d\n", i);
02364          abort();
02365       }
02366    }
02367    printf("PASSED\n");
02368 
02369 
02370    printf(" Testing convert:    SIGNED 32 INT ->   SIGNED 24 INT :  ");
02371 
02372    for (i=0; i<num_cool_32_ints; i++)
02373    {
02374       act_result[i] = (*(SINT32 *)&cool_32_ints[i]) & 0xffffff;
02375       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02376       if ((*(SINT32 *)&cool_32_ints[i]) & 0x800000) {
02377          act_status[i] |= AR_STAT_NEGATIVE;
02378       }
02379 
02380       if (((*(SINT32 *)&cool_32_ints[i] & 0x800000) != 0) ^
02381            (*(SINT32 *)&cool_32_ints[i] < 0))
02382       {   /* sign before and after cast does not match */
02383          act_status[i] |= AR_STAT_OVERFLOW;
02384       }
02385       else if (*(SINT32 *)&cool_32_ints[i] !=
02386                ((act_result[i] & 0x800000) ?
02387                                         act_result[i] | 0xffffffffff000000 :
02388                                         act_result[i]))
02389       {   /* result cast back to original type does not match original value */
02390          act_status[i] |= AR_STAT_OVERFLOW;
02391       }
02392 
02393       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
02394                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02395 
02396       if (*(SINT64 *)&test_result[i] != act_result[i])
02397       {
02398          printf(" ERROR:  incorrect result at %d\n", i);
02399          abort();
02400       }
02401 
02402       if (act_status[i] != test_status[i])
02403       {
02404          printf(" ERROR:  incorrect status at %d\n", i);
02405          abort();
02406       }
02407    }
02408    printf("PASSED\n");
02409 
02410 
02411    printf(" Testing convert:    SIGNED 32 INT -> UNSIGNED  8 INT :  ");
02412 
02413    for (i=0; i<num_cool_32_ints; i++)
02414    {
02415       act_result[i] = (UINT64)(UINT8)(*(SINT32 *)&cool_32_ints[i]);
02416       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02417 
02418       if (((UINT8)*(SINT32 *)&cool_32_ints[i] < 0) ^
02419           (       *(SINT32 *)&cool_32_ints[i] < 0))
02420       {   /* sign before and after cast does not match */
02421          act_status[i] |= AR_STAT_OVERFLOW;
02422       }
02423       else if (*(SINT32 *)&cool_32_ints[i] !=
02424                (SINT32)(UINT8)*(SINT32 *)&cool_32_ints[i])
02425       {   /* result cast back to original type does not match original value */
02426          act_status[i] |= AR_STAT_OVERFLOW;
02427       }
02428 
02429       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
02430                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02431 
02432       if (*(SINT64 *)&test_result[i] != act_result[i])
02433       {
02434          printf(" ERROR:  incorrect result at %d\n", i);
02435          abort();
02436       }
02437 
02438       if (act_status[i] != test_status[i])
02439       {
02440          printf(" ERROR:  incorrect status at %d\n", i);
02441          abort();
02442       }
02443    }
02444    printf("PASSED\n");
02445 
02446 
02447    printf(" Testing convert:    SIGNED 32 INT ->   SIGNED  8 INT :  ");
02448 
02449    for (i=0; i<num_cool_32_ints; i++)
02450    {
02451       act_result[i] = (*(SINT32 *)&cool_32_ints[i]) & 0xff;
02452       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02453       if ((SINT8)(*(SINT32 *)&cool_32_ints[i]) < 0) {
02454          act_status[i] |= AR_STAT_NEGATIVE;
02455       }
02456 
02457       if (((SINT8)*(SINT32 *)&cool_32_ints[i] < 0) ^
02458           (       *(SINT32 *)&cool_32_ints[i] < 0))
02459       {   /* sign before and after cast does not match */
02460          act_status[i] |= AR_STAT_OVERFLOW;
02461       }
02462       else if (*(SINT32 *)&cool_32_ints[i] !=
02463                (SINT32)(SINT8)*(SINT32 *)&cool_32_ints[i])
02464       {   /* result cast back to original type does not match original value */
02465          act_status[i] |= AR_STAT_OVERFLOW;
02466       }
02467 
02468       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
02469                                   (AR_DATA *)&cool_32_ints[i], &sint32_artype);
02470 
02471       if (*(SINT64 *)&test_result[i] != act_result[i])
02472       {
02473          printf(" ERROR:  incorrect result at %d\n", i);
02474          abort();
02475       }
02476 
02477       if (act_status[i] != test_status[i])
02478       {
02479          printf(" ERROR:  incorrect status at %d\n", i);
02480          abort();
02481       }
02482    }
02483    printf("PASSED\n");
02484 }  /* test_32_S */
02485 
02486 
02487 test_24_U()
02488 {
02489    int i;
02490 
02491 
02492    printf(" Testing convert:  UNSIGNED 24 INT -> UNSIGNED 64 INT :  ");
02493 
02494    for (i=0; i<num_cool_24_ints; i++)
02495    {
02496       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02497       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02498 
02499       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
02500                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02501 
02502       if (*(SINT64 *)&test_result[i] != act_result[i])
02503       {
02504          printf(" ERROR:  incorrect result at %d\n", i);
02505          abort();
02506       }
02507 
02508       if (act_status[i] != test_status[i])
02509       {
02510          printf(" ERROR:  incorrect status at %d\n", i);
02511          abort();
02512       }
02513    }
02514    printf("PASSED\n");
02515 
02516 
02517    printf(" Testing convert:  UNSIGNED 24 INT ->   SIGNED 64 INT :  ");
02518 
02519    for (i=0; i<num_cool_24_ints; i++)
02520    {
02521       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02522       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02523 
02524       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
02525                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02526 
02527       if (*(SINT64 *)&test_result[i] != act_result[i])
02528       {
02529          printf(" ERROR:  incorrect result at %d\n", i);
02530          abort();
02531       }
02532 
02533       if (act_status[i] != test_status[i])
02534       {
02535          printf(" ERROR:  incorrect status at %d\n", i);
02536          abort();
02537       }
02538    }
02539    printf("PASSED\n");
02540 
02541 
02542    printf(" Testing convert:  UNSIGNED 24 INT ->   SIGNED 46 INT :  ");
02543 
02544    for (i=0; i<num_cool_24_ints; i++)
02545    {
02546       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02547       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02548 
02549       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
02550                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02551 
02552       if (*(SINT64 *)&test_result[i] != act_result[i])
02553       {
02554          printf(" ERROR:  incorrect result at %d\n", i);
02555          abort();
02556       }
02557 
02558       if (act_status[i] != test_status[i])
02559       {
02560          printf(" ERROR:  incorrect status at %d\n", i);
02561          abort();
02562       }
02563    }
02564    printf("PASSED\n");
02565 
02566 
02567    printf(" Testing convert:  UNSIGNED 24 INT -> UNSIGNED 32 INT :  ");
02568 
02569    for (i=0; i<num_cool_24_ints; i++)
02570    {
02571       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02572       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02573 
02574       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
02575                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02576 
02577       if (*(SINT64 *)&test_result[i] != act_result[i])
02578       {
02579          printf(" ERROR:  incorrect result at %d\n", i);
02580          abort();
02581       }
02582 
02583       if (act_status[i] != test_status[i])
02584       {
02585          printf(" ERROR:  incorrect status at %d\n", i);
02586          abort();
02587       }
02588    }
02589    printf("PASSED\n");
02590 
02591 
02592    printf(" Testing convert:  UNSIGNED 24 INT ->   SIGNED 32 INT :  ");
02593 
02594    for (i=0; i<num_cool_24_ints; i++)
02595    {
02596       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02597       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02598 
02599       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
02600                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02601 
02602       if (*(SINT64 *)&test_result[i] != act_result[i])
02603       {
02604          printf(" ERROR:  incorrect result at %d\n", i);
02605          abort();
02606       }
02607 
02608       if (act_status[i] != test_status[i])
02609       {
02610          printf(" ERROR:  incorrect status at %d\n", i);
02611          abort();
02612       }
02613    }
02614    printf("PASSED\n");
02615 
02616 
02617    printf(" Testing convert:  UNSIGNED 24 INT -> UNSIGNED 24 INT :  ");
02618 
02619    for (i=0; i<num_cool_24_ints; i++)
02620    {
02621       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02622       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02623 
02624       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
02625                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02626 
02627       if (*(SINT64 *)&test_result[i] != act_result[i])
02628       {
02629          printf(" ERROR:  incorrect result at %d\n", i);
02630          abort();
02631       }
02632 
02633       if (act_status[i] != test_status[i])
02634       {
02635          printf(" ERROR:  incorrect status at %d\n", i);
02636          abort();
02637       }
02638    }
02639    printf("PASSED\n");
02640 
02641 
02642    printf(" Testing convert:  UNSIGNED 24 INT ->   SIGNED 24 INT :  ");
02643 
02644    for (i=0; i<num_cool_24_ints; i++)
02645    {
02646       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02647       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02648 
02649       if (act_result[i] & 0x800000)
02650       {
02651          act_status[i] |= AR_STAT_NEGATIVE | AR_STAT_SEMIVALID;
02652          if((cool_24_ints[i].part3 & 0x7f) || cool_24_ints[i].part4)
02653            act_status[i] |=  AR_STAT_OVERFLOW;
02654       }
02655 
02656       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
02657                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02658 
02659       if (*(SINT64 *)&test_result[i] != act_result[i])
02660       {
02661          printf(" ERROR:  incorrect result at %d\n", i);
02662          abort();
02663       }
02664 
02665       if (act_status[i] != test_status[i])
02666       {
02667          printf(" ERROR:  incorrect status at %d\n", i);
02668          abort();
02669       }
02670    }
02671    printf("PASSED\n");
02672 
02673 
02674    printf(" Testing convert:  UNSIGNED 24 INT -> UNSIGNED  8 INT :  ");
02675 
02676    for (i=0; i<num_cool_24_ints; i++)
02677    {
02678       act_result[i] = *(UINT64 *)&cool_24_ints[i] & 0xff;
02679       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02680 
02681       if (cool_24_ints[i].part3 || (cool_24_ints[i].part4 & 0xff00))
02682       {
02683          act_status[i] |= AR_STAT_OVERFLOW;
02684       }
02685 
02686       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
02687                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02688 
02689       if (*(SINT64 *)&test_result[i] != act_result[i])
02690       {
02691          printf(" ERROR:  incorrect result at %d\n", i);
02692          abort();
02693       }
02694 
02695       if (act_status[i] != test_status[i])
02696       {
02697          printf(" ERROR:  incorrect status at %d\n", i);
02698          abort();
02699       }
02700    }
02701    printf("PASSED\n");
02702 
02703 
02704    printf(" Testing convert:  UNSIGNED 24 INT ->   SIGNED  8 INT :  ");
02705 
02706    for (i=0; i<num_cool_24_ints; i++)
02707    {
02708       act_result[i] = *(UINT64 *)&cool_24_ints[i] & 0xff;
02709       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02710 
02711       if (act_result[i] & 0x80)
02712       {
02713          act_status[i] |= AR_STAT_NEGATIVE | AR_STAT_OVERFLOW;
02714       }
02715       else if (cool_24_ints[i].part3 || (cool_24_ints[i].part4 & 0xff00))
02716       {
02717          act_status[i] |= AR_STAT_OVERFLOW;
02718       }
02719 
02720       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
02721                                   (AR_DATA *)&cool_24_ints[i], &uint24_artype);
02722 
02723       if (*(SINT64 *)&test_result[i] != act_result[i])
02724       {
02725          printf(" ERROR:  incorrect result at %d\n", i);
02726          abort();
02727       }
02728 
02729       if (act_status[i] != test_status[i])
02730       {
02731          printf(" ERROR:  incorrect status at %d\n", i);
02732          abort();
02733       }
02734    }
02735    printf("PASSED\n");
02736 }  /* test_24_U */
02737 
02738 
02739 test_24_S()
02740 {
02741    int i;
02742 
02743 
02744    printf(" Testing convert:    SIGNED 24 INT -> UNSIGNED 64 INT :  ");
02745 
02746    for (i=0; i<num_cool_24_ints; i++)
02747    {
02748       act_result[i] = *(UINT64 *)&cool_24_ints[i] | (cool_24_ints[i].part3 & 0x80 ? 0xffffffffff000000 : 0);
02749       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02750       if (act_result[i] & 0x800000)
02751       {
02752          act_status[i] |= AR_STAT_OVERFLOW;
02753       }
02754 
02755       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
02756                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
02757 
02758       if (*(SINT64 *)&test_result[i] != act_result[i])
02759       {
02760          printf(" ERROR:  incorrect result at %d\n", i);
02761          abort();
02762       }
02763 
02764       if (act_status[i] != test_status[i])
02765       {
02766          printf(" ERROR:  incorrect status at %d\n", i);
02767          abort();
02768       }
02769    }
02770    printf("PASSED\n");
02771 
02772 
02773    printf(" Testing convert:    SIGNED 24 INT ->   SIGNED 64 INT :  ");
02774 
02775    for (i=0; i<num_cool_24_ints; i++)
02776    {
02777       act_result[i] = *(UINT64 *)&cool_24_ints[i] | (cool_24_ints[i].part3 & 0x80 ? 0xffffffffff000000 : 0);
02778       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02779       if (*(SINT64 *)&act_result[i] < 0)
02780       {
02781          act_status[i] |= AR_STAT_NEGATIVE;
02782       }
02783 
02784       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
02785                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
02786 
02787       if (*(SINT64 *)&test_result[i] != act_result[i])
02788       {
02789          printf(" ERROR:  incorrect result at %d\n", i);
02790          abort();
02791       }
02792 
02793       if (act_status[i] != test_status[i])
02794       {
02795          printf(" ERROR:  incorrect status at %d\n", i);
02796          abort();
02797       }
02798    }
02799    printf("PASSED\n");
02800 
02801 
02802    printf(" Testing convert:    SIGNED 24 INT ->   SIGNED 46 INT :  ");
02803 
02804    for (i=0; i<num_cool_24_ints; i++)
02805    {
02806       act_result[i] = *(UINT64 *)&cool_24_ints[i] | (cool_24_ints[i].part3 & 0x80 ? 0xffffffffff000000 : 0);
02807       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02808       if (*(SINT46 *)&act_result[i] < 0)
02809       {
02810          act_status[i] |= AR_STAT_NEGATIVE;
02811       }
02812 
02813       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
02814                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
02815 
02816       if (*(SINT64 *)&test_result[i] != act_result[i])
02817       {
02818          printf(" ERROR:  incorrect result at %d\n", i);
02819          abort();
02820       }
02821 
02822       if (act_status[i] != test_status[i])
02823       {
02824          printf(" ERROR:  incorrect status at %d\n", i);
02825          abort();
02826       }
02827    }
02828    printf("PASSED\n");
02829 
02830 
02831    printf(" Testing convert:    SIGNED 24 INT -> UNSIGNED 32 INT :  ");
02832 
02833    for (i=0; i<num_cool_24_ints; i++)
02834    {
02835       act_result[i] = *(UINT64 *)&cool_24_ints[i] | (cool_24_ints[i].part3 & 0x80 ? 0xff000000 : 0);
02836       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02837       if (act_result[i] & 0x800000)
02838       {
02839          act_status[i] |= AR_STAT_OVERFLOW;
02840       }
02841 
02842       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
02843                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
02844 
02845       if (*(SINT64 *)&test_result[i] != act_result[i])
02846       {
02847          printf(" ERROR:  incorrect result at %d\n", i);
02848          abort();
02849       }
02850 
02851       if (act_status[i] != test_status[i])
02852       {
02853          printf(" ERROR:  incorrect status at %d\n", i);
02854          abort();
02855       }
02856    }
02857    printf("PASSED\n");
02858 
02859 
02860    printf(" Testing convert:    SIGNED 24 INT ->   SIGNED 32 INT :  ");
02861 
02862    for (i=0; i<num_cool_24_ints; i++)
02863    {
02864       act_result[i] = *(UINT64 *)&cool_24_ints[i] | (cool_24_ints[i].part3 & 0x80 ? 0xff000000 : 0);
02865       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02866       if (*(SINT32 *)&act_result[i] < 0)
02867       {
02868          act_status[i] |= AR_STAT_NEGATIVE;
02869       }
02870 
02871       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
02872                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
02873 
02874       if (*(SINT64 *)&test_result[i] != act_result[i])
02875       {
02876          printf(" ERROR:  incorrect result at %d\n", i);
02877          abort();
02878       }
02879 
02880       if (act_status[i] != test_status[i])
02881       {
02882          printf(" ERROR:  incorrect status at %d\n", i);
02883          abort();
02884       }
02885    }
02886    printf("PASSED\n");
02887 
02888 
02889    printf(" Testing convert:    SIGNED 24 INT -> UNSIGNED 24 INT :  ");
02890 
02891    for (i=0; i<num_cool_24_ints; i++)
02892    {
02893       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02894       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02895       if (act_result[i] & 0x800000)
02896       {
02897          act_status[i] |= AR_STAT_SEMIVALID;
02898          if((cool_24_ints[i].part3 & 0x7f) || cool_24_ints[i].part4)
02899            act_status[i] |=  AR_STAT_OVERFLOW;
02900       }
02901 
02902       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
02903                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
02904 
02905       if (*(SINT64 *)&test_result[i] != act_result[i])
02906       {
02907          printf(" ERROR:  incorrect result at %d\n", i);
02908          abort();
02909       }
02910 
02911       if (act_status[i] != test_status[i])
02912       {
02913          printf(" ERROR:  incorrect status at %d\n", i);
02914          abort();
02915       }
02916    }
02917    printf("PASSED\n");
02918 
02919 
02920    printf(" Testing convert:    SIGNED 24 INT ->   SIGNED 24 INT :  ");
02921 
02922    for (i=0; i<num_cool_24_ints; i++)
02923    {
02924       act_result[i] = *(UINT64 *)&cool_24_ints[i];
02925       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02926       if (act_result[i] & 0x800000)
02927       {
02928          act_status[i] |= AR_STAT_NEGATIVE;
02929       }
02930 
02931       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
02932                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
02933 
02934       if (*(SINT64 *)&test_result[i] != act_result[i])
02935       {
02936          printf(" ERROR:  incorrect result at %d\n", i);
02937          abort();
02938       }
02939 
02940       if (act_status[i] != test_status[i])
02941       {
02942          printf(" ERROR:  incorrect status at %d\n", i);
02943          abort();
02944       }
02945    }
02946    printf("PASSED\n");
02947 
02948 
02949    printf(" Testing convert:    SIGNED 24 INT -> UNSIGNED  8 INT :  ");
02950 
02951    for (i=0; i<num_cool_24_ints; i++)
02952    {
02953       act_result[i] = *(UINT64 *)&cool_24_ints[i] & 0xff;
02954       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02955 
02956       if (cool_24_ints[i].part3 || (cool_24_ints[i].part4 & 0xff00))
02957       {
02958          act_status[i] |= AR_STAT_OVERFLOW;
02959       }
02960 
02961       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
02962                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
02963 
02964       if (*(SINT64 *)&test_result[i] != act_result[i])
02965       {
02966          printf(" ERROR:  incorrect result at %d\n", i);
02967          abort();
02968       }
02969 
02970       if (act_status[i] != test_status[i])
02971       {
02972          printf(" ERROR:  incorrect status at %d\n", i);
02973          abort();
02974       }
02975    }
02976    printf("PASSED\n");
02977 
02978 
02979    printf(" Testing convert:    SIGNED 24 INT ->   SIGNED  8 INT :  ");
02980 
02981    for (i=0; i<num_cool_24_ints; i++)
02982    {
02983       act_result[i] = *(UINT64 *)&cool_24_ints[i] & 0xff;
02984       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
02985 
02986       if (act_result[i] & 0x80)
02987       {
02988          act_status[i] |= AR_STAT_NEGATIVE;
02989       }
02990 
02991       if (((cool_24_ints[i].part3 & 0x00ff) != 0x00ff ||
02992            (cool_24_ints[i].part4 & 0xff80) != 0xff80) &&
02993           ((cool_24_ints[i].part3 & 0x00ff) != 0 ||
02994            (cool_24_ints[i].part4 & 0xff80) != 0))
02995       {
02996          act_status[i] |= AR_STAT_OVERFLOW;
02997       }
02998 
02999       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
03000                                   (AR_DATA *)&cool_24_ints[i], &sint24_artype);
03001 
03002       if (*(SINT64 *)&test_result[i] != act_result[i])
03003       {
03004          printf(" ERROR:  incorrect result at %d\n", i);
03005          abort();
03006       }
03007 
03008       if (act_status[i] != test_status[i])
03009       {
03010          printf(" ERROR:  incorrect status at %d\n", i);
03011          abort();
03012       }
03013    }
03014    printf("PASSED\n");
03015 }  /* test_24_S */
03016 
03017 
03018 test_8_U()
03019 {
03020    int i;
03021 
03022 
03023    printf(" Testing convert:  UNSIGNED  8 INT -> UNSIGNED 64 INT :  ");
03024 
03025    for (i=0; i<num_cool_8_ints; i++)
03026    {
03027       act_result[i] = (UINT64)(UINT64)*((UINT8 *)&cool_8_ints[i]+7);
03028       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03029 
03030       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
03031                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03032 
03033       if (*(SINT64 *)&test_result[i] != act_result[i])
03034       {
03035          printf(" ERROR:  incorrect result at %d\n", i);
03036          abort();
03037       }
03038 
03039       if (act_status[i] != test_status[i])
03040       {
03041          printf(" ERROR:  incorrect status at %d\n", i);
03042          abort();
03043       }
03044    }
03045    printf("PASSED\n");
03046 
03047 
03048    printf(" Testing convert:  UNSIGNED  8 INT ->   SIGNED 64 INT :  ");
03049 
03050    for (i=0; i<num_cool_8_ints; i++)
03051    {
03052       act_result[i] = (UINT64)(SINT64)*((UINT8 *)&cool_8_ints[i]+7);
03053       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03054 
03055       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
03056                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03057 
03058       if (*(SINT64 *)&test_result[i] != act_result[i])
03059       {
03060          printf(" ERROR:  incorrect result at %d\n", i);
03061          abort();
03062       }
03063 
03064       if (act_status[i] != test_status[i])
03065       {
03066          printf(" ERROR:  incorrect status at %d\n", i);
03067          abort();
03068       }
03069    }
03070    printf("PASSED\n");
03071 
03072 
03073    printf(" Testing convert:  UNSIGNED  8 INT ->   SIGNED 46 INT :  ");
03074 
03075    for (i=0; i<num_cool_8_ints; i++)
03076    {
03077       act_result[i] = (UINT64)(SINT46)*((UINT8 *)&cool_8_ints[i]+7);
03078       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03079 
03080       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
03081                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03082 
03083       if (*(SINT64 *)&test_result[i] != act_result[i])
03084       {
03085          printf(" ERROR:  incorrect result at %d\n", i);
03086          abort();
03087       }
03088 
03089       if (act_status[i] != test_status[i])
03090       {
03091          printf(" ERROR:  incorrect status at %d\n", i);
03092          abort();
03093       }
03094    }
03095    printf("PASSED\n");
03096 
03097 
03098    printf(" Testing convert:  UNSIGNED  8 INT -> UNSIGNED 32 INT :  ");
03099 
03100    for (i=0; i<num_cool_8_ints; i++)
03101    {
03102       act_result[i] = (UINT64)(UINT32)*((UINT8 *)&cool_8_ints[i]+7);
03103       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03104 
03105       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
03106                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03107 
03108       if (*(SINT64 *)&test_result[i] != act_result[i])
03109       {
03110          printf(" ERROR:  incorrect result at %d\n", i);
03111          abort();
03112       }
03113 
03114       if (act_status[i] != test_status[i])
03115       {
03116          printf(" ERROR:  incorrect status at %d\n", i);
03117          abort();
03118       }
03119    }
03120    printf("PASSED\n");
03121 
03122 
03123    printf(" Testing convert:  UNSIGNED  8 INT ->   SIGNED 32 INT :  ");
03124 
03125    for (i=0; i<num_cool_8_ints; i++)
03126    {
03127       act_result[i] = *((UINT8 *)&cool_8_ints[i]+7) & 0xffffffff;
03128       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03129       if ((SINT32)*((UINT8 *)&cool_8_ints[i]+7) < 0) {
03130          act_status[i] |= AR_STAT_NEGATIVE;
03131       }
03132 
03133       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
03134                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03135 
03136       if (*(SINT64 *)&test_result[i] != act_result[i])
03137       {
03138          printf(" ERROR:  incorrect result at %d\n", i);
03139          abort();
03140       }
03141 
03142       if (act_status[i] != test_status[i])
03143       {
03144          printf(" ERROR:  incorrect status at %d\n", i);
03145          abort();
03146       }
03147    }
03148    printf("PASSED\n");
03149 
03150 
03151    printf(" Testing convert:  UNSIGNED  8 INT -> UNSIGNED 24 INT :  ");
03152 
03153    for (i=0; i<num_cool_8_ints; i++)
03154    {
03155       act_result[i] = *((UINT8 *)&cool_8_ints[i]+7) & 0xffffff;
03156       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03157 
03158       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
03159                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03160 
03161       if (*(SINT64 *)&test_result[i] != act_result[i])
03162       {
03163          printf(" ERROR:  incorrect result at %d\n", i);
03164          abort();
03165       }
03166 
03167       if (act_status[i] != test_status[i])
03168       {
03169          printf(" ERROR:  incorrect status at %d\n", i);
03170          abort();
03171       }
03172    }
03173    printf("PASSED\n");
03174 
03175 
03176    printf(" Testing convert:  UNSIGNED  8 INT ->   SIGNED 24 INT :  ");
03177 
03178    for (i=0; i<num_cool_8_ints; i++)
03179    {
03180       act_result[i] = *((UINT8 *)&cool_8_ints[i]+7) & 0xffffff;
03181       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03182 
03183       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
03184                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03185 
03186       if (*(SINT64 *)&test_result[i] != act_result[i])
03187       {
03188          printf(" ERROR:  incorrect result at %d\n", i);
03189          abort();
03190       }
03191 
03192       if (act_status[i] != test_status[i])
03193       {
03194          printf(" ERROR:  incorrect status at %d\n", i);
03195          abort();
03196       }
03197    }
03198    printf("PASSED\n");
03199 
03200 
03201    printf(" Testing convert:  UNSIGNED  8 INT -> UNSIGNED  8 INT :  ");
03202 
03203    for (i=0; i<num_cool_8_ints; i++)
03204    {
03205       act_result[i] = (UINT64)(UINT8)*((UINT8 *)&cool_8_ints[i]+7);
03206       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03207 
03208       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
03209                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03210 
03211       if (*(SINT64 *)&test_result[i] != act_result[i])
03212       {
03213          printf(" ERROR:  incorrect result at %d\n", i);
03214          abort();
03215       }
03216 
03217       if (act_status[i] != test_status[i])
03218       {
03219          printf(" ERROR:  incorrect status at %d\n", i);
03220          abort();
03221       }
03222    }
03223    printf("PASSED\n");
03224 
03225 
03226    printf(" Testing convert:  UNSIGNED  8 INT ->   SIGNED  8 INT :  ");
03227 
03228    for (i=0; i<num_cool_8_ints; i++)
03229    {
03230       act_result[i] = (UINT8)(SINT8)*((UINT8 *)&cool_8_ints[i]+7);
03231       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03232 
03233       if (cool_8_ints[i].part4 & 0x80)
03234       {
03235          act_status[i] |= AR_STAT_NEGATIVE | AR_STAT_SEMIVALID;
03236          if(cool_8_ints[i].part4 & 0x7f)
03237            act_status[i] |=  AR_STAT_OVERFLOW;
03238       }
03239 
03240       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
03241                                   (AR_DATA *)&cool_8_ints[i], &uint8_artype);
03242 
03243       if (*(SINT64 *)&test_result[i] != act_result[i])
03244       {
03245          printf(" ERROR:  incorrect result at %d\n", i);
03246          abort();
03247       }
03248 
03249       if (act_status[i] != test_status[i])
03250       {
03251          printf(" ERROR:  incorrect status at %d\n", i);
03252          abort();
03253       }
03254    }
03255    printf("PASSED\n");
03256 }  /* test_8_U */
03257 
03258 
03259 test_8_S()
03260 {
03261    int i;
03262 
03263 
03264    printf(" Testing convert:    SIGNED  8 INT -> UNSIGNED 64 INT :  ");
03265 
03266    for (i=0; i<num_cool_8_ints; i++)
03267    {
03268       act_result[i] = (UINT64)(UINT64)*((SINT8 *)&cool_8_ints[i]+7);
03269       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03270 
03271       if (cool_8_ints[i].part4 & 0x80)
03272       {
03273          act_status[i] |= AR_STAT_OVERFLOW;
03274       }
03275 
03276       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint64_artype,
03277                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03278 
03279       if (*(SINT64 *)&test_result[i] != act_result[i])
03280       {
03281          printf(" ERROR:  incorrect result at %d\n", i);
03282          abort();
03283       }
03284 
03285       if (act_status[i] != test_status[i])
03286       {
03287          printf(" ERROR:  incorrect status at %d\n", i);
03288          abort();
03289       }
03290    }
03291    printf("PASSED\n");
03292 
03293 
03294    printf(" Testing convert:    SIGNED  8 INT ->   SIGNED 64 INT :  ");
03295 
03296    for (i=0; i<num_cool_8_ints; i++)
03297    {
03298       act_result[i] = (UINT64)(SINT64)*((SINT8 *)&cool_8_ints[i]+7);
03299       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03300 
03301       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint64_artype,
03302                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03303 
03304       if (cool_8_ints[i].part4 & 0x80)
03305       {
03306          act_status[i] |= AR_STAT_NEGATIVE;
03307       }
03308 
03309       if (*(SINT64 *)&test_result[i] != act_result[i])
03310       {
03311          printf(" ERROR:  incorrect result at %d\n", i);
03312          abort();
03313       }
03314 
03315       if (act_status[i] != test_status[i])
03316       {
03317          printf(" ERROR:  incorrect status at %d\n", i);
03318          abort();
03319       }
03320    }
03321    printf("PASSED\n");
03322 
03323 
03324    printf(" Testing convert:    SIGNED  8 INT ->   SIGNED 46 INT :  ");
03325 
03326    for (i=0; i<num_cool_8_ints; i++)
03327    {
03328       act_result[i] = (UINT64)(SINT46)*((SINT8 *)&cool_8_ints[i]+7);
03329       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03330 
03331       if (cool_8_ints[i].part4 & 0x80)
03332       {
03333          act_status[i] |= AR_STAT_NEGATIVE;
03334       }
03335 
03336       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint46_artype,
03337                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03338 
03339       if (*(SINT64 *)&test_result[i] != act_result[i])
03340       {
03341          printf(" ERROR:  incorrect result at %d\n", i);
03342          abort();
03343       }
03344 
03345       if (act_status[i] != test_status[i])
03346       {
03347          printf(" ERROR:  incorrect status at %d\n", i);
03348          abort();
03349       }
03350    }
03351    printf("PASSED\n");
03352 
03353 
03354    printf(" Testing convert:    SIGNED  8 INT -> UNSIGNED 32 INT :  ");
03355 
03356    for (i=0; i<num_cool_8_ints; i++)
03357    {
03358       act_result[i] = (UINT64)(UINT32)*((SINT8 *)&cool_8_ints[i]+7);
03359       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03360 
03361       if (cool_8_ints[i].part4 & 0x80)
03362       {
03363          act_status[i] |= AR_STAT_OVERFLOW;
03364       }
03365 
03366       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint32_artype,
03367                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03368 
03369       if (*(SINT64 *)&test_result[i] != act_result[i])
03370       {
03371          printf(" ERROR:  incorrect result at %d\n", i);
03372          abort();
03373       }
03374 
03375       if (act_status[i] != test_status[i])
03376       {
03377          printf(" ERROR:  incorrect status at %d\n", i);
03378          abort();
03379       }
03380    }
03381    printf("PASSED\n");
03382 
03383 
03384    printf(" Testing convert:    SIGNED  8 INT ->   SIGNED 32 INT :  ");
03385 
03386    for (i=0; i<num_cool_8_ints; i++)
03387    {
03388       act_result[i] = *((SINT8 *)&cool_8_ints[i]+7) & 0xffffffff;
03389       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03390 
03391       if (cool_8_ints[i].part4 & 0x80)
03392       {
03393          act_status[i] |= AR_STAT_NEGATIVE;
03394       }
03395 
03396       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint32_artype,
03397                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03398 
03399       if (*(SINT64 *)&test_result[i] != act_result[i])
03400       {
03401          printf(" ERROR:  incorrect result at %d\n", i);
03402          abort();
03403       }
03404 
03405       if (act_status[i] != test_status[i])
03406       {
03407          printf(" ERROR:  incorrect status at %d\n", i);
03408          abort();
03409       }
03410    }
03411    printf("PASSED\n");
03412 
03413 
03414    printf(" Testing convert:    SIGNED  8 INT -> UNSIGNED 24 INT :  ");
03415 
03416    for (i=0; i<num_cool_8_ints; i++)
03417    {
03418       act_result[i] = *((SINT8 *)&cool_8_ints[i]+7) & 0xffffff;
03419       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03420 
03421       if (cool_8_ints[i].part4 & 0x80)
03422       {
03423          act_status[i] |= AR_STAT_OVERFLOW;
03424       }
03425 
03426       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint24_artype,
03427                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03428 
03429       if (*(SINT64 *)&test_result[i] != act_result[i])
03430       {
03431          printf(" ERROR:  incorrect result at %d\n", i);
03432          abort();
03433       }
03434 
03435       if (act_status[i] != test_status[i])
03436       {
03437          printf(" ERROR:  incorrect status at %d\n", i);
03438          abort();
03439       }
03440    }
03441    printf("PASSED\n");
03442 
03443 
03444    printf(" Testing convert:    SIGNED  8 INT ->   SIGNED 24 INT :  ");
03445 
03446    for (i=0; i<num_cool_8_ints; i++)
03447    {
03448       act_result[i] = *((SINT8 *)&cool_8_ints[i]+7) & 0xffffff;
03449       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03450 
03451       if (cool_8_ints[i].part4 & 0x80)
03452       {
03453          act_status[i] |= AR_STAT_NEGATIVE;
03454       }
03455 
03456       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint24_artype,
03457                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03458 
03459       if (*(SINT64 *)&test_result[i] != act_result[i])
03460       {
03461          printf(" ERROR:  incorrect result at %d\n", i);
03462          abort();
03463       }
03464 
03465       if (act_status[i] != test_status[i])
03466       {
03467          printf(" ERROR:  incorrect status at %d\n", i);
03468          abort();
03469       }
03470    }
03471    printf("PASSED\n");
03472 
03473 
03474    printf(" Testing convert:    SIGNED  8 INT -> UNSIGNED  8 INT :  ");
03475 
03476    for (i=0; i<num_cool_8_ints; i++)
03477    {
03478       act_result[i] = (UINT64)(UINT8)*((SINT8 *)&cool_8_ints[i]+7);
03479       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03480 
03481       if (cool_8_ints[i].part4 & 0x80)
03482       {
03483          act_status[i] |= AR_STAT_SEMIVALID;
03484          if(cool_8_ints[i].part4 & 0x7f)
03485            act_status[i] |=  AR_STAT_OVERFLOW;
03486       }
03487 
03488       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &uint8_artype,
03489                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03490 
03491       if (*(SINT64 *)&test_result[i] != act_result[i])
03492       {
03493          printf(" ERROR:  incorrect result at %d\n", i);
03494          abort();
03495       }
03496 
03497       if (act_status[i] != test_status[i])
03498       {
03499          printf(" ERROR:  incorrect status at %d\n", i);
03500          abort();
03501       }
03502    }
03503    printf("PASSED\n");
03504 
03505 
03506    printf(" Testing convert:    SIGNED  8 INT ->   SIGNED  8 INT :  ");
03507 
03508    for (i=0; i<num_cool_8_ints; i++)
03509    {
03510       act_result[i] = *((SINT8 *)&cool_8_ints[i]+7) & 0xff;
03511       act_status[i] = (act_result[i] == 0) ? AR_STAT_ZERO : AR_STAT_OK;
03512 
03513       if (cool_8_ints[i].part4 & 0x80)
03514       {
03515          act_status[i] |= AR_STAT_NEGATIVE;
03516       }
03517 
03518       test_status[i] = AR_convert((AR_DATA *)&test_result[i], &sint8_artype,
03519                                   (AR_DATA *)&cool_8_ints[i], &sint8_artype);
03520 
03521       if (*(SINT64 *)&test_result[i] != act_result[i])
03522       {
03523          printf(" ERROR:  incorrect result at %d\n", i);
03524          abort();
03525       }
03526 
03527       if (act_status[i] != test_status[i])
03528       {
03529          printf(" ERROR:  incorrect status at %d\n", i);
03530          abort();
03531       }
03532    }
03533    printf("PASSED\n");
03534 }  /* test_8_S */
03535 
03536 #endif   /* _CRAY */
03537 
03538 static char USMID [] = "\n%Z%%M%        %I%     %G% %U%\n";
03539 static char rcsid [] = "$Id: testcvt.c,v 1.1.1.1 2002-05-22 20:06:19 dsystem Exp $";
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines