mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8340089: Simplify SegmentBulkOperations::powerOfProperty
Reviewed-by: jpai
This commit is contained in:
parent
bacd046062
commit
0c36177fea
1 changed files with 3 additions and 10 deletions
|
@ -29,7 +29,7 @@ import jdk.internal.misc.ScopedMemoryAccess;
|
|||
import jdk.internal.util.Architecture;
|
||||
import jdk.internal.util.ArraysSupport;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.security.action.GetIntegerAction;
|
||||
|
||||
import java.lang.foreign.MemorySegment;
|
||||
|
||||
|
@ -310,15 +310,8 @@ public final class SegmentBulkOperations {
|
|||
|
||||
// The returned value is in the interval [0, 2^30]
|
||||
static int powerOfPropertyOr(String name, int defaultPower) {
|
||||
final String property = GetPropertyAction.privilegedGetProperty(PROPERTY_PATH + name);
|
||||
if (property != null) {
|
||||
try {
|
||||
return 1 << Math.clamp(Integer.parseInt(property), 0, Integer.SIZE - 2);
|
||||
} catch (NumberFormatException _) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return defaultPower;
|
||||
final int power = GetIntegerAction.privilegedGetProperty(PROPERTY_PATH + name, defaultPower);
|
||||
return 1 << Math.clamp(power, 0, Integer.SIZE - 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue