RFR: 8299213: Bad cast in GrowableArrayWithAllocator<>::grow

Kim Barrett kbarrett at openjdk.org
Mon Jan 16 18:00:14 UTC 2023


On Mon, 16 Jan 2023 09:51:01 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> ```
> // precondition: if signed, value >= 0.
> // precondition: value < maximum power of two representable by T.
> template <typename T, ENABLE_IF(std::is_integral<T>::value)>
> inline T next_power_of_2(T value)  {
> ```
> 
> So this should require an assert that `j >= 0`.

`next_power_of_2` already has that as a precondition that the argument is >= 0 if signed.  And it's (indirectly) asserted.

-------------

PR: https://git.openjdk.org/jdk/pull/12007


More information about the hotspot-dev mailing list