ispow2
Checks if the input is a power of two.
Read time 3 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: Unity.Mathematics
- Assembly: UnityEngine.MathematicsModule
ispow2(int)
Checks if the input is a power of two.
public static bool ispow2(int x)
Parameters
Integer input.
Returns
Type | Description |
|---|---|
| bool | bool 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 |
|---|---|
| bool2 | bool2 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 |
|---|---|
| bool3 | bool3 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 |
|---|---|
| bool4 | bool4 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 |
|---|---|
| bool | bool 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 |
|---|---|
| bool2 | bool2 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 |
|---|---|
| bool3 | bool3 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 |
|---|---|
| bool4 | bool4 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.