Skip to content

Commit f892e30

Browse files
committed
add leb128
1 parent d893b34 commit f892e30

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/layout/core/types/leb128.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import 'package:blockchain_utils/layout/core/core.dart';
55
///
66
/// LEB128 is a variable-length encoding method that is efficient for representing small numbers compactly.
77
/// This layout is used in serialization frameworks like BCS (Binary Canonical Serialization).
8-
class LEB128DIntLayout extends Layout<int> {
8+
class LEB128IntLayout extends Layout<int> {
99
/// Constructor for [LEB128IntLayout].
1010
///
1111
/// [layout] is the underlying integer layout used for validation.
1212
/// [property] is an optional key associated with this layout for structured data handling.
13-
LEB128DIntLayout(this.layout, {String? property})
13+
LEB128IntLayout(this.layout, {String? property})
1414
: super(-1, property: property);
1515

1616
/// The integer layout used to validate values before encoding.
@@ -97,7 +97,7 @@ class LEB128DIntLayout extends Layout<int> {
9797
///
9898
/// Useful when reusing the layout structure with different property associations.
9999
@override
100-
LEB128DIntLayout clone({String? newProperty}) {
101-
return LEB128DIntLayout(layout, property: newProperty);
100+
LEB128IntLayout clone({String? newProperty}) {
101+
return LEB128IntLayout(layout, property: newProperty);
102102
}
103103
}

lib/layout/core/types/leb128_offset.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class LEB128U32OffsetLayout extends ExternalOffsetLayout {
1414
LEB128U32OffsetLayout({super.property});
1515

1616
/// Internal layout used for encoding and decoding LEB128 integers.
17-
final LEB128DIntLayout layout = LEB128DIntLayout(LayoutConst.u32());
17+
final LEB128IntLayout layout = LEB128IntLayout(LayoutConst.u32());
1818

1919
/// Indicates that this layout represents a count (such as the length of a vector).
2020
@override
@@ -43,7 +43,7 @@ class LEB128U32OffsetLayout extends ExternalOffsetLayout {
4343
/// Returns the number of bytes written after encoding.
4444
@override
4545
int encode(int source, LayoutByteWriter writer, {int offset = 0}) {
46-
final encodeLength = LEB128DIntLayout.writeVarint(source);
46+
final encodeLength = LEB128IntLayout.writeVarint(source);
4747
writer.setAll(offset, encodeLength);
4848
return encodeLength.length;
4949
}

0 commit comments

Comments
 (0)