MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / CalculateSize

Method CalculateSize

include/Eigen/Eigen/src/ThreadPool/RunQueue.h:219–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217 }
218
219 EIGEN_ALWAYS_INLINE
220 unsigned CalculateSize(unsigned front, unsigned back) const {
221 int size = (front & kMask2) - (back & kMask2);
222 // Fix overflow.
223 if (size < 0) size += 2 * kSize;
224 // Order of modification in push/pop is crafted to make the queue look
225 // larger than it is during concurrent modifications. E.g. push can
226 // increment size before the corresponding pop has decremented it.
227 // So the computed size can be up to kSize + 1, fix it.
228 if (size > static_cast<int>(kSize)) size = kSize;
229 return static_cast<unsigned>(size);
230 }
231
232 RunQueue(const RunQueue&) = delete;
233 void operator=(const RunQueue&) = delete;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected