docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method PowerOf2Ceil

    PowerOf2Ceil(int)

    Rounds a number to the next closest power of 2.

    Declaration
    public static int PowerOf2Ceil(int num)
    Parameters
    Type Name Description
    int num

    Positive number.

    Returns
    Type Description
    int

    The lower power of 2 that is greater than num. Returns 1 if num is not greater than 0.

    PowerOf2Ceil(uint)

    Rounds a number to the next closest power of 2.

    Declaration
    public static uint PowerOf2Ceil(uint num)
    Parameters
    Type Name Description
    uint num

    Positive number.

    Returns
    Type Description
    uint

    The lower power of 2 that is greater than num. Returns 1 if the num is 0.

    In This Article
    Back to top
    Copyright © 2024 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)