1
0

tilelink2: stricter TransferSizes requirements

This commit is contained in:
Wesley W. Terpstra 2016-09-05 22:10:28 -07:00
parent 56170c605c
commit 314d6ebd6f
2 changed files with 2 additions and 1 deletions

View File

@ -26,7 +26,7 @@ class TLFragmenter(minSize: Int, maxSize: Int, alwaysMin: Boolean = false) exten
}
def shrinkTransfer(x: TransferSizes) =
if (!alwaysMin) x else
if (x.min <= minSize) TransferSizes(x.min, minSize) else
if (x.min <= minSize) TransferSizes(x.min, min(minSize, x.max)) else
TransferSizes.none
def mapManager(m: TLManagerParameters) = m.copy(
supportsAcquire = TransferSizes.none, // this adapter breaks acquires

View File

@ -50,6 +50,7 @@ case class TransferSizes(min: Int, max: Int)
require (min >= 0 && max >= 0)
require (max == 0 || isPow2(max))
require (min == 0 || isPow2(min))
require (max == 0 || min != 0) // 0 is forbidden unless (0,0)
def none = min == 0
def contains(x: Int) = isPow2(x) && min <= x && x <= max