Skip to content

Commit

Permalink
xmr: serialization slimming
Browse files Browse the repository at this point in the history
- base types reduced, not needed for now
- some int serialization methods not used now
  • Loading branch information
ph4r05 committed Oct 2, 2018
1 parent fb515aa commit e5f5b5b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
18 changes: 1 addition & 17 deletions src/apps/monero/xmr/serialize/base_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class XmrType:
VERSION = 0
pass


class UVarintType(XmrType):
Expand All @@ -12,21 +12,5 @@ class IntType(XmrType):
VARIABLE = 0


class BoolType(IntType):
WIDTH = 1


class UInt8(IntType):
WIDTH = 1


class UInt32(IntType):
WIDTH = 4


class UInt64(IntType):
WIDTH = 8


class SizeT(UInt64):
WIDTH = 8
18 changes: 0 additions & 18 deletions src/apps/monero/xmr/serialize/int_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,6 @@ def dump_uvarint_b_into(n, buffer, offset=0):
return buffer


def load_uint_b(buffer, width):
"""
Loads fixed size integer from the buffer
"""
result = 0
for idx in range(width):
result += buffer[idx] << (8 * idx)
return result


def dump_uint_b(n, width):
"""
Serializes fixed size integer to the buffer
"""
buffer = bytearray(width)
return dump_uvarint_b_into(n, buffer, 0)


def dump_uint_b_into(n, width, buffer, offset=0):
"""
Serializes fixed size integer to the buffer
Expand Down

0 comments on commit e5f5b5b

Please sign in to comment.