func (b *FixedSizeRingBuf) LegalPos() (a0, aLast, b0, bLast int) {
	a0 = -1
	aLast = -1
	b0 = -1
	bLast = -1
	if b.Readable == 0 {
		return
	}
	a0 = b.Beg
	last := b.Beg + b.Readable - 1
	if last < b.N {
		aLast = last
		return
	}
	aLast = b.N - 1
	b0 = 0
	bLast = last % b.N
	return
}
func (b *FixedSizeRingBuf) LegalPos() (a0, aLast, b0, bLast int) {
	a0 = -1
	aLast = -1
	b0 = -1
	bLast = -1
	if b.Readable == 0 {
		return
	}
	a0 = b.Beg
	last := b.Beg + b.Readable - 1
	if last < b.N {
		aLast = last
		return
	}
	aLast = b.N - 1
	b0 = 0
	bLast = last % b.N
	return
}
func ( b * FixedSizeRingBuf ) LegalPos ( ) ( a0 , aLast , b0 , bLast int ) { a0 = - 1 aLast = - 1 b0 = - 1 bLast = - 1 if b . Readable == 0 { return } a0 = b . Beg last := b . Beg + b . Readable - 1 if last < b . N { aLast = last return } aLast = b . N - 1 b0 = 0 bLast = last % b . N return }
// LegalPos returns the legal index positions,
// [a0,aLast] and [b0,bLast] inclusive, where the
// [a0,aLast] holds the first FIFO ordered segment,
// and the [b0,bLast] holds the second ordered segment,
// if any.
// A position of -1 means the segment is not used,
// perhaps because b.Readable is zero, or because
// the second segment [b0,bLast] is not in use (when
// everything fits in the first [a0,aLast] segment).
//
LegalPos returns the legal index positions [ a0 aLast ] and [ b0 bLast ] inclusive where the [ a0 aLast ] holds the first FIFO ordered segment and the [ b0 bLast ] holds the second ordered segment if any . A position of - 1 means the segment is not used perhaps because b . Readable is zero or because the second segment [ b0 bLast ] is not in use ( when everything fits in the first [ a0 aLast ] segment ) .