Subj : Re: INT_TO_JSVAL problem To : Youngsun Jeong From : Brendan Eich Date : Wed Oct 08 2003 10:52 am Youngsun Jeong wrote: >Hello, I want to know why "INT_TO_JSVAL" uses left-shift operator. >In case of 32bits data(e.g. bf5ff260), "INT_TO_JSVAL" causes loss of >data. Please tell me why.... > > It doesn't cause loss of data if you use it as intended. Use JS_NewNumberValue if you cannot guarantee that the integer you were passing to INT_TO_JSVAL satisfies the constraint INT_FITS_IN_JSVAL. In other words, simply use JS_NewNumberValue unconditionally except for cases where you have need to optimize, or know that the integer is "small enough." /be .