|
|
|
setNibbles(hiNibble,
loNibble)
Returns byte with value set according to hi and lo bits
Asserts hiNibble and loNibble in range(16)
>>> setNibbles(8, 14)
142 |
source code
|
|
|
readBew(value)
Reads string as big endian word, (asserts len(value) in [1,2,4])
>>> readBew('aáâã')
1642193635L
>>> readBew('aá')
25057 |
source code
|
|
|
writeBew(value,
length)
Write int as big endian formatted string, (asserts length in [1,2,4])
Difficult to print the result in doctest, so I do a simple roundabout test.
>>> readBew(writeBew(25057, 2))
25057
>>> readBew(writeBew(1642193635L, 4))
1642193635L |
source code
|
|
|
readVar(value)
Converts varlength format to integer. Just pass it 0 or more chars that
might be a varlen and it will only use the relevant chars.
use varLen(readVar(value)) to see how many bytes the integer value takes.
asserts len(value) >= 0
>>> readVar('@')
64
>>> readVar('áâãa')
205042145 |
source code
|
|
|
varLen(value)
Returns the the number of bytes an integer will be when
converted to varlength |
source code
|
|
|
writeVar(value)
Converts an integer to varlength format |
source code
|
|
|
to_n_bits(value,
length=1,
nbits=7)
returns the integer value as a sequence of nbits bytes |
source code
|
|
|
toBytes(value)
Turns a string into a list of byte values |
source code
|
|
|
fromBytes(value)
Turns a list of bytes into a string |
source code
|
|