An integer type whose size depends on whether the current context is 32 or 64 bits.

Information

Parameterssignednessan element of the Signedness enum indicating whether instances of this type are signed
endiannessan element of the Endianness enum indicating the endianness of instances of this type
size32the size in a 32 bits context
size64the size in a 64 bits context
RaisesValueErrorif one of the passed sizes is negative or null
Method __init__ Undocumented
Method size_bytes The minimal number of bytes necessary to hold an instance of this integer type, depending on the current context.
Method signedness Property: The signedness of this integer type.
Method endianness Property: The endianness of this integer type.
Method is_context_sensitive Whether the context argument needed by some methods actually has an effect.

Inherited from Type (via Integer):

Method parse Parses the value of an instance of this type from a raw buffer, possibly depending on the context.

Inherited from Type (via Integer):

Method parse Parses the value of an instance of this type from a raw buffer, possibly depending on the context.
def __init__(self, signedness, endianness, size32, size64):
Undocumented
def size_bytes(self, context=None):

The minimal number of bytes necessary to hold an instance of this integer type, depending on the current context.

Information

ParameterscontextThe context object. See package documentation.
ReturnsAn integer.
RaisesValueErrorIf called without a context.
@property
def signedness(self):

Property: The signedness of this integer type.

Information

ReturnsA Signedness instance.
@property
def endianness(self):

Property: The endianness of this integer type.

Information

ReturnsAn Endianness instance.
def is_context_sensitive(self):

Whether the context argument needed by some methods actually has an effect.

Types that return False to this method are context-insensitive types. You can safely pass any object as context parameter (including None) to the methods of such type.

Note that the context-sensitivity of a type may change in the future.

Examples

Getting the size of a type without needing a context for context-insensitive types: >>> types.U32.is_context_sensitive() False >>> types.U32.size_bytes(context=None) 4 >>> array32_12 = types.Array(types.U32, 12) >>> array32_12.is_context_sensitive() False >>> array32_12.size_bytes() # context=None by default 48

Context-sensitive types may raise errors when attempting to get the size without a context: >>> types.USize.is_context_sensitive() True >>> types.USize.size_bytes(context=None) ValueError: Please provide a context when using a context-sensitive type

API Documentation for reven2, generated by pydoctor at 2020-09-17 15:57:23.