Skip to content

Commit e614675

Browse files
committed
fix sign issue found in #1631
1 parent 77fd967 commit e614675

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/jsvar.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,11 @@ typedef struct {
228228
*/
229229

230230
static ALWAYS_INLINE JsVarRef jsvGetFirstChild(const JsVar *v) { return v->varData.ref.firstChild; }
231-
static ALWAYS_INLINE JsVarRefSigned jsvGetFirstChildSigned(const JsVar *v) { return (JsVarRefSigned)v->varData.ref.firstChild; }
231+
static ALWAYS_INLINE JsVarRefSigned jsvGetFirstChildSigned(const JsVar *v) {
232+
if (v->varData.ref.firstChild > JSVARREF_MAX)
233+
return ((JsVarRefSigned)v->varData.ref.firstChild) + JSVARREF_MIN*2;
234+
return (JsVarRefSigned)v->varData.ref.firstChild;
235+
}
232236
static ALWAYS_INLINE JsVarRef jsvGetLastChild(const JsVar *v) { return v->varData.ref.lastChild; }
233237
static ALWAYS_INLINE JsVarRef jsvGetNextSibling(const JsVar *v) { return v->varData.ref.nextSibling; }
234238
static ALWAYS_INLINE JsVarRef jsvGetPrevSibling(const JsVar *v) { return v->varData.ref.prevSibling; }

0 commit comments

Comments
 (0)