clarify endianness
This commit is contained in:
parent
ea6a3b293c
commit
9582814c62
|
@ -559,9 +559,7 @@ def xor(bytes_1: Bytes32, bytes_2: Bytes32) -> Bytes32:
|
||||||
```python
|
```python
|
||||||
def int_to_bytes(n: uint64, length: uint64) -> bytes:
|
def int_to_bytes(n: uint64, length: uint64) -> bytes:
|
||||||
"""
|
"""
|
||||||
Return the ``length``-byte serialization of ``n``.
|
Return the ``length``-byte serialization of ``n`` in ``ENDIANNESS``-endian.
|
||||||
``n.to_bytes(length, endianness)`` returns ``n`` in endianness-endian bytes padded out to length bytes.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return n.to_bytes(length, ENDIANNESS)
|
return n.to_bytes(length, ENDIANNESS)
|
||||||
```
|
```
|
||||||
|
@ -571,8 +569,7 @@ def int_to_bytes(n: uint64, length: uint64) -> bytes:
|
||||||
```python
|
```python
|
||||||
def bytes_to_int(data: bytes) -> uint64:
|
def bytes_to_int(data: bytes) -> uint64:
|
||||||
"""
|
"""
|
||||||
Return the integer deserialization of ``data``.
|
Return the integer deserialization of ``data`` intepretted as ``ENDIANNESS``-endian.
|
||||||
``n.to_bytes(data, endianness)`` returns ``data`` as in integer intepretted in endianness-endian.
|
|
||||||
"""
|
"""
|
||||||
return int.from_bytes(data, ENDIANNESS)
|
return int.from_bytes(data, ENDIANNESS)
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue