Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: common/recordio/size.go

Issue 1904503003: LogDog: Fix archived log stream read errors. (Closed) Base URL: https://github.com/luci/luci-go@hierarchy-check-first
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package recordio
6
7 // FrameHeaderSize calculates the size of the RecordIO frame header for a given
8 // amount of data.
9 //
10 // A RecordIO frame header is a Uvarint containing the length. Uvarint values
11 // contain 7 bits of size data and 1 continuation bit (see encoding/binary).
12 func FrameHeaderSize(s int64) int {
13 size := 1
14 for s >>= 7; s > 0; s >>= 7 {
15 size++
16 }
17 return size
18 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698