aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/ipak32.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/osb/ipak32.c
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/osb/ipak32.c')
-rw-r--r--sys/osb/ipak32.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/osb/ipak32.c b/sys/osb/ipak32.c
new file mode 100644
index 00000000..a4f5061b
--- /dev/null
+++ b/sys/osb/ipak32.c
@@ -0,0 +1,23 @@
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* IPAK32 - Pack 64-bit int into and array of 32-bit int.
+ */
+void
+IPAK32 (void *a, void *b, XINT *nelems)
+{
+ /* MACHDEP - Works only for little-endian systems (e.g. x86)
+ */
+ XINT *ip = (XINT *) a;
+ int *op = (int *) calloc (*nelems, sizeof (int));
+ int *tmp, i;
+
+ tmp = op;
+ for (i=0; i < *nelems; i++, ip++) {
+ *tmp++ = (int) (*ip);
+ }
+ memmove (b, op, *nelems * sizeof (int));
+
+ free (op);
+}