static bool ReadCustomDoubleNaNObject(JSContext* cx, HandleValue v, double* ret) { RootedObject obj(cx, &v.toObject()); RootedValue val(cx); uint64_t u64; int32_t i32; if (!JS_GetProperty(cx, obj, "nan_high", &val)) return false; if (!ToInt32(cx, val, &i32)) return false; u64 = uint32_t(i32); u64 <<= 32; if (!JS_GetProperty(cx, obj, "nan_low", &val)) return false; if (!ToInt32(cx, val, &i32)) return false; u64 |= uint32_t(i32); BitwiseCast(u64, ret); return true; }
static bool ReadCustomFloat32NaNObject(JSContext* cx, HandleValue v, float* ret) { RootedObject obj(cx, &v.toObject()); RootedValue val(cx); int32_t i32; if (!JS_GetProperty(cx, obj, "nan_low", &val)) return false; if (!ToInt32(cx, val, &i32)) return false; BitwiseCast(i32, ret); return true; }