tilelink2: stricter TransferSizes requirements
This commit is contained in:
parent
56170c605c
commit
314d6ebd6f
@ -26,7 +26,7 @@ class TLFragmenter(minSize: Int, maxSize: Int, alwaysMin: Boolean = false) exten
|
|||||||
}
|
}
|
||||||
def shrinkTransfer(x: TransferSizes) =
|
def shrinkTransfer(x: TransferSizes) =
|
||||||
if (!alwaysMin) x else
|
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
|
TransferSizes.none
|
||||||
def mapManager(m: TLManagerParameters) = m.copy(
|
def mapManager(m: TLManagerParameters) = m.copy(
|
||||||
supportsAcquire = TransferSizes.none, // this adapter breaks acquires
|
supportsAcquire = TransferSizes.none, // this adapter breaks acquires
|
||||||
|
@ -50,6 +50,7 @@ case class TransferSizes(min: Int, max: Int)
|
|||||||
require (min >= 0 && max >= 0)
|
require (min >= 0 && max >= 0)
|
||||||
require (max == 0 || isPow2(max))
|
require (max == 0 || isPow2(max))
|
||||||
require (min == 0 || isPow2(min))
|
require (min == 0 || isPow2(min))
|
||||||
|
require (max == 0 || min != 0) // 0 is forbidden unless (0,0)
|
||||||
|
|
||||||
def none = min == 0
|
def none = min == 0
|
||||||
def contains(x: Int) = isPow2(x) && min <= x && x <= max
|
def contains(x: Int) = isPow2(x) && min <= x && x <= max
|
||||||
|
Loading…
Reference in New Issue
Block a user