Skip to content

Commit c8659ac

Browse files
committed
directly write to out, remove temp buffer
1 parent e6a2626 commit c8659ac

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

user_timestamp.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ func appendUserTimestampTrailer(data []byte, userTimestampUs int64) []byte {
2020

2121
// Write timestamp (big-endian) just before the magic bytes.
2222
tsOffset := len(data)
23-
var tsBuf [8]byte
24-
binary.BigEndian.PutUint64(tsBuf[:], uint64(userTimestampUs))
25-
copy(out[tsOffset:tsOffset+8], tsBuf[:])
23+
binary.BigEndian.PutUint64(out[tsOffset:tsOffset+8], uint64(userTimestampUs))
2624

2725
// Append magic bytes.
2826
copy(out[tsOffset+8:], userTimestampMagic)
@@ -53,5 +51,3 @@ func parseUserTimestampTrailer(data []byte) (int64, bool) {
5351
ts := int64(binary.BigEndian.Uint64(data[tsStart : tsStart+8]))
5452
return ts, true
5553
}
56-
57-

0 commit comments

Comments
 (0)