Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
4808e10c
Commit
4808e10c
authored
Jan 31, 2021
by
Pavel Vainerman
Committed by
Pavel Vainerman
Oct 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
used hash64 for key() function
parent
9ef635d5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
4 deletions
+22
-4
UniSetTypes.h
include/UniSetTypes.h
+1
-1
Configuration.cc
src/Core/Configuration.cc
+1
-1
UniSetTypes.cc
src/Core/UniSetTypes.cc
+12
-2
test_utypes.cc
tests/test_utypes.cc
+8
-0
No files found.
include/UniSetTypes.h
View file @
4808e10c
...
...
@@ -72,7 +72,7 @@ namespace uniset
const
ObjectId
AdminID
=
-
2
;
/*!< сервисный идентификатор используемый утилитой admin */
typedef
size
_t
KeyType
;
/*!< уникальный ключ объекта */
typedef
uint64
_t
KeyType
;
/*!< уникальный ключ объекта */
/*! генератор уникального положительного ключа
* Уникальность гарантируется только для пары значений id и node.
...
...
src/Core/Configuration.cc
View file @
4808e10c
...
...
@@ -276,7 +276,7 @@ namespace uniset
{
if
(
it
.
getIntProp
(
"idfromfile"
)
==
0
)
{
shared_ptr
<
ObjectIndex_
XML
>
oi
=
make_shared
<
ObjectIndex_
XML
>
(
unixml
);
//(fileConfName);
shared_ptr
<
ObjectIndex_
hashXML
>
oi
=
make_shared
<
ObjectIndex_hash
XML
>
(
unixml
);
//(fileConfName);
oind
=
static_pointer_cast
<
ObjectIndex
>
(
oi
);
}
else
...
...
src/Core/UniSetTypes.cc
View file @
4808e10c
...
...
@@ -732,10 +732,20 @@ string uniset::BadSymbolsToStr()
return
bad
;
}
// ---------------------------------------------------------------------------------------------------------------
struct
keys_t
{
uniset
::
ObjectId
id
;
uniset
::
ObjectId
node
;
keys_t
(
const
uniset
::
ObjectId
&
_id
,
const
uniset
::
ObjectId
&
_node
)
:
id
(
_id
),
node
(
_node
)
{}
};
uniset
::
KeyType
uniset
::
key
(
const
uniset
::
ObjectId
id
,
const
uniset
::
ObjectId
node
)
{
//! \warning что тут у нас с переполнением..
return
KeyType
(
(
id
*
node
)
+
(
id
+
2
*
node
)
);
keys_t
k
(
id
,
node
);
return
uniset
::
hash64
(
reinterpret_cast
<
char
*>
(
&
k
),
sizeof
(
k
)
);
}
// ---------------------------------------------------------------------------------------------------------------
uniset
::
KeyType
uniset
::
key
(
const
IOController_i
::
SensorInfo
&
si
)
...
...
tests/test_utypes.cc
View file @
4808e10c
...
...
@@ -423,3 +423,11 @@ TEST_CASE("UniSetTypes: hash32", "[utypes][hash32]" )
REQUIRE
(
uniset
::
hash32
(
"ta"
)
!=
uniset
::
hash32
(
"at"
)
);
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"UniSetTypes: key"
,
"[utypes][key]"
)
{
REQUIRE
(
uniset
::
key
(
100
,
100
)
==
uint64_t
(
12423972911335977860
)
);
REQUIRE
(
uniset
::
key
(
100
,
100
)
==
uint64_t
(
12423972911335977860
)
);
REQUIRE
(
uniset
::
key
(
1e14
,
1e16
)
==
uint64_t
(
13802851885616383566
)
);
REQUIRE
(
uniset
::
key
(
101
,
100
)
==
uint64_t
(
793928870581810946
)
);
}
// -----------------------------------------------------------------------------
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment