Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
97648992
Commit
97648992
authored
Apr 02, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hash: use config.h settings for endian.
Leave old hacky #ifdef tests there for reference.
parent
0a36c401
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
ccan/hash/hash.c
ccan/hash/hash.c
+13
-2
ccan/hash/hash.h
ccan/hash/hash.h
+1
-1
No files found.
ccan/hash/hash.c
View file @
97648992
...
...
@@ -40,9 +40,7 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
#include <time.h> /* defines time_t for timings in the test */
#include <stdint.h> /* defines uint32_t etc */
#include <sys/param.h> /* attempt to define endianness */
#endif
#include "hash.h"
#ifdef linux
# include <endian.h> /* attempt to define endianness */
#endif
...
...
@@ -66,6 +64,19 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
#else
# error Unknown endian
#endif
#endif
/* old hash.c headers. */
#include "hash.h"
#if HAVE_LITTLE_ENDIAN
#define HASH_LITTLE_ENDIAN 1
#define HASH_BIG_ENDIAN 0
#elif HAVE_BIG_ENDIAN
#define HASH_LITTLE_ENDIAN 0
#define HASH_BIG_ENDIAN 1
#else
#error Unknown endian
#endif
#define hashsize(n) ((uint32_t)1<<(n))
#define hashmask(n) (hashsize(n)-1)
...
...
ccan/hash/hash.h
View file @
97648992
#ifndef CCAN_HASH_H
#define CCAN_HASH_H
#include "config.h"
#include <stdint.h>
#include <stdlib.h>
#include "config.h"
#include <ccan/build_assert/build_assert.h>
/* Stolen mostly from: lookup3.c, by Bob Jenkins, May 2006, Public Domain.
...
...
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