Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73964 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2011-08-20 19:18:04


Author: trademark
Date: 2011-08-20 19:18:04 EDT (Sat, 20 Aug 2011)
New Revision: 73964
URL: http://svn.boost.org/trac/boost/changeset/73964

Log:
Clear the operate_on_valid_value function.
Text files modified:
   sandbox/SOC/2011/checks/boost/checks/luhn.hpp | 3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)

Modified: sandbox/SOC/2011/checks/boost/checks/luhn.hpp
==============================================================================
--- sandbox/SOC/2011/checks/boost/checks/luhn.hpp (original)
+++ sandbox/SOC/2011/checks/boost/checks/luhn.hpp 2011-08-20 19:18:04 EDT (Sat, 20 Aug 2011)
@@ -53,7 +53,8 @@
   static void operate_on_valid_value( const int current_valid_value, const unsigned int valid_value_counter, int &checksum )
   {
     int current_weight = luhn_weight::weight_associated_with_pos( valid_value_counter + number_of_virtual_value_skipped ) ;
- checksum += (current_valid_value << (current_weight - 1)) - 9 * ( current_valid_value << (current_weight - 1) > 9) ;
+ int weighted_value = current_valid_value << (current_weight-1);
+ checksum += weighted_value % 10 + weighted_value / 10 ;
   }
 };
 


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