fork download
  1. #include <iostream>
  2. #include <netinet/in.h>
  3.  
  4. using namespace std;
  5. inline uint64_t htonll(uint64_t n) { return (((uint64_t)htonl(n)) << 32) + htonl(n >> 32); }
  6. inline uint64_t ntohll(uint64_t n) { return (((uint64_t)htonl(n)) << 32) + htonl(n >> 32); }
  7.  
  8. int main() {
  9. auto i = htonll(8322004669923586326);
  10. cout << i << endl;
  11.  
  12. i = ntohl(0x97000000);
  13. cout << i << endl;
  14.  
  15. i = ntohl(0x95000000);
  16. cout << i << endl;
  17.  
  18. i = ntohl(0x93000000);
  19. cout << i << endl;
  20.  
  21. i = ntohl(0x8d000000);
  22. cout << i << endl;
  23.  
  24. i = ntohl(0x67000000);
  25. cout << i << endl;
  26.  
  27. i = ntohl(0x41000007);
  28. cout << i << endl;
  29.  
  30. i = ntohl(0x0000005f);
  31. cout << i << endl;
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5500KB
stdin
Standard input is empty
stdout
1653366185455222131
151
149
147
141
103
117440577
1593835520