adler: add iterator style argument wrapper

This commit is contained in:
Danny Robson 2014-09-02 23:36:21 +10:00
parent b442db41ec
commit 332264a5be
2 changed files with 10 additions and 2 deletions

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with libgim. If not, see <http://www.gnu.org/licenses/>. * along with libgim. If not, see <http://www.gnu.org/licenses/>.
* *
* Copyright 2010 Danny Robson <danny@nerdcruft.net> * Copyright 2010-2014 Danny Robson <danny@nerdcruft.net>
*/ */
#include "adler.hpp" #include "adler.hpp"
@ -28,3 +28,10 @@ uint32_t
adler32 (const void* restrict _data, size_t _size) adler32 (const void* restrict _data, size_t _size)
{ return fletcher<32, MODULUS, 1, 0> (_data, _size); } { return fletcher<32, MODULUS, 1, 0> (_data, _size); }
//-----------------------------------------------------------------------------
uint32_t
adler32 (const uint8_t *first, const uint8_t *last)
{
return adler32 (first, last - first);
}

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with libgim. If not, see <http://www.gnu.org/licenses/>. * along with libgim. If not, see <http://www.gnu.org/licenses/>.
* *
* Copyright 2010 Danny Robson <danny@nerdcruft.net> * Copyright 2010-2014 Danny Robson <danny@nerdcruft.net>
*/ */
#ifndef __UTIL_ADLER_HPP #ifndef __UTIL_ADLER_HPP
@ -24,5 +24,6 @@
#include <cstdlib> #include <cstdlib>
extern uint32_t adler32(const void* restrict, size_t); extern uint32_t adler32(const void* restrict, size_t);
extern uint32_t adler32 (const uint8_t *first, const uint8_t *last);
#endif #endif