MCPcopy Create free account
hub / github.com/dblalock/bolt / aligned_length

Function aligned_length

cpp/src/utils/memory.hpp:24–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23template<class T, int AlignBytes, class IntT>
24inline constexpr IntT aligned_length(IntT ncols) {
25 static_assert(AlignBytes >= 0, "AlignBytes must be nonnegative");
26 assert(ncols > 0);
27 if (AlignBytes == 0) { return ncols; }
28
29 int16_t align_elements = AlignBytes / sizeof(T);
30 int16_t remaindr = ncols % align_elements;
31 if (remaindr > 0) {
32 ncols += align_elements - remaindr;
33 }
34 return ncols;
35}
36
37// helper struct to get Eigen::Map<> MapOptions based on alignment in bytes
38template<int AlignBytes> struct _AlignHelper {};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected