useful python things
Project description
useful python things
add class
class _type_sign(Enum):
SIGN=1
UNSIGN=2
env
from pyeco import *
from pyeco import _type_sign
function: dec2hex(_dec,_nbits)
_dec -> input decimal:
8 bits[-128,127],
16 bits[-32768,32767],
32 bits[-2147483648,2147483647]
_nbits -> _dec's number bits: 8,16,32
output -> dec to hex format
example:
print(dec2hex(-127,8))
function: hex2dec(_hex,_nbits,_s)
_hex -> input hex:
_nbits -> _dec's number bits: 8,16,32
_s -> _type_sign.UNSIGN/_type_sign.SIGN output decimal
output -> hex to decimal format
example:
print(hex2dec(0x81010181,32,_type_sign.UNSIGN))
function: dec2bin(_dec,_nbits)
_dec -> input decimal
_nbits -> _dec's number bits: 8,16,32
output -> dec to binary format
example:
print(dec2bin(-128,16))
function: bin2dec(_bin,_nbits,_s)
_bin -> input binary:
_nbits -> _dec's number bits: 8,16,32
_s -> _type_sign.UNSIGN/_type_sign.SIGN output decimal
output -> bin to decimal format
example:
print(bin2dec("11111111111111111111111110000000",32,_type_sign.UNSIGN))
function: hex2bin(_hex,_nbits)
_hex -> input hex:
_nbits -> _dec's number bits: 8,16,32
output -> hex to binary format
example:
print(hex2bin(0x81010181,32))
function: bin2hex(_bin,_nbits)
_bin -> input hex:
_nbits -> _dec's number bits: 8,16,32
output -> binary to hex format
example:
print(bin2hex("1100000000000011",16))
env
from pyeco import *
from pyeco import _adr_size
bindiff(_file1,_file2,_nbits,_size,_flag,_base_adr)
_file1 - first file,
_file2 - second file,
_nbits - word's number bits: 8,16,32,
_size - how much words to compare
_flag - screen adress by _nbits words or bytes
_base_adr - base adress, need for real dats location
output -> binary difference between _file1 and _file2
example:
bindiff("e:/spil.bin","e:/u-boot.bin",32,int(0xce0/4),_adr_size.BYTE,0xe6300000)
env
from pyeco import *
function: max_array(in_array)
in_array - входной массив
output -> вычисляет MAX значение числа из массива in_array и выводит на консоль
example:
import numpy as np
in_array = np.array([-176,3,148,-10,36,238,-76])
max_array(in_array)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyeco-0.5.tar.gz
(3.3 kB
view hashes)
Built Distribution
pyeco-0.5-py3-none-any.whl
(4.3 kB
view hashes)