Skip to content

Commit

Permalink
πŸ›  Fix usage of alignment and similar for load_be
Browse files Browse the repository at this point in the history
β€” πŸ›  Correct macro usage
  • Loading branch information
ThePhD committed Jul 19, 2023
1 parent eeb3aba commit 5413729
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/ztd/idk/assume_aligned.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#if ZTD_IS_ON(ZTD_STD_LIBRARY_ASSUME_ALIGNED)
#include <memory>

#define ZTD_ASSUME_ALIGNED_CXX(_ALIGNMENT, ...) ::std::assume_aligned<_ALIGNMENT>(__VA_ARGS__);
#define ZTD_ASSUME_ALIGNED_CXX(_ALIGNMENT, ...) ::std::assume_aligned<_ALIGNMENT>(__VA_ARGS__)
#else
#define ZTD_ASSUME_ALIGNED_CXX(_ALIGNMENT, ...) ZTD_ASSUME_ALIGNED_C(_ALIGNMENT, __VA_ARGS__)
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/ztd/idk/bit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ namespace ztd {
if (!::std::is_constant_evaluated()) {
const unsigned char* __aligned_byte_ptr = static_cast<const unsigned char*>(
ZTD_ASSUME_ALIGNED(alignof(_Integralish), static_cast<const void*>(__ptr)));
return ::ztd::load8_le(__value, __aligned_byte_ptr);
return ::ztd::load8_le<_Integralish>(__aligned_byte_ptr);
}
else
#endif
Expand All @@ -882,7 +882,7 @@ namespace ztd {
if (!::std::is_constant_evaluated()) {
const unsigned char* __aligned_byte_ptr = static_cast<const unsigned char*>(
ZTD_ASSUME_ALIGNED(alignof(_Integralish), static_cast<const void*>(__ptr)));
return ::ztd::load8_be(__value, __aligned_byte_ptr);
return ::ztd::load8_be<_Integralish>(__aligned_byte_ptr);
}
else
#endif
Expand Down
10 changes: 6 additions & 4 deletions include/ztd/idk/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#include <ztd/idk/charN_t.hpp>

#include <type_traits>
#if ZTD_IS_ON(ZTD_STD_SPACESHIP_COMPARE) && ZTD_IS_ON(ZTD_STD_LIBRARY_SPACESHIP_COMPARE)
#include <compare>
#endif

#include <ztd/prologue.hpp>

Expand Down Expand Up @@ -359,17 +362,16 @@ namespace ztd {
template <typename T, typename U>
concept same = (std::is_same_v<T, U> && std::is_same_v<U, T>);

#if ZTD_IS_ON(ZTD_STD_SPACESHIP_COMPARE)

#if ZTD_IS_ON(ZTD_STD_SPACESHIP_COMPARE) && ZTD_IS_ON(ZTD_STD_LIBRARY_SPACESHIP_COMPARE)
namespace __idk_detail {
template <typename Left, typename Right = Left>
concept __strong_spaceshippable = requires(Left& left, Right& right) {
{ left <=> right } -> ::ztd::same<::std::strong_ordering, ::std::strong_ordering>;
{ left <=> right } -> ::ztd::same<::std::strong_ordering>;
};

template <typename Left, typename Right = Left>
concept __weak_spaceshippable = requires(Left& left, Right& right) {
{ left <=> right } -> ::std::weak_ordering;
{ left <=> right } -> ::ztd::same<::std::weak_ordering>;
};

template <typename Left, typename Right = Left>
Expand Down

0 comments on commit 5413729

Please sign in to comment.