Is there a problem with the JavaScript unsigned shift operator on the iPad?

I accidentally ran into the Safari JavaScript engine which seems to be a very strange bug on the iPad.

Unsigned shift operator>>> It should be a number shifted to the right. I encountered some errors in a script, which worked fine on other platforms, and deleted them, and finally ended:

< html>

Live demo

The strange thing is that it generates a bunch of correctly, but at a certain point, some things will be interrupted, only from then Output zero.

Obviously, >>> 0 is meaningless here (the shift in the zero position usually does not do anything, although if javascript makes the distinction, it may force integers Becomes unsigned). Just to prove the problem, if you omit >>> 0 it will not be displayed. In my actual situation, different numbers and more complex expressions are involved, but the same thing happened: everything works , Until some iterations, and then some “rests”, the variables suddenly become and remain zero, even if the subsequent calculations really should be non-zero.

Suitable for Android and PC browsers. Strange?< /p>

is not a “real” answer, but perhaps a useful answer, assuming (it seems likely ), this is only in Apple’s JIT compiler A mistake: This StackOverflow thread (Disabling JIT in Safari 6 to workaround severe Javascript JIT bugs) talks about how to disable JIT on the code. Basically,

Wrap the offending statement in a do-nothing try-catch block.

I don’t have an iOS device for testing, but will this make the problem go away? Can you apply the same workaround to the original code?

function Strange()
{
try
{
return one = (Zero()+1) >>> 0;
}
catch (e) {throw e }
}

I accidentally ran into the Safari JavaScript engine on the iPad The above seems to be a very strange bug.

The unsigned shift operator >>> should shift a number bit by bit. I encountered some errors in a script, on other platforms It worked fine, and deleted it, and finally ended:

Live demo

Weird The thing is, it correctly generates a bunch, but at a certain point, something will break, and only then will it output zero.

Obviously, >>> 0 is meaningless here. (The shift in the zero position usually doesn’t do anything, although if javascript makes the distinction, it may force the integer to be unsigned). Just to prove the problem, if you omit >>> 0 it doesn’t show In my actual situation, different numbers and more complex expressions are involved, but the same thing happens: everything works, until some iterations, and then some “rests”, the variable suddenly becomes and remains zero, even afterwards Calculations should really be non-zero .

Suitable for Android and PC browsers. Is it strange?

Not a “real” answer, but maybe a useful answer, assuming (it seems very likely) that this is just the Apple JIT compiler A mistake: This StackOverflow thread (Disabling JIT in Safari 6 to workaround severe Javascript JIT bugs) talks about how to disable JIT on the code. Basically,

Wrap the offending statement in a do-nothing try-catch block.

I don’t have an iOS device for testing, but will this make the problem go away? Can you apply the same workaround to the original code?

function Strange()
{
try
{
return one = (Zero()+1) >>> 0;
}
catch (e) {throw e }
}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1013 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.