src-ed/misc-tools/sizeofchk/sizeofchk.c

47 lines
1.4 KiB
C
Raw Normal View History

/* simple utility to print out sizeof values...
*/
#include <stdio.h>
#include <x86intrin.h>
#include "sizeofchk.h" /* generated by makefile */
static char version[] = VERSION_STRING;
int main()
{
int (*funcptr)();
printf("Sizeof Utility by Ed Braaten - Version %s\n", version);
printf("Running on %s (%s %s)\n", ARCHINFO, SYSINFO, RELEASEINFO);
printf("Compiler version: '%s'\n\n", COMPILEINFO);
printf(" sizeof(char) = %lu bits\n", sizeof(char) * 8);
printf(" sizeof(short) = %lu bits\n", sizeof(short) * 8);
printf(" sizeof(int) = %lu bits\n", sizeof(int) * 8);
printf(" sizeof(long int) = %lu bits\n", sizeof(long int) * 8);
printf(" sizeof(long) = %lu bits\n", sizeof(long) * 8);
printf(" sizeof(long long) = %lu bits\n", sizeof(long long) * 8);
printf(" sizeof(float) = %lu bits\n", sizeof(float) * 8);
printf(" sizeof(double) = %lu bits\n", sizeof(double) * 8);
printf(" sizeof(long double) = %lu bits\n", sizeof(long double) * 8);
printf(" sizeof(char *) = %lu bits\n", sizeof(char *) * 8);
printf(" sizeof((*)()) = %lu bits\n", sizeof(funcptr) * 8);
#ifdef __SSE__
printf("\nSSE types\n\n");
printf(" sizeof(__m64) = %lu bits\n", sizeof(__m64) * 8);
printf(" sizeof(__m128) = %lu bits\n", sizeof(__m128) * 8);
#endif
#ifdef __clang__
/* clang doesn't support __float128 */
#else
#ifdef __SSE2__
printf(" sizeof(__float128) = %lu bits\n", sizeof(__float128) * 8);
#endif
#endif
printf("\n");
return(0);
}