Skip to content

Commit

Permalink
src: fix compiler warning in smalloc.cc
Browse files Browse the repository at this point in the history
Fix the following compiler warning by static_casting the enum values
to an uint32_t:

    ../src/smalloc.cc: In function 'void
    node::smalloc::Initialize(v8::Handle<v8::Object>,
                              v8::Handle<v8::Value>,
                              v8::Handle<v8::Context>)':
    ../src/smalloc.cc:601:203: warning: enumeral and non-enumeral type
    in conditional expression
        EXTERNAL_ARRAY_TYPES(V)

PR-URL: #1055
Reviewed-By: Vladimir Kurchatkin <[email protected]>
  • Loading branch information
bnoordhuis authored and vkurchatkin committed Mar 4, 2015
1 parent 8f5f12b commit fb284e2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/smalloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,13 @@ void Initialize(Handle<Object> exports,

uint32_t kMinType = ~0;
uint32_t kMaxType = 0;
#define V(name, value) \
types->Set(FIXED_ONE_BYTE_STRING(env->isolate(), #name), \
Uint32::NewFromUnsigned(env->isolate(), v8::value)); \
kMinType = MIN(kMinType, v8::value); \
kMaxType = MAX(kMinType, v8::value);

EXTERNAL_ARRAY_TYPES(V)
#undef V
#define V(name, value) \
types->Set(FIXED_ONE_BYTE_STRING(env->isolate(), #name), \
Uint32::NewFromUnsigned(env->isolate(), v8::value)); \
kMinType = MIN(kMinType, static_cast<uint32_t>(v8::value)); \
kMaxType = MAX(kMinType, static_cast<uint32_t>(v8::value));
EXTERNAL_ARRAY_TYPES(V)
#undef V

exports->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "types"), types);
exports->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kMinType"),
Expand Down

0 comments on commit fb284e2

Please sign in to comment.