Skip to content

Commit

Permalink
compute size is better
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Oct 13, 2019
1 parent 9f4976a commit b4f8d23
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/itsy/detail/small_bit_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@

namespace ITSY_BITSY_DETAIL_NAMESPACE
{
template<typename _Type, typename _Allocator = ::std::allocator<_Type>>
inline constexpr ::std::size_t __default_small_buffer_size_v =
template<typename _Type, typename _Allocator>
inline constexpr ::std::size_t __compute_small_buffer_size_v =
(sizeof(_Type*) + sizeof(typename ::std::allocator_traits<
::std::remove_reference_t<__unwrap_t<_Allocator>>>::size_type)) /
sizeof(_Type);

template<typename _Type, typename _Allocator = ::std::allocator<_Type>>
inline constexpr ::std::size_t __default_small_buffer_size_v =
__compute_small_buffer_size_v<_Type, _Allocator> < 1
? 1
: __compute_small_buffer_size_v<_Type, _Allocator>;

template<typename _Type,
::std::size_t _InlineWords =
__default_small_buffer_size_v<_Type, ::std::allocator<_Type>>,
Expand Down

0 comments on commit b4f8d23

Please sign in to comment.