Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

math.ispow2

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static bool ispow2(int x);

Parameters

Parameter Description
x Integer input.

Returns

bool bool where true indicates that input was a power of two.

Description

Checks if the input is a power of two.

If x is less than or equal to zero, then this function returns false.


Declaration

public static bool2 ispow2(int2 x);

Parameters

Parameter Description
x int2 input

Returns

bool2 bool2 where true in a component indicates the same component in the input was a power of two.

Description

Checks if each component of the input is a power of two.

If a component of x is less than or equal to zero, then this function returns false in that component.


Declaration

public static bool3 ispow2(int3 x);

Parameters

Parameter Description
x int3 input

Returns

bool3 bool3 where true in a component indicates the same component in the input was a power of two.

Description

Checks if each component of the input is a power of two.

If a component of x is less than or equal to zero, then this function returns false in that component.


Declaration

public static bool4 ispow2(int4 x);

Parameters

Parameter Description
x int4 input

Returns

bool4 bool4 where true in a component indicates the same component in the input was a power of two.

Description

Checks if each component of the input is a power of two.

If a component of x is less than or equal to zero, then this function returns false in that component.


Declaration

public static bool ispow2(uint x);

Parameters

Parameter Description
x Unsigned integer input.

Returns

bool bool where true indicates that input was a power of two.

Description

Checks if the input is a power of two.

If x is less than or equal to zero, then this function returns false.


Declaration

public static bool2 ispow2(uint2 x);

Parameters

Parameter Description
x uint2 input

Returns

bool2 bool2 where true in a component indicates the same component in the input was a power of two.

Description

Checks if each component of the input is a power of two.

If a component of x is less than or equal to zero, then this function returns false in that component.


Declaration

public static bool3 ispow2(uint3 x);

Parameters

Parameter Description
x uint3 input

Returns

bool3 bool3 where true in a component indicates the same component in the input was a power of two.

Description

Checks if each component of the input is a power of two.

If a component of x is less than or equal to zero, then this function returns false in that component.


Declaration

public static bool4 ispow2(uint4 x);

Parameters

Parameter Description
x uint4 input

Returns

bool4 bool4 where true in a component indicates the same component in the input was a power of two.

Description

Checks if each component of the input is a power of two.

If a component of x is less than or equal to zero, then this function returns false in that component.