From a75966e3ccacf39c41776a94ad654492c3116666 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 10 Mar 2014 09:59:15 +0100 Subject: [PATCH] In Int32Value, cast to u32 before casting to u64. Casting to u64 directly is equivalent to first casting to i64, which does sign extension. For negative values, this fills the highest 32 bits with ones rather than the zeros we need. --- jsval.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsval.rs b/jsval.rs index 523f278f1..a58a4190d 100644 --- a/jsval.rs +++ b/jsval.rs @@ -81,7 +81,7 @@ pub fn UndefinedValue() -> JSVal { #[inline(always)] pub fn Int32Value(i: i32) -> JSVal { - BuildJSVal(JSVAL_TAG_INT32, i as u64) + BuildJSVal(JSVAL_TAG_INT32, i as u32 as u64) } #[inline(always)]