Author: sebor
Date: Tue Jan  9 13:35:51 2007
New Revision: 494601

URL: http://svn.apache.org/viewvc?view=rev&rev=494601
Log:
2007-01-09  Martin Sebor  <[EMAIL PROTECTED]>

        STDCXX-318
        * valarray.cc (cshift): Avoided division by zero when *this is empty.

Modified:
    incubator/stdcxx/trunk/include/valarray.cc

Modified: incubator/stdcxx/trunk/include/valarray.cc
URL: 
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/valarray.cc?view=diff&rev=494601&r1=494600&r2=494601
==============================================================================
--- incubator/stdcxx/trunk/include/valarray.cc (original)
+++ incubator/stdcxx/trunk/include/valarray.cc Tue Jan  9 13:35:51 2007
@@ -57,7 +57,7 @@
 {
     // compute non-negative modulus - the sign of (a % b) is
     // implementation-defined if either argument is negative (5.6, p4)
-    _RWSTD_PTRDIFF_T __mod = __n % _RWSTD_PTRDIFF_T (size ());
+    _RWSTD_PTRDIFF_T __mod = size () ? __n % _RWSTD_PTRDIFF_T (size ()) : 0;
     _RWSTD_SIZE_T    __rem = __mod < 0 ? -__mod : __mod;
 
     if (0 == __rem)


Reply via email to