Skip to content

Commit 60ec2a5

Browse files
committed
8253824: Revert JDK-8253089 since VS warning C4307 has been disabled
Reviewed-by: mdoerr, iklam
1 parent 90c131f commit 60ec2a5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/hotspot/share/runtime/flags/jvmFlagLookup.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#define DO_FLAG(type, name,...) DO_HASH(FLAG_MEMBER_ENUM(name), XSTR(name))
3131

3232
#define DO_HASH(flag_enum, flag_name) { \
33-
u2 hash = hash_code(flag_name); \
33+
unsigned int hash = hash_code(flag_name); \
3434
int bucket_index = (int)(hash % NUM_BUCKETS); \
35-
_hashes[flag_enum] = hash; \
35+
_hashes[flag_enum] = (u2)(hash); \
3636
_table[flag_enum] = _buckets[bucket_index]; \
3737
_buckets[bucket_index] = (short)flag_enum; \
3838
}
@@ -54,10 +54,10 @@ constexpr JVMFlagLookup::JVMFlagLookup() : _buckets(), _table(), _hashes() {
5454
constexpr JVMFlagLookup _flag_lookup_table;
5555

5656
JVMFlag* JVMFlagLookup::find_impl(const char* name, size_t length) const {
57-
u2 hash = hash_code(name, length);
57+
unsigned int hash = hash_code(name, length);
5858
int bucket_index = (int)(hash % NUM_BUCKETS);
5959
for (int flag_enum = _buckets[bucket_index]; flag_enum >= 0; ) {
60-
if (_hashes[flag_enum] == hash) {
60+
if (_hashes[flag_enum] == (u2)hash) {
6161
JVMFlag* flag = JVMFlag::flags + flag_enum;
6262
if (strncmp(name, flag->name(), length) == 0) {
6363
// We know flag->name() has at least <length> bytes.

src/hotspot/share/runtime/flags/jvmFlagLookup.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ class JVMFlagLookup {
5151

5252
// This is executed at build-time only, so it doesn't matter if we walk
5353
// the string twice.
54-
static constexpr u2 hash_code(const char* s) {
54+
static constexpr unsigned int hash_code(const char* s) {
5555
return hash_code(s, string_len(s));
5656
}
5757

58-
static constexpr u2 hash_code(const char* s, size_t len) {
59-
u2 h = 0;
58+
static constexpr unsigned int hash_code(const char* s, size_t len) {
59+
unsigned int h = 0;
6060
while (len -- > 0) {
61-
h = (u2)(31*h + (u2) *s);
61+
h = 31*h + (unsigned int) *s;
6262
s++;
6363
}
6464
return h;

0 commit comments

Comments
 (0)