Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ispow2

Checks if the input is a power of two.
Read time 3 minutesLast updated 4 days ago

Definition

ispow2(int)

Checks if the input is a power of two.
public static bool ispow2(int x)

Parameters

Integer input.

Returns

Type

Description

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

Remarks

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

ispow2(int2)

Checks if each component of the input is a power of two.
public static bool2 ispow2(int2 x)

Parameters

int2 input

Returns

Type

Description

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

Remarks

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

ispow2(int3)

Checks if each component of the input is a power of two.
public static bool3 ispow2(int3 x)

Parameters

int3 input

Returns

Type

Description

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

Remarks

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

ispow2(int4)

Checks if each component of the input is a power of two.
public static bool4 ispow2(int4 x)

Parameters

int4 input

Returns

Type

Description

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

Remarks

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

ispow2(uint)

Checks if the input is a power of two.
public static bool ispow2(uint x)

Parameters

Unsigned integer input.

Returns

Type

Description

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

Remarks

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

ispow2(uint2)

Checks if each component of the input is a power of two.
public static bool2 ispow2(uint2 x)

Parameters

uint2 input

Returns

Type

Description

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

Remarks

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

ispow2(uint3)

Checks if each component of the input is a power of two.
public static bool3 ispow2(uint3 x)

Parameters

uint3 input

Returns

Type

Description

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

Remarks

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

ispow2(uint4)

Checks if each component of the input is a power of two.
public static bool4 ispow2(uint4 x)

Parameters

uint4 input

Returns

Type

Description

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

Remarks

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