Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
c-stuff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bruce Cowan
c-stuff
Commits
19632a39
Verified
Commit
19632a39
authored
3 years ago
by
Bruce Cowan
Browse files
Options
Downloads
Patches
Plain Diff
Make use of XXH3 for hashing
parent
a3be0320
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
meson.build
+3
-1
3 additions, 1 deletion
meson.build
src/hashtable-test.c
+7
-3
7 additions, 3 deletions
src/hashtable-test.c
src/meson.build
+8
-4
8 additions, 4 deletions
src/meson.build
with
19 additions
and
9 deletions
.gitlab-ci.yml
+
1
−
1
View file @
19632a39
...
@@ -8,7 +8,7 @@ stages:
...
@@ -8,7 +8,7 @@ stages:
-
test
-
test
before_script
:
before_script
:
-
apk update && apk add build-base meson glib
-
apk update && apk add build-base meson glib
xxhash-dev
build
:
build
:
stage
:
build
stage
:
build
...
...
This diff is collapsed.
Click to expand it.
meson.build
+
3
−
1
View file @
19632a39
# SPDX-FileCopyrightText: 2018-2020 Bruce Cowan
# SPDX-FileCopyrightText: 2018-2022 Bruce Cowan
#
# SPDX-License-Identifier: CC0-1.0
# SPDX-License-Identifier: CC0-1.0
project
(
'stdlib'
,
'c'
,
project
(
'stdlib'
,
'c'
,
...
@@ -11,6 +12,7 @@ libm = cc.find_library('m')
...
@@ -11,6 +12,7 @@ libm = cc.find_library('m')
glib_dep
=
dependency
(
'glib-2.0'
,
version
:
'>= 2.16'
,
required
:
false
)
glib_dep
=
dependency
(
'glib-2.0'
,
version
:
'>= 2.16'
,
required
:
false
)
openmp_dep
=
dependency
(
'openmp'
,
required
:
false
)
openmp_dep
=
dependency
(
'openmp'
,
required
:
false
)
thread_dep
=
dependency
(
'threads'
,
required
:
false
)
thread_dep
=
dependency
(
'threads'
,
required
:
false
)
xxhash_dep
=
dependency
(
'libxxhash'
,
required
:
false
)
conf_data
=
configuration_data
()
conf_data
=
configuration_data
()
...
...
This diff is collapsed.
Click to expand it.
src/hashtable-test.c
+
7
−
3
View file @
19632a39
/*
/*
* SPDX-FileCopyrightText: 2018
, 2019
Bruce Cowan <bruce@bcowan.me.uk>
* SPDX-FileCopyrightText: 2018
-2022
Bruce Cowan <bruce@bcowan.me.uk>
*
*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-License-Identifier: GPL-3.0-or-later
*/
*/
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
#include
<xxhash.h>
#include
<hashtable.h>
#include
<hashtable.h>
static
void
static
void
...
@@ -42,8 +44,10 @@ print_all (void *key,
...
@@ -42,8 +44,10 @@ print_all (void *key,
static
unsigned
static
unsigned
str_hash
(
const
void
*
data
)
str_hash
(
const
void
*
data
)
{
{
const
char
*
str
=
(
const
char
*
)
data
;
size_t
length
=
strlen
((
const
char
*
)
data
);
return
(
unsigned
)
str
[
0
];
XXH64_hash_t
hash
=
XXH3_64bits
(
data
,
length
);
return
(
unsigned
)
(
hash
^
(
hash
>>
32
));
}
}
static
bool
static
bool
...
...
This diff is collapsed.
Click to expand it.
src/meson.build
+
8
−
4
View file @
19632a39
# SPDX-FileCopyrightText: 2018-2020 Bruce Cowan <bruce@bcowan.me.uk>
# SPDX-FileCopyrightText: 2018-2022 Bruce Cowan <bruce@bcowan.me.uk>
#
# SPDX-License-Identifier: CC0-1.0
# SPDX-License-Identifier: CC0-1.0
executable
(
'add'
,
'add.c'
,
dependencies
:
utils_dep
)
executable
(
'add'
,
'add.c'
,
dependencies
:
utils_dep
)
...
@@ -15,7 +16,6 @@ executable('fixed-sizeof', 'fixed-sizeof.c')
...
@@ -15,7 +16,6 @@ executable('fixed-sizeof', 'fixed-sizeof.c')
executable
(
'fgets'
,
'fgets.c'
)
executable
(
'fgets'
,
'fgets.c'
)
executable
(
'gcd'
,
'gcd.c'
)
executable
(
'gcd'
,
'gcd.c'
)
executable
(
'getchar'
,
'getchar.c'
)
executable
(
'getchar'
,
'getchar.c'
)
executable
(
'hashtable-test'
,
'hashtable-test.c'
,
dependencies
:
utils_dep
)
executable
(
'kepler'
,
'kepler.c'
,
dependencies
:
libm
)
executable
(
'kepler'
,
'kepler.c'
,
dependencies
:
libm
)
executable
(
'list-test'
,
'list-test.c'
,
dependencies
:
utils_dep
)
executable
(
'list-test'
,
'list-test.c'
,
dependencies
:
utils_dep
)
executable
(
'next'
,
'next.c'
,
dependencies
:
libm
)
executable
(
'next'
,
'next.c'
,
dependencies
:
libm
)
...
@@ -38,9 +38,13 @@ if host_machine.cpu_family() == 'x86_64' and cc.has_function_attribute('ifunc')
...
@@ -38,9 +38,13 @@ if host_machine.cpu_family() == 'x86_64' and cc.has_function_attribute('ifunc')
endif
endif
if
openmp_dep
.
found
()
if
openmp_dep
.
found
()
subdir
(
'openmp'
)
subdir
(
'openmp'
)
endif
endif
if
thread_dep
.
found
()
if
thread_dep
.
found
()
subdir
(
'pthread'
)
subdir
(
'pthread'
)
endif
if
xxhash_dep
.
found
()
executable
(
'hashtable-test'
,
'hashtable-test.c'
,
dependencies
:
[
utils_dep
,
xxhash_dep
])
endif
endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment