#include <iostream>
#include <ostream>
#include <iomanip>
#include <cstdlib>
#include "imp/signed_int.hpp"
int main()
{
using namespace imp;
using namespace std;
signed_int< 128 > s128("-123456789123456789123456" );
cout << hex << s128 << '\n';
cout << dec << s128 << '\n';
using std::abs;
signed_int< 128 > b = abs( s128 );
cout << hex << b << '\n';
cout << dec << b << '\n';
if ( b != -s128 )
{
cerr << "Arghhhhhhhh..........\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Test Result: gcc34 Passed, msvc80 Passed, msvc71 Passed
Warning
./gensrc/func-abs-id-abs.cpp:21: : 'imp::signed_int_s::signed_int<N> imp::signed_int_s::abs<128>(const imp::signed_int_s::signed_int<N> &)' : resolved overload was found by argument-dependent lookup with [ N=128 ] ../sint-adl.hpp:56: see declaration of 'imp::signed_int_s::abs'Output
ffffffffffffe5db64e08a518127ee80 -123456789123456789123456 1a249b1f75ae7ed81180 123456789123456789123456