HEX
Server: LiteSpeed
System: Linux br-asc-web1845.main-hosting.eu 5.14.0-611.42.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 24 05:30:20 EDT 2026 x86_64
User: u790421558 (790421558)
PHP: 8.2.30
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //lib/python3.9/site-packages/elftools/construct/lib/__pycache__/binary.cpython-39.opt-1.pyc
a

�#�_��	@s�ddlmZddd�Zddddddddd�Zddd	�Zddd�ZiZiZed
�D].Z	ee	�Z
ee	d
�Zeee
<eee	<e
ee<qPdd�Zdd�Z
dS)�)�int2byte� cCsV|dkr|d|>7}|d}t|�}|rN|dkrN|d@||<|dL}|d8}q$t|�S)a

    Convert an integer into its binary representation in a bytes object.
    Width is the amount of bits to generate. If width is larger than the actual
    amount of bits required to represent number in binary, sign-extension is
    used. If it's smaller, the representation is trimmed to width bits.
    Each "bit" is either '\x00' or '\x01'. The MSBit is first.

    Examples:

        >>> int_to_bin(19, 5)
        b'\x01\x00\x00\x01\x01'
        >>> int_to_bin(19, 8)
        b'\x00\x00\x00\x01\x00\x00\x01\x01'
    �r)�	bytearray�bytes)�number�width�i�bits�r�A/usr/lib/python3.9/site-packages/elftools/construct/lib/binary.py�
int_to_bins
r
r)rr�0�1���0�1FcCs^d}d}d}|r8t|ddkr8|dd�}dt|�>}|D]}|dK}|t|O}q<||S)z�
    Logical opposite of int_to_bin. Both '0' and '\x00' are considered zero,
    and both '1' and '\x01' are considered one. Set sign to True to interpret
    the number as a 2-s complement signed integer.
    rrN)�_bit_values�len)r
ZsignedrZbiasZptr�brrr�
bin_to_int,sr�cCsbd}t|�}dg||d}t|�d}||krX||||�||<||7}|d8}q*d�|�S)z�
    Bits is a b'' object containing a binary representation. Assuming each
    bytesize bits constitute a bytes, perform a endianness byte swap. Example:

        >>> swap_bytes(b'00011011', 2)
        b'11100100'
    r�r)r�join)r
Zbytesizer	�l�output�jrrr�
swap_bytes>s
r�cCsd�dd�|D��S)z�
    Create a binary representation of the given b'' object. Assume 8-bit
    ASCII. Example:

        >>> encode_bin('ab')
        b""
    rcss|]}t|VqdS)N)�_char_to_bin)�.0�chrrr�	<genexpr>drzencode_bin.<locals>.<genexpr>)r)�datarrr�
encode_bin\sr%cCsnt|�d@rtd��d}d}t|�d}dg|}||krdt|||d�||<|d7}|d7}q2d�|�S)z)
    Locical opposite of decode_bin.
    �z#Data length must be a multiple of 8rrrr)r�
ValueError�_bin_to_charr)r$r	rr�charsrrr�
decode_bings

r*N)r)F)r)Z	py3compatrr
rrrr r(�ranger	r"�binr%r*rrrr�<module>s,
�