/*
 * File: datamodel.c
 *
 * Copyright (c) 2009 Bruce Blinn
 *
 * Description
 *	Identify the data model used on the current system.
 *
 * Use the following command to compile this program:
 *
 *	$ cc -o datamodel datamodel.c
 *
 */

#include <stdlib.h>
#include <stdio.h>

#define bitsizeof(p)	(sizeof(p) * 8)

int main(int argc, char *argv[])
{
	int	i;
	long	l;
	void	*p;

	if ( (bitsizeof(i) == 32) &&
	     (bitsizeof(l) == 32) &&
	     (bitsizeof(p) == 32) )
		printf("ILP32\n");
	else if (
	     (bitsizeof(i) == 32) &&
	     (bitsizeof(l) == 64) &&
	     (bitsizeof(p) == 64) )
		printf("LP64\n");
	else if (
	     (bitsizeof(i) == 64) &&
	     (bitsizeof(l) == 64) &&
	     (bitsizeof(p) == 64) )
		printf("ILP64\n");
	else
		printf("I%dL%dP%d\n",
			(int)bitsizeof(i),
			(int)bitsizeof(l),
			(int)bitsizeof(p));

	exit(0);
}
