Skip to content

Commit

Permalink
fix reaching the max alloc size with the custom gc
Browse files Browse the repository at this point in the history
  • Loading branch information
radkomih committed Aug 31, 2023
1 parent 9b6f9f8 commit 89f6338
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fixed_length.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ import (
)

func (value U8) Encode(buffer *bytes.Buffer) {
// do not use value.Bytes() here: https://github.com/LimeChain/goscale/issues/77
encoder := Encoder{Writer: buffer}
encoder.Write(value.Bytes())
encoder.EncodeByte(byte(value))
}

func (value U8) Bytes() []byte {
return []byte{byte(value)}
buf := make([]byte, 1)
buf[0] = byte(value)
return buf
}

func DecodeU8(buffer *bytes.Buffer) U8 {
Expand Down

0 comments on commit 89f6338

Please sign in to comment.