o
    ta                     @   s   d dl Z d dlT eeZdd ZG dd deeZe jdkr/dZ	eZ
G d	d
 d
eedZdS e jdkrDdZ	eZG dd deedZ
dS ed)    N)*c                 C   sH   t | tr
t| tS t| trt| j| j S t| t	r| S t
d|  )zReturn the type with the 'other' byte order.  Simple types like
    c_int and so on already have __ctype_be__ and __ctype_le__
    attributes which contain the types, for more complicated types
    arrays and structures are supported.
    z+This type does not support other endian: %s)hasattr_OTHER_ENDIANgetattr
isinstance_array_type_other_endian_type_Z_length_
issubclass	Structure	TypeError)typ r   )/root/Python-3.10.2/Lib/ctypes/_endian.pyr      s   



r   c                       s   e Zd Z fddZ  ZS )_swapped_metac                    s^   |dkr&g }|D ]}|d }|d }|dd  }| |t|f|  q|}t || d S )N_fields_r         )appendr   super__setattr__)selfattrnamevaluefieldsdescnamer   rest	__class__r   r   r      s   z_swapped_meta.__setattr__)__name__
__module____qualname__r   __classcell__r   r   r   r   r      s    r   little__ctype_be__c                   @      e Zd ZdZdZdZdS )BigEndianStructurez$Structure with big endian byte orderr   Nr    r!   r"   __doc__	__slots__Z_swappedbytes_r   r   r   r   r'   .       r'   )	metaclassbig__ctype_le__c                   @   r&   )LittleEndianStructurez'Structure with little endian byte orderr   Nr(   r   r   r   r   r/   7   r+   r/   zInvalid byteorder)sysctypestypeArrayr   r   r   r   	byteorderr   r/   r'   RuntimeErrorr   r   r   r   <module>   s    

