Skip to content
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

Concerning bitwise operations #82

Open
JChMathae opened this issue Jul 8, 2022 · 1 comment
Open

Concerning bitwise operations #82

JChMathae opened this issue Jul 8, 2022 · 1 comment

Comments

@JChMathae
Copy link

Hello,

First, thank you for this clever coding trick!

Now I have a little improvement to suggest:

  • for the BitWiseLeftShiftable/BitWiseRightShiftable skills, it would be better to use an 'int' as parameter, like:
    template <typename T> struct BitWiseLeftShiftable : crtp<T, fluentBitWiseLeftShiftable> { FLUENT_NODISCARD constexpr T operator<<(const int shift) const { return T(this->underlying().get() << shift); } FLUENT_CONSTEXPR17 T& operator<<=(const int shift) { this->underlying().get() <<= shift; return this->underlying(); } };

  • and also it would be fine to define an aggregate skill, alongside 'struct Arithmetic', for bitwise operations, like
    template<typename T> struct BitWise : BitWiseInvertable<T> , BitWiseAndable<T> , BitWiseOrable<T> , BitWiseXorable<T> , BitWiseLeftShiftable<T> , BitWiseRightShiftable<T> , Comparable<T> {};

Best regards.

@JChMathae
Copy link
Author

Another change for embedded system:

Do not only rely on the definition of STDC_HOSTED for the "use" of ...
On my little ARM µC target undefining STDC_HOSTED divides ROM memory usage by ... 10 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant