aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/i32to64.c
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/osb/i32to64.c
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/osb/i32to64.c')
-rw-r--r--sys/osb/i32to64.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/osb/i32to64.c b/sys/osb/i32to64.c
new file mode 100644
index 00000000..4b4b00d1
--- /dev/null
+++ b/sys/osb/i32to64.c
@@ -0,0 +1,42 @@
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* I32TO64 - Convert big endian 32bit integer array into 64bit.
+ */
+int
+I32TO64 (void *a, void *b, XINT *nelems)
+{
+ XINT i, j, k;
+ char *ip = (char *) a,
+ *op = (char *) b;
+
+
+ j = *nelems * 8;
+ k = *nelems * 4;
+
+ if ( ip < op ) {
+ for ( i = k ; 0 < i ; i-- )
+ op[i-1] = ip[i-1];
+ }
+ else if ( op < ip ) {
+ for ( i = 0 ; i < k ; i++ )
+ op[i] = ip[i];
+ }
+
+ for ( i=0 ; i < *nelems ; i++ ) {
+ char pad;
+ op[--j] = op[--k];
+ op[--j] = op[--k];
+ op[--j] = op[--k];
+ op[--j] = op[--k];
+ if ( (op[k] & 0x080) != 0 ) pad = 0x0ff;
+ else pad = 0;
+ op[--j] = pad;
+ op[--j] = pad;
+ op[--j] = pad;
+ op[--j] = pad;
+ }
+
+ return 0;
+}