Add comments on File.{first,end}PieceIndex

This commit is contained in:
Matt Joiner 2019-11-26 16:22:41 +11:00
parent e08da0e6e0
commit d26b93cff4
1 changed files with 2 additions and 0 deletions

View File

@ -169,6 +169,7 @@ func (f *File) Priority() piecePriority {
return f.prio return f.prio
} }
// Returns the index of the first piece containing data for the file.
func (f *File) firstPieceIndex() pieceIndex { func (f *File) firstPieceIndex() pieceIndex {
if f.t.usualPieceSize() == 0 { if f.t.usualPieceSize() == 0 {
return 0 return 0
@ -176,6 +177,7 @@ func (f *File) firstPieceIndex() pieceIndex {
return pieceIndex(f.offset / int64(f.t.usualPieceSize())) return pieceIndex(f.offset / int64(f.t.usualPieceSize()))
} }
// Returns the index of the piece after the last one containing data for the file.
func (f *File) endPieceIndex() pieceIndex { func (f *File) endPieceIndex() pieceIndex {
if f.t.usualPieceSize() == 0 { if f.t.usualPieceSize() == 0 {
return 0 return 0