2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -197,3 +197,15 @@ func PackBigInt32(n int) string {
197
197
198
198
return packed .String ()
199
199
}
200
+
201
+ // PackBigInt64 packs a big-endian 64-bit integer as a string.
202
+ func PackBigInt64 (n int ) string {
203
+ var packed strings.Builder
204
+
205
+ err := binary .Write (& packed , binary .BigEndian , int64 (n ))
206
+ if err != nil {
207
+ output .PrintFrameworkError (err .Error ())
208
+ }
209
+
210
+ return packed .String ()
211
+ }
Original file line number Diff line number Diff line change @@ -174,6 +174,16 @@ func TestPackBigInt32(t *testing.T) {
174
174
t .Log (packed )
175
175
}
176
176
177
+ func TestPackBigInt64 (t * testing.T ) {
178
+ packed := PackBigInt64 (0x4142434445464748 )
179
+
180
+ if packed != "ABCDEFGH" {
181
+ t .Fatal (packed )
182
+ }
183
+
184
+ t .Log (packed )
185
+ }
186
+
177
187
func TestInflate (t * testing.T ) {
178
188
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 "
179
189
inflated , ok := Inflate ([]byte (compressed ))
0 commit comments