Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!newsfeed.r-kom.de!news.m-online.net!.POSTED!not-for-mail From: Wolfgang Draxinger Newsgroups: comp.lang.java.programmer,comp.lang.c Subject: Re: Arithmetic overflow checking Date: Thu, 8 Sep 2011 22:24:42 +0200 Organization: (posted via) M-net Telekommunikations GmbH Lines: 24 Message-ID: <20110908222442.3eda3e88@loki.yggdrasil.draxit.de> References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <2rydnez7l-H5BYnTnZ2dnUVZ_vGdnZ2d@earthlink.com> <9LWdnZH2hdfmyYvTnZ2dnUVZ_vidnZ2d@posted.palinacquisition> <3797038f-22d1-40b2-8c12-60db5a0976b8@t5g2000yqj.googlegroups.com> <20110908210243.710b9d01@loki.yggdrasil.draxit.de> <20110908211243.7932aa0c@loki.yggdrasil.draxit.de> NNTP-Posting-Host: ppp-188-174-60-249.dynamic.mnet-online.de Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.m-online.net 1315513483 13294 188.174.60.249 (8 Sep 2011 20:24:43 GMT) X-Complaints-To: news@news.m-online.net NNTP-Posting-Date: Thu, 8 Sep 2011 20:24:43 +0000 (UTC) X-Newsreader: Claws Mail 3.7.8 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7720 comp.lang.c:10034 Am Thu, 8 Sep 2011 19:15:13 +0000 (UTC) schrieb Willem : > So if an overflow condition typically occurs less than 1 in 10000 > times, the interrupt solution is better. Theoretically yes, practically no! It depends on the architecture. On ARM it doesn't matter at all, since ALL instructions are conditional. On x86 architecture due to pipelining and OOE the differences are not measureable as well (the overflow case code executes in parallel and may have been finished, before the code, creating the overflow executed at all). Also the overflow condition will probably not do any arithmetic, in contrast to the arithmetic that does overflow. So these are separate functional units at work, so pipelining will execute them in parallel. Really, there no cost to speak of in doing overflow checks. Wolfgang