@@ -163,7 +163,7 @@ namespace etl
163
163
// Accumulator_Bits > Chunk_Bits
164
164
// Not Reflected
165
165
template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, bool Reflect>
166
- static
166
+ static ETL_CONSTEXPR14
167
167
typename etl::enable_if<(Accumulator_Bits > Chunk_Bits) && !Reflect, TAccumulator>::type
168
168
crc_update_chunk (TAccumulator crc, uint8_t value, const TAccumulator table[])
169
169
{
@@ -181,7 +181,7 @@ namespace etl
181
181
// Accumulator_Bits > Chunk_Bits
182
182
// Reflected
183
183
template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, bool Reflect>
184
- static
184
+ static ETL_CONSTEXPR14
185
185
typename etl::enable_if<(Accumulator_Bits > Chunk_Bits) && Reflect, TAccumulator>::type
186
186
crc_update_chunk (TAccumulator crc, uint8_t value, const TAccumulator table[])
187
187
{
@@ -199,7 +199,7 @@ namespace etl
199
199
// Accumulator_Bits == Chunk_Bits
200
200
// Not Reflected
201
201
template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, bool Reflect>
202
- static
202
+ static ETL_CONSTEXPR14
203
203
typename etl::enable_if<(Accumulator_Bits == Chunk_Bits) && !Reflect, TAccumulator>::type
204
204
crc_update_chunk (TAccumulator crc, uint8_t value, const TAccumulator table[])
205
205
{
@@ -216,7 +216,7 @@ namespace etl
216
216
// Accumulator_Bits == Chunk_Bits
217
217
// Reflected
218
218
template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, bool Reflect>
219
- static
219
+ static ETL_CONSTEXPR14
220
220
typename etl::enable_if<(Accumulator_Bits == Chunk_Bits) && Reflect, TAccumulator>::type
221
221
crc_update_chunk (TAccumulator crc, uint8_t value, const TAccumulator table[])
222
222
{
@@ -241,16 +241,21 @@ namespace etl
241
241
struct crc_table <TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Polynomial, Reflect, 4U >
242
242
{
243
243
// *************************************************************************
244
+ #if !ETL_USING_CPP11
244
245
TAccumulator add (TAccumulator crc, uint8_t value) const
245
246
{
247
+ #endif
246
248
static ETL_CONSTANT TAccumulator table[4U ] =
247
249
{
248
250
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 0U , Chunk_Bits>::value,
249
251
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 1U , Chunk_Bits>::value,
250
252
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 2U , Chunk_Bits>::value,
251
253
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 3U , Chunk_Bits>::value
252
254
};
253
-
255
+ #if ETL_USING_CPP11
256
+ ETL_CONSTEXPR14 TAccumulator add (TAccumulator crc, uint8_t value) const
257
+ {
258
+ #endif
254
259
if ETL_IF_CONSTEXPR (Reflect)
255
260
{
256
261
crc = crc_update_chunk<TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Reflect>(crc, value, table);
@@ -269,15 +274,21 @@ namespace etl
269
274
return crc;
270
275
}
271
276
};
277
+ #if ETL_USING_CPP11
278
+ template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, TAccumulator Polynomial, bool Reflect>
279
+ ETL_CONSTANT TAccumulator crc_table<TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Polynomial, Reflect, 4U >::table[4U ];
280
+ #endif
272
281
273
282
// *********************************
274
283
// Table size of 16.
275
284
template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, TAccumulator Polynomial, bool Reflect>
276
285
struct crc_table <TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Polynomial, Reflect, 16U >
277
286
{
278
287
// *************************************************************************
288
+ #if !ETL_USING_CPP11
279
289
TAccumulator add (TAccumulator crc, uint8_t value) const
280
290
{
291
+ #endif
281
292
static ETL_CONSTANT TAccumulator table[16U ] =
282
293
{
283
294
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 0U , Chunk_Bits>::value,
@@ -297,7 +308,10 @@ namespace etl
297
308
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 14U , Chunk_Bits>::value,
298
309
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 15U , Chunk_Bits>::value
299
310
};
300
-
311
+ #if ETL_USING_CPP11
312
+ ETL_CONSTEXPR14 TAccumulator add (TAccumulator crc, uint8_t value) const
313
+ {
314
+ #endif
301
315
if ETL_IF_CONSTEXPR (Reflect)
302
316
{
303
317
crc = crc_update_chunk<TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Reflect>(crc, value, table);
@@ -312,16 +326,22 @@ namespace etl
312
326
return crc;
313
327
}
314
328
};
329
+ #if ETL_USING_CPP11
330
+ template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, TAccumulator Polynomial, bool Reflect>
331
+ ETL_CONSTANT TAccumulator crc_table<TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Polynomial, Reflect, 16U >::table[16U ];
332
+ #endif
315
333
316
334
// *********************************
317
335
// Table size of 256.
318
336
template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, TAccumulator Polynomial, bool Reflect>
319
337
struct crc_table <TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Polynomial, Reflect, 256U >
320
338
{
321
339
// *************************************************************************
340
+ #if !ETL_USING_CPP11
322
341
TAccumulator add (TAccumulator crc, uint8_t value) const
323
342
{
324
- static ETL_CONSTANT TAccumulator table[256U ] =
343
+ #endif
344
+ static ETL_CONSTANT TAccumulator table[256U ]=
325
345
{
326
346
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 0U , Chunk_Bits>::value,
327
347
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 1U , Chunk_Bits>::value,
@@ -580,13 +600,20 @@ namespace etl
580
600
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 254U , Chunk_Bits>::value,
581
601
crc_table_entry<TAccumulator, Accumulator_Bits, Polynomial, Reflect, 255U , Chunk_Bits>::value
582
602
};
603
+ #if ETL_USING_CPP11
604
+ ETL_CONSTEXPR14 TAccumulator add (TAccumulator crc, uint8_t value) const
605
+ {
606
+ #endif
583
607
584
608
crc = crc_update_chunk<TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Reflect>(crc, value, table);
585
609
586
610
return crc;
587
611
}
588
612
};
589
-
613
+ #if ETL_USING_CPP11
614
+ template <typename TAccumulator, size_t Accumulator_Bits, size_t Chunk_Bits, uint8_t Chunk_Mask, TAccumulator Polynomial, bool Reflect>
615
+ ETL_CONSTANT TAccumulator crc_table<TAccumulator, Accumulator_Bits, Chunk_Bits, Chunk_Mask, Polynomial, Reflect, 256U >::table[256U ];
616
+ #endif
590
617
// *****************************************************************************
591
618
// CRC Policies.
592
619
// *****************************************************************************
@@ -615,7 +642,7 @@ namespace etl
615
642
}
616
643
617
644
// *************************************************************************
618
- accumulator_type final (accumulator_type crc) const
645
+ ETL_CONSTEXPR accumulator_type final (accumulator_type crc) const
619
646
{
620
647
return crc ^ TCrcParameters::Xor_Out;
621
648
}
@@ -643,7 +670,7 @@ namespace etl
643
670
}
644
671
645
672
// *************************************************************************
646
- accumulator_type final (accumulator_type crc) const
673
+ ETL_CONSTEXPR accumulator_type final (accumulator_type crc) const
647
674
{
648
675
return crc ^ TCrcParameters::Xor_Out;
649
676
}
@@ -671,7 +698,7 @@ namespace etl
671
698
}
672
699
673
700
// *************************************************************************
674
- accumulator_type final (accumulator_type crc) const
701
+ ETL_CONSTEXPR accumulator_type final (accumulator_type crc) const
675
702
{
676
703
return crc ^ TCrcParameters::Xor_Out;
677
704
}
@@ -691,7 +718,7 @@ namespace etl
691
718
// *************************************************************************
692
719
// / Default constructor.
693
720
// *************************************************************************
694
- crc_type ()
721
+ ETL_CONSTEXPR14 crc_type ()
695
722
{
696
723
this ->reset ();
697
724
}
@@ -702,7 +729,7 @@ namespace etl
702
729
// / \param end End of the range.
703
730
// *************************************************************************
704
731
template <typename TIterator>
705
- crc_type (TIterator begin, const TIterator end)
732
+ ETL_CONSTEXPR14 crc_type (TIterator begin, const TIterator end)
706
733
{
707
734
this ->reset ();
708
735
this ->add (begin, end);
0 commit comments