Skip to content

Commit 1a839f1

Browse files
authored
Merge pull request #3977 from onflow/bastian/refactor-builtin-functions
Refactor string value parsers and big-endian bytes converters to be reusable in compiler/VM
2 parents db18277 + 5afc798 commit 1a839f1

File tree

9 files changed

+319
-177
lines changed

9 files changed

+319
-177
lines changed

interpreter/interpreter.go

Lines changed: 311 additions & 169 deletions
Large diffs are not rendered by default.

interpreter/value_fix64.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func NewUnmeteredFix64Value(integer int64) Fix64Value {
7575
return Fix64Value(integer)
7676
}
7777

78-
func NewFix64ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Fix64Value {
78+
func NewFix64ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Value {
7979
return NewFix64Value(
8080
gauge,
8181
func() int64 {

interpreter/value_int128.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func NewUnmeteredInt128ValueFromBigInt(value *big.Int) Int128Value {
9696
}
9797
}
9898

99-
func NewInt128ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Int128Value {
99+
func NewInt128ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Value {
100100
return NewInt128ValueFromBigInt(
101101
gauge,
102102
func() *big.Int {

interpreter/value_int16.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func NewUnmeteredInt16Value(value int16) Int16Value {
5151
return Int16Value(value)
5252
}
5353

54-
func NewInt16ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Int16Value {
54+
func NewInt16ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Value {
5555
return NewInt16Value(
5656
gauge,
5757
func() int16 {

interpreter/value_int8.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func NewUnmeteredInt8Value(value int8) Int8Value {
5050
return Int8Value(value)
5151
}
5252

53-
func NewInt8ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Int8Value {
53+
func NewInt8ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Value {
5454
return NewInt8Value(
5555
gauge,
5656
func() int8 {

interpreter/value_uint16.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func NewUnmeteredUInt16Value(value uint16) UInt16Value {
5858
return UInt16Value(value)
5959
}
6060

61-
func NewUInt16ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) UInt16Value {
61+
func NewUInt16ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Value {
6262
return NewUInt16Value(
6363
gauge,
6464
func() uint16 {

interpreter/value_uint32.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func NewUnmeteredUInt32Value(value uint32) UInt32Value {
4949
return UInt32Value(value)
5050
}
5151

52-
func NewUInt32ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) UInt32Value {
52+
func NewUInt32ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Value {
5353
return NewUInt32Value(
5454
gauge,
5555
func() uint32 {

interpreter/value_uint8.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func NewUnmeteredUInt8Value(value uint8) UInt8Value {
5858
return UInt8Value(value)
5959
}
6060

61-
func NewUInt8ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) UInt8Value {
61+
func NewUInt8ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Value {
6262
return NewUInt8Value(
6363
gauge,
6464
func() uint8 {

interpreter/value_word8.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func NewUnmeteredWord8Value(value uint8) Word8Value {
5858
return Word8Value(value)
5959
}
6060

61-
func NewWord8ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Word8Value {
61+
func NewWord8ValueFromBigEndianBytes(gauge common.MemoryGauge, b []byte) Value {
6262
return NewWord8Value(
6363
gauge,
6464
func() uint8 {

0 commit comments

Comments
 (0)