Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions transform/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,15 @@ func PackBigInt32(n int) string {

return packed.String()
}

// PackBigInt64 packs a big-endian 64-bit integer as a string.
func PackBigInt64(n int) string {
var packed strings.Builder

err := binary.Write(&packed, binary.BigEndian, int64(n))
if err != nil {
output.PrintFrameworkError(err.Error())
}

return packed.String()
}
10 changes: 10 additions & 0 deletions transform/encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ func TestPackBigInt32(t *testing.T) {
t.Log(packed)
}

func TestPackBigInt64(t *testing.T) {
packed := PackBigInt64(0x4142434445464748)

if packed != "ABCDEFGH" {
t.Fatal(packed)
}

t.Log(packed)
}

func TestInflate(t *testing.T) {
compressed := "\x1f\x8b\x08\x08\xf4\xe9\x97\x66\x00\x03\x77\x61\x74\x00\x2b\x2b\xcd\xc9\x4b\xce\x48\x4d\xce\xe6\x02\x00\x3d\xf1\xb3\xf9\x0a\x00\x00\x00"
inflated, ok := Inflate([]byte(compressed))
Expand Down
Loading