00001 #pragma ident "$Id: Adler32.cpp 2535 2011-03-25 15:58:06Z ccutlip $" 00002 00004 00005 //============================================================================ 00006 // 00007 // This file is part of GPSTk, the GPS Toolkit. 00008 // 00009 // The GPSTk is free software; you can redistribute it and/or modify 00010 // it under the terms of the GNU Lesser General Public License as published 00011 // by the Free Software Foundation; either version 2.1 of the License, or 00012 // any later version. 00013 // 00014 // The GPSTk is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with GPSTk; if not, write to the Free Software Foundation, 00021 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 // Copyright 2004, The University of Texas at Austin 00024 // 00025 //============================================================================ 00026 00027 //http://en.wikipedia.org/wiki/Adler-32 00028 00029 #include "Adler32.hpp" 00030 00031 namespace vdraw 00032 { 00033 void Adler32::update(const char* buf, unsigned int len) 00034 { 00035 if (buf == 0 || len == 0) 00036 return; 00037 00038 // Go in order... 00039 for(unsigned int i=0;i<len;i++) 00040 { 00041 a = (a+(((int)buf[i])&0x000000FF)) % mod; 00042 b = (b+a) % mod; 00043 } 00044 } 00045 00046 } // namespace vdraw 00047 00048
1.3.9.1