|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73334 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2011-07-24 14:19:10
Author: trademark
Date: 2011-07-24 14:19:09 EDT (Sun, 24 Jul 2011)
New Revision: 73334
URL: http://svn.boost.org/trac/boost/changeset/73334
Log:
This is a backup commit (just "in case").
It's working, but obsolete. See basic_checks.
Text files modified:
sandbox/SOC/2011/checks/boost/checks/modulus.hpp | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
Modified: sandbox/SOC/2011/checks/boost/checks/modulus.hpp
==============================================================================
--- sandbox/SOC/2011/checks/boost/checks/modulus.hpp (original)
+++ sandbox/SOC/2011/checks/boost/checks/modulus.hpp 2011-07-24 14:19:09 EDT (Sun, 24 Jul 2011)
@@ -165,12 +165,10 @@
// If the number of digits isn't given (equal to 0), we count these.
if(!nbr_digits)
{
- mod10_iter iter = begin;
- while(iter != end)
+ for(mod10_iter iter = begin; iter != end; ++iter)
{
if(*iter >= '0' && *iter <= '9')
++nbr_digits;
- ++iter;
}
// Return false if there is no digit in the expression given.
if(!nbr_digits)
@@ -268,7 +266,7 @@
while(nbr_digits > 1 && iter != end)
{
if(*begin >= '0' && *begin <= '9')
- sum += (*begin & 15) * nbr_digits--;
+ sum += (*begin & 15) * (--nbr_digits % 10 + 1);
++begin;
}
// Add the check digit to the sum (add 10 if the check digit equals 'x' or 'X').
@@ -321,7 +319,7 @@
while(nbr_digits > 1 && iter != end)
{
if(*begin >= '0' && *begin <= '9')
- sum += (*begin & 15) * nbr_digits-- ;
+ sum += (*begin & 15) * (--nbr_digits % 10 + 1);
++begin;
}
if(nbr_digits > 1)
@@ -362,7 +360,7 @@
while(nbr_digits > 1 && iter != end)
{
if(*begin >= '0' && *begin <= '9')
- sum += (*begin & 15) * nbr_digits-- ;
+ sum += (*begin & 15) * (--nbr_digits % 10 + 1);
++begin;
}
if(nbr_digits > 1)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk