
29 Apr
2013
29 Apr
'13
8:03 a.m.
If you absolutely needed an 8.4 type then you need fixed-width integer support beyond that provided by <cstdint>. You could provide an implementation of integer<12> that is a 12 bit integer and then make fixed<integer<12>,4>. In my opinion this is another library outside the scope of a fixed-point library.
Can I just point out that the multiprecision lib will do a 12-bit int type if that's what you want: typedef number<cpp_int<12, 12, unsigned_magnitude, unchecked, void> > my_int12_t; Of course the signed version is signed-magnitude not 2's complement.... BTW, it may well also be worth investigating using multiprecision::number as the front end for these types? Now I'll go back to lurking ;-) John.