+ std::string cmd = "python -c 'print ";
+ if (n.sign == negative)
+ cmd += '-';
+ cmd += "0x" + numberToHex(n) + "'";
+
+ char buf[BUFSIZ];
+ FILE *ptr;
+
+ if ((ptr = popen(cmd.c_str(), "r")) != NULL)
+ while (fgets(buf, BUFSIZ, ptr) != NULL)
+ os << buf;
+ pclose(ptr);
+ return os;
+}
+
+template < typename N, typename E >
+std::istream& operator>> (std::istream& is, number< N, E >& n)
+{
+ std::string str;
+ is >> str;
+ unsigned base = 10;
+ if (is.flags() & std::ios_base::hex) // Si lo piden en hexa
+ base = 16;
+ if (is.flags() & std::ios_base::oct) // Si lo piden en octal
+ base = 8;
+ n = number< N, E >(str, base);
+ return is;
+}
+
+template < typename N, typename E >
+std::string numberToHex(const number< N, E >& n)
+{
+ std::ostringstream os;
+ typename number< N, E >::const_reverse_iterator i = n.chunk.rbegin();
+ typename number< N, E >::const_reverse_iterator end = n.chunk.rend();
+ // Salteo ceros
+ for (; i != end; ++i)
+ if (*i != 0)
+ break;
+ if (i != end) // Si no llegué al final, imprimo sin 'leading zeros'
+ {
+ os << std::hex << *i;
+ ++i; // y voy al próximo
+ }
+ // imprimo el resto con 'leading zeros'
+ for (; i != end; ++i)
+ os << std::setfill('0') << std::setw(sizeof(N) * 2) << std::hex
+ << *i;
+ return os.str();
+}
+
+template < typename N, typename E >
+std::string numberToHexDebug(const number< N, E >& n)
+{
+ std::ostringstream os;