X-Git-Url: https://mattmccutchen.net/bigint/bigint.git/blobdiff_plain/2406559a7644b4b9dd2bb19b99591c5ef6fc1cc4..ef2b7c5922c36f93923dd3482c5bfd41b14d82ce:/sample.cc diff --git a/sample.cc b/sample.cc index a560e6b..f60a294 100644 --- a/sample.cc +++ b/sample.cc @@ -62,10 +62,17 @@ int main() { * ``put-here operations''; see `BigUnsigned.hh' for details. */ BigInteger g(314159), h(265); - // All five ``return-by-value'' operators. + // All five ``return-by-value'' arithmetic operators. std::cout << (g + h) << '\n' << (g - h) << '\n' << (g * h) << '\n' << (g / h) << '\n' << (g % h) << std::endl; + BigUnsigned i(0xFF0000FF), j(0x0000FFFF); + // All five ``return-by-value'' bitwise operators. + std::cout.flags(std::ios::hex | std::ios::showbase); + std::cout << (i & j) << '\n' << (i | j) << '\n' << (i ^ j) << '\n' + << (j << 21) << '\n' << (j >> 10) << '\n'; + std::cout.flags(std::ios::dec); + // Let's do some heavy lifting and calculate powers of 314. int maxPower = 10; BigUnsigned x(1), big314(314);