{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method Align | Collections | 2.3.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Align

    Align(int, int)

    Returns an allocation size in bytes that factors in alignment.

    Declaration
    public static int Align(int size, int alignmentPowerOfTwo)
    Parameters
    Type Name Description
    int size

    The size to align.

    int alignmentPowerOfTwo

    A non-zero, positive power of two.

    Returns
    Type Description
    int

    The smallest integer that is greater than or equal to size and is a multiple of alignmentPowerOfTwo.

    Examples
      // 55 aligned to 16 is 64.
                 int size = CollectionHelper.Align(55, 16);
    
    Exceptions
    Type Condition
    ArgumentException

    Thrown if alignmentPowerOfTwo is not a non-zero, positive power of two.

    Align(ulong, ulong)

    Returns an allocation size in bytes that factors in alignment.

    Declaration
    public static ulong Align(ulong size, ulong alignmentPowerOfTwo)
    Parameters
    Type Name Description
    ulong size

    The size to align.

    ulong alignmentPowerOfTwo

    A non-zero, positive power of two.

    Returns
    Type Description
    ulong

    The smallest integer that is greater than or equal to size and is a multiple of alignmentPowerOfTwo.

    Examples
      // 55 aligned to 16 is 64.
                 ulong size = CollectionHelper.Align(55, 16);
    
    Exceptions
    Type Condition
    ArgumentException

    Thrown if alignmentPowerOfTwo is not a non-zero, positive power of two.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)