From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- noao/onedspec/odcombine/src/tymax.x | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 noao/onedspec/odcombine/src/tymax.x (limited to 'noao/onedspec/odcombine/src/tymax.x') diff --git a/noao/onedspec/odcombine/src/tymax.x b/noao/onedspec/odcombine/src/tymax.x new file mode 100644 index 00000000..a7f4f469 --- /dev/null +++ b/noao/onedspec/odcombine/src/tymax.x @@ -0,0 +1,27 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include + + +# TY_MAX -- Return the datatype of highest precedence. + +int procedure ty_max (type1, type2) + +int type1, type2 # Datatypes + +int i, j, type, order[8] +data order/TY_SHORT,TY_USHORT,TY_INT,TY_LONG,TY_REAL,TY_DOUBLE,TY_COMPLEX,TY_REAL/ + +begin + for (i=1; (i<=7) && (type1!=order[i]); i=i+1) + ; + for (j=1; (j<=7) && (type2!=order[j]); j=j+1) + ; + type = order[max(i,j)] + + # Special case of mixing short and unsigned short. + if (type == TY_USHORT && type1 != type2) + type = TY_INT + + return (type) +end -- cgit