BloombergLP::bsls::Alignment::calculateAlignmentOffset

Return the byte offset needed to align the specified address.

Synopsis

Declared in <bsls_alignment.h>

static
int
calculateAlignmentOffset(
    void const* address,
    int alignment);

Description

Return the smallest non-negative offset in bytes that, when added to the specified address, yields the specified alignment. The behavior is undefined unless 0 < alignment and alignment is a power of 2.

DEPRECATED: Use AlignmentUtil::calculateAlignmentOffset instead.

Return Value

smallest non-negative offset in bytes

Parameters

NameDescription
addressmemory address to align
alignmentrequired alignment; must be a power of 2