4.1. Byteorder and Architecture#
4.1.1. Byteorder#
- class caterpillar.byteorder.ByteOrder(name: str, ch: str, alignment: Alignment = Alignment.NONE, size: Size = Size.STANDARD)[source]#
Represents byte order information, including alignment and size.
- Parameters:
name – A string representing the name of the byte order.
ch – A string representing the character used to specify the byte order in struct format strings.
alignment – An enumeration representing the alignment (default is Alignment.NONE).
size – An enumeration representing the size (default is Size.STANDARD).
- caterpillar.byteorder.byteorder(obj, default: ByteOrder | None = None) ByteOrder[source]#
Get the byte order of an object, defaulting to SysNative if not explicitly set.
- Parameters:
obj – The object to retrieve the byte order from.
- Returns:
The byte order of the object.
4.1.1.1. Standard Byteorder Instances#
- byteorder.Native = ByteOrder(name='Native', ch='=', alignment=<Alignment.NONE: 0>, size=<Size.STANDARD: 0>)#
- byteorder.BigEndian = ByteOrder(name='Big Endian', ch='>', alignment=<Alignment.NONE: 0>, size=<Size.STANDARD: 0>)#
- byteorder.LittleEndian = ByteOrder(name='Little Endian', ch='<', alignment=<Alignment.NONE: 0>, size=<Size.STANDARD: 0>)#
- byteorder.NetEndian = ByteOrder(name='Network', ch='!', alignment=<Alignment.NONE: 0>, size=<Size.STANDARD: 0>)#
- byteorder.SysNative = ByteOrder(name='SysNative', ch='@', alignment=<Alignment.NATIVE: 1>, size=<Size.NATIVE: 1>)#
4.1.2. Architecture#
- class caterpillar.byteorder.Arch(name: str, ptr_size: int)[source]#
Represents a system architecture with a name and an indication of whether it is 64-bit.
- Parameters:
name – The name of the architecture.
ptr_size – the amount of bits one pointer takes
4.1.2.1. Standard Architectures#
- byteorder.x86 = Arch(name='x86', ptr_size=32)#
- byteorder.x86_64 = Arch(name='x86-64', ptr_size=64)#
- byteorder.ARM = Arch(name='ARM', ptr_size=32)#
- byteorder.ARM64 = Arch(name='ARM64', ptr_size=64)#
- byteorder.AARCH64 = Arch(name='ARM64', ptr_size=64)#
- byteorder.PowerPC = Arch(name='PowerPC', ptr_size=32)#
- byteorder.PowerPC64 = Arch(name='PowerPC64', ptr_size=64)#
- byteorder.MIPS = Arch(name='MIPS', ptr_size=32)#
- byteorder.MIPS64 = Arch(name='MIPS64', ptr_size=64)#
- byteorder.SPARC = Arch(name='SPARC', ptr_size=32)#
- byteorder.SPARC64 = Arch(name='SPARC64', ptr_size=64)#
- byteorder.RISC_V64 = Arch(name='RISK-V64', ptr_size=64)#
- byteorder.RISC_V = Arch(name='RISK-V', ptr_size=32)#
- byteorder.AMD = Arch(name='AMD', ptr_size=32)#
- byteorder.AMD64 = Arch(name='AMD64', ptr_size=64)#