Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: "i = i|0" Date: Thu, 12 Jun 2014 13:35:01 +0200 Organization: PointedEars Software (PES) Lines: 48 Message-ID: <1897109.R5dzFez7A1@PointedEars.de> References: <5398d161$0$6667$9b4e6d93@newsspool3.arcor-online.net> <12993215.vN2ElCmnT9@PointedEars.de> <53998d6b$0$6613$9b4e6d93@newsspool4.arcor-online.net> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1402572903 919 eJwFwYkBwEAEBMCW4rAox9t/CZlRBqFNoBA9vSUkX/jzqByjta4qjk93pMdU9g4P4eSvN38qRBGm (12 Jun 2014 11:35:03 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Thu, 12 Jun 2014 11:35:03 +0000 (UTC) User-Agent: KNode/4.12.4 X-User-ID: eJwFwYEBwCAIA7CXrLSA5yiM/09YInN4BV1OjcaNC8x9A1RNDN/R6XZDj6GU7C7d8gM2vth37VN8kZmf4Qc3FhTc Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Thomas 'PointedEars' Lahn wrote: >> Christoph Michael Becker wrote: >>> At least the C semantics are better matched; consider arbitrary input to >>> the function, or an overflow occuring in the calculation. >>> >>> I'm not sure about the performance. Actually, this idiom is quite >>> common, so it might cause performance improvements in some ECMAScript >>> implementations. At least it is used in asm.js to enforce the type of i >>> and the return value to be an integer type. >> >> Unfortunately, you are wrong on all accounts. > > Even if I am wrong on all accounts, I wouldn't call that unfortunate--at > least I could learn from the mistake/misinformation. :) I would rather that you had not been wrong and this mistake by others had been discovered earlier. >> It would appear that at least this Emscripten version (probably asm.js, >> too) is yet another script-kiddie approach that should be avoided, at >> least for all computationally critical uses. > > I wouldn't call Emscripten/asm.js a script-kiddie approach. It seems > asm.js is already supported by all major browsers, and it seems that > there are areas of application where asm.js is mandatory for > performance, e.g. browser games. So much the worse. >> ToInt32(…) is _not_ equivalent to >> C/C++’s “int”. > > Of course. But if I'm not mistaken, there is no ToInt32() involved in > asm.js code, which instead deals with native "int"s. You are missing the point. Native “int”s are *generic*; the “|” algorithm is not. It matters not that asm.js does not use ToInt32(); Emscripten is used to transcompile to asm.js, and Emscripten apparently generates code that uses ToInt32() implicitly; namely, it uses the “|” operator for conversion to pseudo-integer. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not Cc: me. / Bitte keine Kopien per E-Mail.