@@ -46,9 +46,9 @@ class bigint_storage : private std::allocator_traits<Allocator>:: template rebin
4646 using size_type = typename std::allocator_traits<word_allocator_type>::size_type;
4747 using word_type = typename std::allocator_traits<word_allocator_type>::value_type;
4848 static constexpr word_type max_word = (std::numeric_limits<word_type>::max)();
49+ static constexpr size_type mem_unit = sizeof (word_type);
4950 static constexpr size_type word_type_bits = sizeof (word_type) * 8 ; // Number of bits
5051 static constexpr size_type word_type_half_bits = word_type_bits/2 ;
51- static constexpr uint16_t word_length = 8 ; // Use multiples of word_length words
5252 static constexpr size_type inlined_capacity = 2 ;
5353public:
5454
@@ -277,7 +277,7 @@ class bigint_storage : private std::allocator_traits<Allocator>:: template rebin
277277 // Find suitable new block size
278278 constexpr size_type round_up (size_type i) const noexcept
279279 {
280- return (i / word_length + 1 ) * word_length ;
280+ return ((i + 1 / 3 ) / mem_unit + 1 ) * mem_unit ;
281281 }
282282 };
283283
@@ -779,8 +779,7 @@ class basic_bigint
779779 }
780780 }
781781
782- // auto view = v.get_storage_view();
783-
782+ // auto view = v.get_storage_view();
784783 // if (num_words != view.size())
785784 // {
786785 // std::cout << "Unexpected num_words! num_words: " << num_words << ", " << num_words << ", size: " << view.size() << "\n";
@@ -1950,11 +1949,6 @@ class basic_bigint
19501949 }
19511950 }
19521951
1953- size_type round_up (size_type i) const // Find suitable new block size
1954- {
1955- return (i/word_length + 1 ) * word_length;
1956- }
1957-
19581952 void reduce ()
19591953 {
19601954 storage_.reduce ();
0 commit comments