MCPcopy Create free account
hub / github.com/catboost/catboost / Align

Method Align

util/stream/aligned.h:80–89  ·  view source on GitHub ↗

* Ensures alignment of the position in the output stream by writing * some data. * * @param alignment Alignment. Must be a power of 2. */

Source from the content-addressed store, hash-verified

78 * @param alignment Alignment. Must be a power of 2.
79 */
80 void Align(size_t alignment = sizeof(void*)) {
81 Y_ASSERT(IsPowerOf2(alignment));
82
83 static char unused[sizeof(void*) * 2];
84 Y_ASSERT(alignment <= sizeof(unused));
85
86 if (Position_ & (alignment - 1)) {
87 DoWrite(unused, alignment - (Position_ & (alignment - 1)));
88 }
89 }
90
91private:
92 void DoWrite(const void* ptr, size_t len) override;

Callers

nothing calls this directly

Calls 1

IsPowerOf2Function · 0.50

Tested by

no test coverage detected