[#BloombergLP-bslfmt-PadUtil-computePadding]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslfmt.adoc[bslfmt]::xref:BloombergLP/bslfmt/PadUtil.adoc[PadUtil]::computePadding
:relfileprefix: ../../../
:mrdocs:

Compute the left and right padding values needed to format content with the specified `contentWidth` within a field of the width specified by `widthValue` using the specified `alignment`&period; If `Enums&colon;&colon;e&lowbar;ALIGN&lowbar;DEFAULT` is passed to `alignment`, use the specified `defaultAlign` instead&period; Load the computed padding values into the specified `leftPadding` and `rightPadding`&period; If the category of `widthValue` is not `e&lowbar;VALUE` or if the value indicated by `widthValue` is less than `contentWidth`, the padding is zero&period; The behavior is undefined if `contentWidth` specifies a negative width, or if `defaultAlign` specifies `e&lowbar;ALIGN&lowbar;DEFAULT`&period;

== Synopsis

Declared in `&lt;bslfmt&lowbar;padutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void
computePadding(
    std::ptrdiff&lowbar;t* leftPadding,
    std::ptrdiff&lowbar;t* rightPadding,
    xref:BloombergLP/bslfmt/PadUtil/NumericValue.adoc[NumericValue] const& widthValue,
    std::ptrdiff&lowbar;t contentWidth,
    xref:BloombergLP/bslfmt/PadUtil/Alignment.adoc[Alignment] alignment,
    xref:BloombergLP/bslfmt/PadUtil/Alignment.adoc[Alignment] defaultAlign = Enums&colon;&colon;e&lowbar;ALIGN&lowbar;LEFT);
----


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