New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support __int128_t, __uint128_t types #82
Comments
What type of interfacing do you need from mp++? Is it enough to be able to construct/convert mp++ integers from/to |
Yes, I would also need overloaded operators. My primsum program currently mixes Here is a C++ code snippet used in my program: while ((prime = iter.next_prime()) < stop)
{
int64_t xn = (int64_t) max(x / (prime * prime), prime);
maxint_t diff = prime_sums[pi[y]] - prime_sums[pi[xn]];
s2_trivial += prime * diff;
}
I don't know how much work it is for your to support the overloaded operators but it would definitely be very usefull to me, |
I think supporting the 128 bit integers is definitely worthwhile, so consider it on the roadmap now :) As a word of caution, I haven't really looked into optimizing performance for integers with more than 2 static limbs. For > 2 limbs, I am just using the |
For your information:
One possible way to support this in your library would be using: #if defined(__SIZEOF_INT128__)
#endif This works using both GCC and Clang. |
Indeed! I am using 128bit integers already in the optimised 2-limbs implementations of basic arithmetic, and using that very same definition to check for availability: https://github.com/bluescarni/mppp/blob/master/include/mp%2B%2B/integer.hpp#L82 I'll ping you here as soon as I make progress. |
@kimwalisch This may be a bit OT, but do you need modular arithmetic behaviour on integer operations? |
No, I don't need that. |
This has been implemented in #90, just merged to master. |
Hi,
The
__int128_t
and__uint128_t
types are non standard C/C++ extensions supported by Clang and GCC (and I guess by the Intel Linux compiler as well). Currently they seem to be not supported:Boost multiprecision supports the
__int128_t
and__uint128_t
types, I was hoping to be able to use mp++ instead of Boost multiprecision in my primesum program and get a performance benefit.The text was updated successfully, but these errors were encountered: