11/* *
22 @file CRC.h
33 @author Daniel Bahr
4- @version 1.2.0 .0
4+ @version 1.2.1 .0
55 @copyright
66 @parblock
77 CRC++
8- Copyright (c) 2022, Daniel Bahr
8+ Copyright (c) 2022-2025 , Daniel Bahr
99 All rights reserved.
1010
1111 Redistribution and use in source and binary forms, with or without
5858#ifndef CRCPP_CRC_H_
5959#define CRCPP_CRC_H_
6060
61+ #if __cplusplus >= 201103L && !defined(CRCPP_USE_CPP11)
62+ #define CRCPP_USE_CPP11
63+ #endif
64+
6165#include < climits> // Includes CHAR_BIT
6266#ifdef CRCPP_USE_CPP11
6367#include < cstddef> // Includes ::std::size_t
127131# define crcpp_constexpr const
128132#endif
129133
130- #if defined(WIN32) || defined(_WIN32) || defined(WINCE )
134+ #if defined(_MSC_VER) && ! defined(__clang__) && ! defined(__INTEL_COMPILER )
131135/* Disable warning C4127: conditional expression is constant. */
132136#pragma warning(push)
133137#pragma warning(disable : 4127)
@@ -138,6 +142,20 @@ namespace CRCPP
138142{
139143#endif
140144
145+ #ifdef CRCPP_USE_CPP11
146+ crcpp_constexpr int CRCPP_MAJOR_VERSION = 1 ;
147+ crcpp_constexpr int CRCPP_MINOR_VERSION = 2 ;
148+ crcpp_constexpr int CRCPP_PATCH_VERSION = 1 ;
149+ crcpp_constexpr int CRCPP_REVISION_VERSION = 0 ;
150+ crcpp_constexpr char CRCPP_COPYRIGHT[] = " Copyright (c) 2022-2025, Daniel Bahr" ;
151+ #else
152+ #define CRCPP_MAJOR_VERSION 1
153+ #define CRCPP_MINOR_VERSION 2
154+ #define CRCPP_PATCH_VERSION 1
155+ #define CRCPP_REVISION_VERSION 0
156+ #define CRCPP_COPYRIGHT " Copyright (c) 2022-2025, Daniel Bahr"
157+ #endif
158+
141159/* *
142160 @brief Static class for computing CRCs.
143161 @note This class supports computation of full and multi-part CRCs, using a bit-by-bit algorithm or a
@@ -895,15 +913,15 @@ inline CRCType CRC::CalculateRemainder(const void * data, crcpp_size size, const
895913 {
896914 while (size--)
897915 {
898- #if defined(WIN32) || defined(_WIN32) || defined(WINCE )
916+ #if defined(_MSC_VER) && ! defined(__clang__) && ! defined(__INTEL_COMPILER )
899917 // Disable warning about data loss when doing (remainder >> CHAR_BIT) when
900918 // remainder is one byte long. The algorithm is still correct in this case,
901919 // though it's possible that one additional machine instruction will be executed.
902920# pragma warning (push)
903921# pragma warning (disable : 4333)
904922#endif
905923 remainder = static_cast <CRCType>((remainder >> CHAR_BIT) ^ lookupTable[static_cast <unsigned char >(remainder ^ *current++)]);
906- #if defined(WIN32) || defined(_WIN32) || defined(WINCE )
924+ #if defined(_MSC_VER) && ! defined(__clang__) && ! defined(__INTEL_COMPILER )
907925# pragma warning (pop)
908926#endif
909927 }
@@ -2107,7 +2125,7 @@ inline const CRC::Parameters<crcpp_uint64, 64> & CRC::CRC_64()
21072125}
21082126#endif
21092127
2110- #if defined(WIN32) || defined(_WIN32) || defined(WINCE )
2128+ #if defined(_MSC_VER) && ! defined(__clang__) && ! defined(__INTEL_COMPILER )
21112129#pragma warning(pop)
21122130#endif
21132131
0 commit comments