Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Monado
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
25
Issues
25
List
Boards
Labels
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Monado
Monado
Commits
b8e4a5f8
Commit
b8e4a5f8
authored
Apr 01, 2019
by
Jakob Bornecrantz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aux/math: Add simple string hashing function
parent
918b834a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
src/xrt/auxiliary/CMakeLists.txt
src/xrt/auxiliary/CMakeLists.txt
+2
-1
src/xrt/auxiliary/math/m_api.h
src/xrt/auxiliary/math/m_api.h
+19
-0
src/xrt/auxiliary/math/m_hash.cpp
src/xrt/auxiliary/math/m_hash.cpp
+20
-0
No files found.
src/xrt/auxiliary/CMakeLists.txt
View file @
b8e4a5f8
...
...
@@ -4,8 +4,9 @@
set
(
MATH_SOURCE_FILES
math/m_api.h
math/m_base.cpp
math/m_optics.c
math/m_eigen_interop.h
math/m_hash.cpp
math/m_optics.c
math/m_quatexpmap.cpp
)
...
...
src/xrt/auxiliary/math/m_api.h
View file @
b8e4a5f8
...
...
@@ -36,6 +36,25 @@ extern "C" {
*/
/*
*
* Hash functions.
*
*/
/*!
* Generate a hash value from the given string, trailing zero not included.
*
* Hashing function used is not specified so no garantee of staying the same
* between different versions of the software, or even when the same version
* is compiled on different platforms/libc++ as it might use std::hash.
*
* @ingroup aux_math
*/
size_t
math_hash_string
(
const
char
*
str_c
,
size_t
length
);
/*
*
* Vector functions
...
...
src/xrt/auxiliary/math/m_hash.cpp
0 → 100644
View file @
b8e4a5f8
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Hashing fuction.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @ingroup aux_math
*/
#include <string>
#include "m_api.h"
extern
"C"
size_t
math_hash_string
(
const
char
*
str_c
,
size_t
length
)
{
std
::
string
str
=
std
::
string
(
str_c
,
length
);
std
::
hash
<
std
::
string
>
str_hash
;
return
str_hash
(
str
);
}
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