/**
 *	endian - program to show platform endianity
 *	Copyright (C) 2009 Matous Jan Fialka, <http://mjf.cz/>
 *	Released under the terms of The MIT License
 *
 *	Compile: cc -o endian endian.c
 */

#include <stdio.h>

inline static int endian()
{
	union {
		int i;
		char c[4];
	} u;

	u.i = 0x0A0B0C0D;
	if (u.c[0] == 0x0A && u.c[1] == 0x0B && u.c[2] == 0x0C && u.c[3] == 0x0D) {
		return 1;
	}
	if (u.c[0] == 0x0B && u.c[1] == 0x0A && u.c[2] == 0x0D && u.c[3] == 0x0C) {
		return 2;
	}
	if (u.c[0] == 0x0D && u.c[1] == 0x0C && u.c[2] == 0x0B && u.c[3] == 0x0A) {
		return 3;
	}
	return 0;
}

int main(void)
{
	int e;

	e = endian();
	if (e == 0) {
		printf("unknown\n");
	}
	if (e == 1) {
		printf("big\n");
	}
	if (e == 2) {
		printf("middle\n");
	}
	if (e == 3) {
		printf("little\n");
	}
	return 0;
}
