// BEGIN mycpp output #include "mycpp/runtime.h" GLOBAL_STR(str0, "a = %d"); GLOBAL_STR(str1, "i1 = %s"); GLOBAL_STR(str2, "i2 = %s"); GLOBAL_STR(str3, "i3 = %s"); GLOBAL_STR(str4, ""); GLOBAL_STR(str5, "max_positive = %s"); GLOBAL_STR(str6, "max_negative = %s"); GLOBAL_STR(str7, "max_negative string = %s"); GLOBAL_STR(str8, "max_negative2 = %s"); GLOBAL_STR(str9, "ok"); GLOBAL_STR(str10, "round trip equal"); GLOBAL_STR(str11, "big = %s"); GLOBAL_STR(str12, "small = %d"); namespace test_integers { // forward declare } // forward declare namespace test_integers namespace test_integers { // declare void run_tests(); void run_benchmarks(); } // declare namespace test_integers namespace test_integers { // define void run_tests() { int a; mops::BigInt i1; mops::BigInt i2; mops::BigInt i3; mops::BigInt i4; mops::BigInt x; mops::BigInt y; mops::BigInt max_positive; mops::BigInt z; mops::BigInt max_negative; BigStr* s1 = nullptr; bool ok; mops::BigInt max_negative2; mops::BigInt big; int small; StackRoot _root0(&s1); a = (3 + 2); print(StrFormat("a = %d", a)); i1 = mops::LShift(mops::BigInt(1), mops::BigInt(31)); i2 = mops::Add(i1, i1); i3 = mops::Add(i2, i1); print(StrFormat("i1 = %s", mops::ToStr(i1))); print(StrFormat("i2 = %s", mops::ToStr(i2))); print(StrFormat("i3 = %s", mops::ToStr(i3))); print(str4); i4 = mops::LShift(mops::BigInt(1), mops::BigInt(63)); x = mops::LShift(mops::BigInt(1), mops::BigInt(62)); y = mops::Sub(x, mops::BigInt(1)); max_positive = mops::Add(x, y); print(StrFormat("max_positive = %s", mops::ToStr(max_positive))); z = mops::Sub(mops::BigInt(0), x); max_negative = mops::Sub(z, x); print(StrFormat("max_negative = %s", mops::ToStr(max_negative))); s1 = mops::ToStr(max_negative); print(StrFormat("max_negative string = %s", s1)); Tuple2 tup0 = mops::FromStr2(s1); ok = tup0.at0(); max_negative2 = tup0.at1(); print(StrFormat("max_negative2 = %s", mops::ToStr(max_negative2))); if (ok) { print(str9); } if (mops::Equal(max_negative, max_negative2)) { print(str10); } big = mops::IntWiden(a); print(StrFormat("big = %s", mops::ToStr(big))); small = mops::BigTruncate(big); print(StrFormat("small = %d", small)); } void run_benchmarks() { ; // pass } } // define namespace test_integers