Skip to content

Commit

Permalink
Doc: Add doc for align size
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling authored Nov 28, 2024
1 parent 32d5eb3 commit 91efc4b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/cppcore/Memory/MemUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ namespace cppcore {

#define ALIGN_MASK(value, mask) (((value) + (mask)) & ((~0) & (~(mask))))

/// @brief Will calculate the alignment for the given size
/// @param[in] size he requested size.
/// @return The aligned size.
template<class T>
inline size_t align(size_t n) {
return (n + sizeof(T) - 1) & ~(sizeof(T) - 1);
Expand All @@ -47,13 +50,13 @@ class DLL_CPPCORE_EXPORT MemUtils {
/// @param[inout] buffer The buffer to clear.
static void clearMemory(void *buffer, size_t size);

/// @brief Will return true, if the pointer fits into the alignment.
/// @param[in] ptr The pointer to check.
/// @brief Will return true, if the pointer fits into the alignment.
/// @param[in] ptr The pointer to check.
/// @param[in] align The alignment to check for.
/// @return true if aligned, false if not.
static bool isAligned(const void *ptr, size_t align);

/// @brief Will align the given pointer.
/// @brief Will align the given pointer.
/// @param[in] ptr The pointer to align.
/// @param[in] extra Space for headers / meta information.
/// @param[in] align The alignment to check for.
Expand Down

0 comments on commit 91efc4b

Please sign in to comment.