diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2017-04-20 16:55:28 -0600 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2017-04-20 16:59:56 -0600 |
commit | 823740e1ffa2b3bd39f8dea8062f5c5a0d9c741b (patch) | |
tree | 63222010af3b90a36f29c1c9c360116973cdff38 /zen/crc.h | |
parent | add .gitattributes for less line ending hassles (diff) | |
download | FreeFileSync-823740e1ffa2b3bd39f8dea8062f5c5a0d9c741b.tar.gz FreeFileSync-823740e1ffa2b3bd39f8dea8062f5c5a0d9c741b.tar.bz2 FreeFileSync-823740e1ffa2b3bd39f8dea8062f5c5a0d9c741b.zip |
normalize most lineendings
Diffstat (limited to 'zen/crc.h')
-rwxr-xr-x | zen/crc.h | 108 |
1 files changed, 54 insertions, 54 deletions
@@ -1,54 +1,54 @@ -// *****************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
-// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved *
-// *****************************************************************************
-
-#ifndef CRC_H_23489275827847235
-#define CRC_H_23489275827847235
-
-#include <boost/crc.hpp>
-
-
-namespace zen
-{
-uint16_t getCrc16(const std::string& str);
-uint32_t getCrc32(const std::string& str);
-template <class ByteIterator> uint16_t getCrc16(ByteIterator first, ByteIterator last);
-template <class ByteIterator> uint32_t getCrc32(ByteIterator first, ByteIterator last);
-
-
-
-
-//------------------------- implementation -------------------------------
-inline uint16_t getCrc16(const std::string& str) { return getCrc16(str.begin(), str.end()); }
-inline uint32_t getCrc32(const std::string& str) { return getCrc32(str.begin(), str.end()); }
-
-
-template <class ByteIterator> inline
-uint16_t getCrc16(ByteIterator first, ByteIterator last)
-{
- static_assert(sizeof(typename std::iterator_traits<ByteIterator>::value_type) == 1, "");
- boost::crc_16_type result;
- if (first != last)
- result.process_bytes(&*first, last - first);
- auto rv = result.checksum();
- static_assert(sizeof(rv) == sizeof(uint16_t), "");
- return rv;
-}
-
-
-template <class ByteIterator> inline
-uint32_t getCrc32(ByteIterator first, ByteIterator last)
-{
- static_assert(sizeof(typename std::iterator_traits<ByteIterator>::value_type) == 1, "");
- boost::crc_32_type result;
- if (first != last)
- result.process_bytes(&*first, last - first);
- auto rv = result.checksum();
- static_assert(sizeof(rv) == sizeof(uint32_t), "");
- return rv;
-}
-}
-
-#endif //CRC_H_23489275827847235
+// ***************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * +// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved * +// ***************************************************************************** + +#ifndef CRC_H_23489275827847235 +#define CRC_H_23489275827847235 + +#include <boost/crc.hpp> + + +namespace zen +{ +uint16_t getCrc16(const std::string& str); +uint32_t getCrc32(const std::string& str); +template <class ByteIterator> uint16_t getCrc16(ByteIterator first, ByteIterator last); +template <class ByteIterator> uint32_t getCrc32(ByteIterator first, ByteIterator last); + + + + +//------------------------- implementation ------------------------------- +inline uint16_t getCrc16(const std::string& str) { return getCrc16(str.begin(), str.end()); } +inline uint32_t getCrc32(const std::string& str) { return getCrc32(str.begin(), str.end()); } + + +template <class ByteIterator> inline +uint16_t getCrc16(ByteIterator first, ByteIterator last) +{ + static_assert(sizeof(typename std::iterator_traits<ByteIterator>::value_type) == 1, ""); + boost::crc_16_type result; + if (first != last) + result.process_bytes(&*first, last - first); + auto rv = result.checksum(); + static_assert(sizeof(rv) == sizeof(uint16_t), ""); + return rv; +} + + +template <class ByteIterator> inline +uint32_t getCrc32(ByteIterator first, ByteIterator last) +{ + static_assert(sizeof(typename std::iterator_traits<ByteIterator>::value_type) == 1, ""); + boost::crc_32_type result; + if (first != last) + result.process_bytes(&*first, last - first); + auto rv = result.checksum(); + static_assert(sizeof(rv) == sizeof(uint32_t), ""); + return rv; +} +} + +#endif //CRC_H_23489275827847235 |