aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/ipak32.c
blob: a4f5061b422352eb323331de6f6de9d2aee39c6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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);
}