1 /******************************************************
8 * Written by Charles Childers, released into the public
10 ******************************************************/
16 #include "functions.h"
22 #define LITTLEENDIAN 1
24 /* This is a slightly tricky bit of code to convert an image from one endian to the other. */
25 /* It's only recieved minimal testing, so I hope it actually works... */
29 short int word
= 0x0001;
30 char *byte
= (char *) &word
;
31 endian
= (byte
[0] ? LITTLEENDIAN
: BIGENDIAN
);
33 if (endian
== LITTLEENDIAN
)
34 printf("Converting to big endian\n");
35 if (endian
== BIGENDIAN
)
36 printf("Converting to little endian\n");
38 for(a
= 0; a
< IMAGE_SIZE
; a
++)
41 vm
.image
[a
] = (x
>>24) | ((x
<<8) & 0x00FF0000) | ((x
>>8) & 0x0000FF00) | (x
<<24);