Skip to content

liulilittle/Int128

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

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());

Releases

No releases published

Packages

No packages published

Languages