-
Notifications
You must be signed in to change notification settings - Fork 74
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
not support __int128 output #163
Comments
I'm unable to reproduce the first issue: template <typename T, int32_t Digits>
class TestFixedPoint {
public:
TestFixedPoint(T t) : value_(t) {}
private:
T value_;
BINLOG_ADAPT_STRUCT_FRIEND;
};
using TestPrice = TestFixedPoint<int64_t, 9>;
BINLOG_ADAPT_TEMPLATE((typename Interl, int Digits), (TestFixedPoint<Interl, Digits>), value_)
//...
TestPrice myPrice(1);
BINLOG_INFO("my log MyPrice: {}", myPrice); This works as expected. Regarding __int128: It is not a standard type, and therefore not supported. As a workaround, you can:
|
Hi Erenon, The origin requirement is that a custom type (similar to template<typename IntegerT, int32_t Digits>
class FixedPoint {
// custom defined operator + - * /
std::toString() const {
...
}
private:
IntegerT _value;
};
using ValueT = FixedPoint<__int128, 13>;
we can write
template<typename IntegerT, int32_t Digits>
class FixedPoint {
// custom defined operator + - * /
std::toString() const {
...
}
int64_t getUper() const ;
int64_t getLower() const;
int32_t getDigits() const;
private:
IntegerT _value;
}; If we changed the code as above, so the question is how to customize the output of a struct? how to change bread tool code. |
You can modify PrettyPrinter here: https://github.com/morganstanley/binlog/blob/main/include/binlog/PrettyPrinter.cpp#L128 |
Hi Erenon, for example , how to remove the type prefix , only keep the value? |
did you change PrettyPrinter.cpp? |
Erenon, thanks for your support. After binlog turnedover to prod, it reduced CPU usage to one-half and reduced the CPU spikes with ~60M memory usage increase. |
Question1:
template <typename T, int32_t Digits> class TestFixedPoint {
public:
TestFixedPoint(T t) : value_(t) {}
private:
T value_;
BINLOG_ADAPT_STRUCT_FRIEND;
};
using TestPrice = TestFixedPoint<int64_t, 9>;
BINLOG_ADAPT_TEMPLATE((typename Interl, int Digits),
(TestFixedPoint<Interl, Digits>), value_)
BINLOG_INFO_W(writer, "my log MyPrice: {}", myPrice);
Compile time error:
binlog/include/mserialize/make_template_serializable.hpp:75:84: 错误:‘long int TestFixedPoint<long int, 9>::value_’ is private within this context
Question2:
if T == __int128 then throw "This Arithmetic type is not taggable" at tag.hpp line 79
The text was updated successfully, but these errors were encountered: