Skip to content

Instantly share code, notes, and snippets.

@atiq-cs
Last active August 31, 2017 05:14
Show Gist options
  • Save atiq-cs/56ba65b7b5cfbdd487d854efa9db4940 to your computer and use it in GitHub Desktop.
Save atiq-cs/56ba65b7b5cfbdd487d854efa9db4940 to your computer and use it in GitHub Desktop.
C program for format specifier. This experiment was done to verify the sparc disassembler functions
/*
Example output (on sparc),
1969772169
1969772169
0x75685689
75685689
016532053211
16532053211
*/
#include <stdio.h>
typedef unsigned long long ulnglng_t;
int main() {
char out_buf[100];
int value = 0x75685689;
sprintf ( out_buf, "%#llu", (ulnglng_t) value );
printf("%s\n", out_buf);
sprintf ( out_buf, "%llu", (ulnglng_t) value );
printf("%s\n", out_buf);
sprintf( out_buf, "%#llx", (ulnglng_t) value);
printf("%s\n", out_buf);
sprintf( out_buf, "%llx", (ulnglng_t) value);
printf("%s\n", out_buf);
sprintf( out_buf, "%#llo", (ulnglng_t) value);
printf("%s\n", out_buf);
sprintf( out_buf, "%llo", (ulnglng_t) value);
printf("%s\n", out_buf);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment