Best way to handle int64_t with ttmath.


What could be the best way to assign a "int64_t" type variable to say ttmath::Int<2> or ttmath::Int<4>? I am running into compilation errors like "ambiguous conversion".

error: conversion from 'const int64_t {aka const long int}' to 'const ttmath::Int<2u>' is ambiguous

What's the best way to make such conversions?


Added by: tomek, 2016 XII 15

#include <iostream>
#include "ttmath/ttmath.h"

int main()
ttmath::Int<2> a;
int64_t b;

b = 101;
a = b;

std::cout << a << std::endl;

/home/tomek/roboczy/prog/test$ clang++ -o q -I../ttmath -g3 -O0 q.cpp && ./q

What platform are you using (32 or 64bit) and what compiler?

Added by: ~Atul, 2016 XII 16

I am using 64-bit little-endian platform (ppc64le) and my gcc version is 5.4.0 (with c++11).

Added by: ~Atul, 2016 XII 16

Thank you @tomek! I could confirm that the issue is in the application code which uses ttmath and not in ttmath itself. Thank you very much!