[#BloombergLP-bsls-AlignmentUtil-calculateAlignmentOffset]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::xref:BloombergLP/bsls/AlignmentUtil.adoc[AlignmentUtil]::calculateAlignmentOffset
:relfileprefix: ../../../
:mrdocs:

Return the offset needed to align the specified address&period;

== Synopsis

Declared in `&lt;bsls&lowbar;alignmentutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
calculateAlignmentOffset(
    void const* address,
    int alignment);
----

== Description

Return the minimum non&hyphen;negative integer that, when added to the numerical value of the specified `address`, yields the specified `alignment`&period; The behavior is undefined unless `alignment` is a positive, integral power of 2&period;

== Return Value

minimum non&hyphen;negative offset in bytes

== Parameters

[cols="1,4"]
|===
| Name| Description
| *address*
| memory address from which the offset is measured
| *alignment*
| alignment boundary, a positive power of 2
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
