Skip to content

Commit 98d2adc

Browse files
committed
fix uint32 not returning a non signed integer. v8 api is a bit strange
1 parent b451a4f commit 98d2adc

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/addon.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@
153153
#if NODE_VERSION_AT_LEAST(0, 11, 0)
154154
#define UNDEFINED() v8::Undefined(isolate)
155155
#define INT32(v) v8::Int32::New(isolate, v)
156-
#define UINT32(v) v8::Uint32::New(isolate, v)
156+
#define UINT32(v) v8::Uint32::NewFromUnsigned(isolate, v)
157157
#define STRING(v) v8::String::NewFromUtf8(isolate, v)
158158
#else
159159
#define UNDEFINED() v8::Undefined()
160160
#define INT32(v) v8::Int32::New(v)
161-
#define UINT32(v) v8::Uint32::New(v)
161+
#define UINT32(v) v8::Uint32::NewFromUnsigned(v)
162162
#define STRING(v) v8::String::New(v)
163163
#endif
164164

src/wiringPiISR.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ static void processInterrupt(uv_work_t* req, int status) {
4040

4141
Local<Value> argv[] = {
4242
#if NODE_VERSION_AT_LEAST(0, 11, 0)
43-
Local<Value>::New(isolate, Uint32::New(isolate, work->delta))
43+
Local<Value>::New(isolate, UINT32(work->delta))
4444
#else
45-
Local<Value>::New(Uint32::New(work->delta))
45+
Local<Value>::New(UINT32(work->delta))
4646
#endif
4747
};
4848

0 commit comments

Comments
 (0)