In the review of JDK-8253555 it was suggested that it would be good to extend ByteSize and WordSize with the following:
---
Consider adding
constexpr ByteSize in_ByteSize(WordSize size) { ... }
constexpr int in_bytes(WordSize size) { ... }
Also consider adding the identity conversion
constexpr ByteSize in_ByteSize(ByteSize size) { return size; }
which might be useful in generic code?
---
---
It would be nice to have a more complete set of operations for ByteSize.
That way, when writing new code, one doesn't need to remember or look up
whether the operation you want to use is supported.
ByteSize operator*(int, ByteSize) -- so multiplicative scaling is commutative
ByteSize operator/(ByteSize, int) -- division scaling ?
-- op= variants
ByteSize& operator+=(ByteSize& x, ByteSize y)
ByteSize& operator-=(ByteSize& x, ByteSize y)
ByteSize& operator*=(ByteSize& x, int y)
ByteSize& operator/=(ByteSize& x, int y)
---