Skip to content

Commit

Permalink
8292903: enhance round_up_power_of_2 assertion output
Browse files Browse the repository at this point in the history
Backport-of: 8d3d4397ccbfadab99fe572f0d0a8504d268a0dc
  • Loading branch information
MBaesken committed Sep 22, 2022
1 parent 690ac70 commit bdabf8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hotspot/share/utilities/powerOfTwo.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -103,7 +103,8 @@ inline T round_down_power_of_2(T value) {
template<typename T, ENABLE_IF(std::is_integral<T>::value)>
inline T round_up_power_of_2(T value) {
assert(value > 0, "Invalid value");
assert(value <= max_power_of_2<T>(), "Overflow");
assert(value <= max_power_of_2<T>(), "Overflowing maximum allowed power of two with " UINT64_FORMAT_X,
static_cast<uint64_t>(value));
if (is_power_of_2(value)) {
return value;
}
Expand Down

1 comment on commit bdabf8e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.