Embedded Template Library
1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
jenkins.h
Go to the documentation of this file.
1
2
3
/******************************************************************************
4
The MIT License(MIT)
5
6
Embedded Template Library.
7
https://github.com/ETLCPP/etl
8
https://www.etlcpp.com
9
10
Copyright(c) 2014 John Wellbelove
11
12
Permission is hereby granted, free of charge, to any person obtaining a copy
13
of this software and associated documentation files(the "Software"), to deal
14
in the Software without restriction, including without limitation the rights
15
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16
copies of the Software, and to permit persons to whom the Software is
17
furnished to do so, subject to the following conditions :
18
19
The above copyright notice and this permission notice shall be included in all
20
copies or substantial portions of the Software.
21
22
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
SOFTWARE.
29
******************************************************************************/
30
31
#ifndef ETL_JENKINS_INCLUDED
32
#define ETL_JENKINS_INCLUDED
33
34
#include "
platform.h
"
35
#include "
error_handler.h
"
36
#include "
frame_check_sequence.h
"
37
#include "
ihash.h
"
38
#include "
iterator.h
"
39
#include "
type_traits.h
"
40
41
#include <stdint.h>
42
43
#if defined(ETL_COMPILER_KEIL)
44
#pragma diag_suppress 1300
45
#endif
46
49
50
namespace
etl
51
{
52
//***************************************************************************
55
//***************************************************************************
56
struct
jenkins_policy
57
{
58
typedef
uint32_t value_type;
59
60
uint32_t initial()
const
61
{
62
is_finalised =
false
;
63
64
return
0;
65
}
66
67
uint32_t add(value_type hash, uint8_t value)
const
68
{
69
ETL_ASSERT
(!is_finalised, ETL_ERROR(
hash_finalised
));
70
71
hash += value;
72
hash += (hash << 10U);
73
hash ^= (hash >> 6U);
74
75
return
hash;
76
}
77
78
uint32_t
final
(value_type hash)
const
79
{
80
hash += (hash << 3U);
81
hash ^= (hash >> 11U);
82
hash += (hash << 15U);
83
is_finalised =
true
;
84
85
return
hash;
86
}
87
88
mutable
bool
is_finalised;
89
};
90
91
//*************************************************************************
93
//*************************************************************************
94
class
jenkins
:
public
etl::frame_check_sequence
<etl::jenkins_policy>
95
{
96
public
:
97
98
//*************************************************************************
100
//*************************************************************************
101
jenkins
()
102
{
103
this->
reset
();
104
}
105
106
//*************************************************************************
110
//*************************************************************************
111
template
<
typename
TIterator>
112
jenkins
(TIterator
begin
,
const
TIterator
end
)
113
{
114
this->
reset
();
115
this->
add
(begin,
end
);
116
}
117
};
118
}
// namespace etl
119
120
#endif
etl::jenkins::jenkins
jenkins()
Default constructor.
Definition
jenkins.h:101
etl::jenkins::jenkins
jenkins(TIterator begin, const TIterator end)
Definition
jenkins.h:112
error_handler.h
frame_check_sequence.h
ETL_ASSERT
#define ETL_ASSERT(b, e)
Definition
error_handler.h:511
etl::frame_check_sequence< etl::jenkins_policy >::add
ETL_CONSTEXPR14 void add(TIterator begin, const TIterator end)
Definition
frame_check_sequence.h:145
etl::frame_check_sequence< etl::jenkins_policy >::reset
ETL_CONSTEXPR14 void reset()
Definition
frame_check_sequence.h:134
etl::frame_check_sequence
Definition
frame_check_sequence.h:98
etl::hash_finalised
Definition
ihash.h:63
ihash.h
iterator.h
etl
Definition
absolute.h:40
etl::end
TContainer::iterator end(TContainer &container)
Definition
iterator.h:1166
etl::begin
TContainer::iterator begin(TContainer &container)
Definition
iterator.h:1136
platform.h
etl::jenkins_policy
Definition
jenkins.h:57
type_traits.h
include
etl
jenkins.h
Generated on
for Embedded Template Library by
1.17.0