Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 } | |
| OLD | NEW |