Intial commit of source code samples for GitHub repo.
This commit is contained in:
parent
5793080047
commit
9462407ba8
14 changed files with 397 additions and 1 deletions
46
sizeofchk/sizeofchk.c
Normal file
46
sizeofchk/sizeofchk.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue