[#BloombergLP-bdlma-BufferManager-calculateAlignmentOffsetFromSize]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::xref:BloombergLP/bdlma/BufferManager.adoc[BufferManager]::calculateAlignmentOffsetFromSize
:relfileprefix: ../../../
:mrdocs:

Return the alignment offset for `address` for an allocation of `size`&period;

== Synopsis

Declared in `&lt;bdlma&lowbar;buffermanager&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
calculateAlignmentOffsetFromSize(
    void const* address,
    xref:BloombergLP/bsls/Types/size_type.adoc[bsls::Types::size&lowbar;type] size) const;
----

== Description

Return the minimum non&hyphen;negative integer that, when added to the numerical value of the specified `address`, yields the alignment as per the `alignmentStrategy` provided at construction for an allocation of the specified `size`&period; Note that if `0 &equals;&equals; size` and natural alignment was provided at construction, the result of this method is identical to the result for `0 &equals;&equals; size` and maximal alignment&period;

== Return Value

minimum non&hyphen;negative integer that, when added to `address`, yields the required alignment for an allocation of `size`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *address*
| address for which to calculate the alignment offset
| *size*
| allocation size in bytes used to determine alignment
|===


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