8377995: ZGC: Fix implicit narrowing conversion in zBitField

Reviewed-by: stefank, aboldtch
This commit is contained in:
Leo Korinth 2026-03-09 15:57:33 +00:00
parent a278ad8fff
commit 0d2f7f6216

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2026, 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
@ -74,7 +74,7 @@ public:
static ContainerType encode(ValueType value) {
assert(((ContainerType)value & (FieldMask << ValueShift)) == (ContainerType)value, "Invalid value");
return ((ContainerType)value >> ValueShift) << FieldShift;
return checked_cast<ContainerType>(((ContainerType)value >> ValueShift) << FieldShift);
}
};