[#BloombergLP-bsls-AlignmentUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::AlignmentUtil :relfileprefix: ../../ :mrdocs: This `struct` provides a namespace for a suite of compile‐time constants, types, and pure procedures that provide platform‐dependent alignment information. == Synopsis Declared in `<bsls_alignmentutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct AlignmentUtil; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/AlignmentUtil/MaxAlignedType.adoc[`MaxAlignedType`] | Alias for a primitive type that has the most stringent alignment requirement. |=== == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/AlignmentUtil/_04enum.adoc[`Unnamed enum`] | Maximum alignment supported on the current platform. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/AlignmentUtil/calculateAlignmentFromSize.adoc[`calculateAlignmentFromSize`] | Return the natural alignment for a memory block of the specified size. | xref:BloombergLP/bsls/AlignmentUtil/calculateAlignmentOffset.adoc[`calculateAlignmentOffset`] | Return the offset needed to align the specified address. | xref:BloombergLP/bsls/AlignmentUtil/defaultAlignmentOfAlignedStorage.adoc[`defaultAlignmentOfAlignedStorage`] | Return the default `std::aligned_storage` alignment for `t_SIZE`. | xref:BloombergLP/bsls/AlignmentUtil/is2ByteAligned.adoc[`is2ByteAligned`] | Return `true` if the specified `address` is aligned on a 2‐byte boundary (i.e., the numerical value of `address` is evenly divisible by 2), and `false` otherwise. | xref:BloombergLP/bsls/AlignmentUtil/is4ByteAligned.adoc[`is4ByteAligned`] | Return whether the specified `address` is aligned on a 4‐byte boundary. | xref:BloombergLP/bsls/AlignmentUtil/is8ByteAligned.adoc[`is8ByteAligned`] | Return `true` if the specified `address` is aligned on an 8‐byte boundary (i.e., the numerical value of `address` is evenly divisible by 8), and `false` otherwise. | xref:BloombergLP/bsls/AlignmentUtil/isAligned.adoc[`isAligned`] | Return whether the specified address is aligned to the given boundary. | xref:BloombergLP/bsls/AlignmentUtil/pointerAlignment.adoc[`pointerAlignment`] | Return the alignment of the specified `address`. Returns 0 if `address` is 0. Note that the returned value might be larger than `BSLS_MAX_ALIGNMENT`. | xref:BloombergLP/bsls/AlignmentUtil/roundUpToMaximalAlignment.adoc[`roundUpToMaximalAlignment`] | Return the specified size rounded up to the maximum alignment. |=== == Friends [cols="1,4"] |=== | Name| Description | `BloombergLP::bsls::AlignmentUtil::MaxAlignedUnion` | |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#