Add support for _BitInt on clang - #4072
Conversation
903edfd to
3666cee
Compare
|
@Arghnews, do you plan to update this PR or shall we close it for now (can be reopened later)? |
@vitaut Hi, sorry been busy and now I'm on holiday for 2 weeks, but will update once back and implement your feedback. I'd say leave it open and I'll update in 2-3 weeks, but it's up to you (can reopen of course). Cheers! |
|
No hurry. Let's keep it open and enjoy your holiday! |
7322e2c to
d8ad099
Compare
|
Hi, Reworked this so that now fmtlib will format Uses wider formatter ie. integer types are widened to 64bit if <= 64 bits wide (assume this is acceptable for performance) Can't write Let me know any feedback @vitaut |
d8ad099 to
df02f20
Compare
| using type = conditional_t< | ||
| N <= 64, conditional_t<is_signed, int64_t, uint64_t>, | ||
| conditional_t<(N > 64 && N <= 128), | ||
| conditional_t<is_signed, __int128, unsigned __int128>, | ||
| void>>; |
There was a problem hiding this comment.
I think this can be moved to bitint_traits which would make number_of_bits and is_signed unnecessary.
There was a problem hiding this comment.
I think this can be moved to
bitint_traitswhich would makenumber_of_bitsandis_signedunnecessary.
Nice suggestion, have done. Only thing to note, we must #include <cstdint> in base.h now, for the int64_t, if this is acceptable. This was already included in format.h
There was a problem hiding this comment.
Let's use (unsigned) long long which is guaranteed to be at least 64-bit and avoid additional include.
There was a problem hiding this comment.
Let's use
(unsigned) long longwhich is guaranteed to be at least 64-bit and avoid additional include.
Good shout, have made this change
df02f20 to
1191f39
Compare
Issue fmtlib#4007 Make _BitInt up to 128bits formattable Note, libstdc++ is_signed doesn't work with _BitInt (so use own)
1191f39 to
d32293c
Compare
|
Merged, thanks! |
Issue #4007
Only enabled for clang >= 14 as that's all that supports
_BitIntat the momentWe need a forwarding reference for
mapto be a "more specialized" match;const T&,Tetc. are ambiguous.I'm not too familiar, would there be a better way to do this by adding an entry into
enum class typefor_BitInts? Or this is fine?Fyi this worked in version 9 because of this catch-all overload:
fmt/include/fmt/core.h
Lines 1506 to 1516 in a337011
Which was then subsequently narrowed down to extended FP types (which "broke" the accidental support for this):
fmt/include/fmt/base.h
Lines 1527 to 1537 in 6a192f8