MCPcopy Create free account
hub / github.com/dengwirda/jigsaw / inc_alloc

Method inc_alloc

src/libcpp/containers/block_array.hpp:114–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 */
113
114 __normal_call void_type inc_alloc (
115 size_type _new_count
116 )
117 {
118 if (_new_count <= alloc()) return ;
119 /*-------------------------- alloc. storage in blocks */
120 size_type _new_alloc = alloc();
121 if (_new_count <= _size)
122 { /* grow allocation as multiples of two */
123 _new_alloc =
124 std::max(_new_alloc * 2, _new_count);
125 }
126 else
127 { /* round to the nearest block boundary */
128 _new_alloc =
129 ((_new_count / _size) + 1) * _size ;
130 }
131 set_alloc(_new_alloc) ;
132 }
133
134 /*
135 --------------------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected