Basic
packtype.utils.basic
clog2(x)
Calculate the ceiling of the base-2 logarithm of x.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
int
|
The integer to calculate the logarithm of |
required |
Returns:
Type | Description |
---|---|
int
|
The ceiling of the base-2 logarithm of x |
get_doc(ptype)
Get the docstring of a Packtype definition
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ptype
|
type[Base] | Base
|
The Packtype definition to inspect |
required |
Returns:
Type | Description |
---|---|
str
|
The docstring of the Packtype definition |
get_name(ptype)
Get the name of a Packtype definition
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ptype
|
type[Base] | Base
|
The Packtype definition to inspect |
required |
Returns:
Type | Description |
---|---|
str
|
The name of the Packtype definition |
get_source(ptype)
Get the name of a Packtype definition
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ptype
|
type[Base] | Base
|
The Packtype definition to inspect |
required |
Returns:
Type | Description |
---|---|
tuple[str, int]
|
The source file and line number of the Packtype definition |
get_width(ptype)
Get the width of a Packtype definition
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ptype
|
type[PackedAssembly | Enum | NumericPrimitive | Union] | PackedAssembly | NumericPrimitive | Union
|
The Packtype definition to inspect |
required |
Returns:
Type | Description |
---|---|
int
|
The width in bits of the Packtype definition |
is_signed(ptype)
Check if a Packtype definition is signed
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ptype
|
type[NumericPrimitive] | NumericPrimitive
|
The Packtype definition to check |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the definition is signed, False otherwise |