Skip to content

Latest commit

 

History

History
43 lines (42 loc) · 1019 Bytes

README.md

File metadata and controls

43 lines (42 loc) · 1019 Bytes

Int128

Implement int128 bit integer various operators

Sample

Ns::Int128 a = 0xf;
Ns::Int128 b = a * 17;
Ns::Int128 c = (b + 1) / a;
Ns::Int128 d = (b + 1) % a;

std::strstream ss;
ss << a;
Ns::Int128 lo;
ss >> lo;

printf("DEC: %s\nHEX: %s\nBIN: %s\n",
(a << 100).ToString().data(),
(a << 100).ToHex().data(),
(a << 100).ToBinary().data());

printf("DEC: %s\nHEX: %s\nBIN: %s\n",
((a << 100) >> 97).ToString().data(),
((a << 100) >> 97).ToHex().data(),
((a << 100) >> 97).ToBinary().data());

printf("DEC: %s\nHEX: %s\nBIN: %s\n",
(a--).ToString().data(),
(a).ToHex().data(),
(--a).ToBinary().data());

printf("DEC: %s\nHEX: %s\nBIN: %s\n",
(a).ToString().data(),
(a).ToHex().data(),
(a).ToBinary().data());