Created
December 21, 2014 23:51
-
-
Save fffaraz/20da8e831c9d6e547c84 to your computer and use it in GitHub Desktop.
ui512test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdint> | |
using namespace std; | |
#include <boost/multiprecision/cpp_int.hpp> | |
using namespace boost::multiprecision; | |
#if 0 | |
union uint512_c | |
{ | |
uint512_t t; | |
unsigned char c[512/8]; | |
}; | |
void print_ui512(uint512_t num) | |
{ | |
uint512_c uc; | |
uc.t = num; | |
for(int i=0; i < (512/8); i++) | |
{ | |
int byte = uc.c[i]; | |
printf("%02X", byte); | |
} | |
printf("\n"); | |
} | |
#else | |
void print_ui512(uint512_t num) | |
{ | |
unsigned char *cnum = (unsigned char *) # | |
for(int i=0; i < (512/8); i++) | |
{ | |
int byte = cnum[i]; | |
printf("%02X", byte); | |
} | |
printf("\n"); | |
} | |
#endif | |
int main() | |
{ | |
uint512_t num = 1; | |
print_ui512(num); | |
cout << hex << setfill('0') << setw(512/8*2) << num << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment