projects
/
enwiki-links-graph.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8988827
)
Generalise bitfield fully
author
norly
<ny-git@enpas.org>
Sun, 14 Jul 2019 12:46:57 +0000
(14:46 +0200)
committer
norly
<ny-git@enpas.org>
Sun, 14 Jul 2019 12:57:19 +0000
(14:57 +0200)
lookup-incoming.c
patch
|
blob
|
history
diff --git
a/lookup-incoming.c
b/lookup-incoming.c
index 8223feb5618e72d77a3cadeb2689beb3ebd605b4..da21f4433ba55fb6eac462caa6f83ca94531dddf 100644
(file)
--- a/
lookup-incoming.c
+++ b/
lookup-incoming.c
@@
-10,11
+10,13
@@
typedef __uint32_t bitfield_type;
typedef __uint32_t bitfield_type;
+#define BITS_PER_BITFIELD 32
+#define BITS_PER_BITFIELD_LOG 5
#define BIT_SET(set, d) \
#define BIT_SET(set, d) \
- ( (void) ( set[d >>
5] |= (1 << (d & 31
)) ) )
+ ( (void) ( set[d >>
BITS_PER_BITFIELD_LOG] |= (1 << (d & (BITS_PER_BITFIELD-1)
)) ) )
#define BIT_ISSET(set, d) \
#define BIT_ISSET(set, d) \
- (!(! ( set[d >>
5] & (1 << (d & 31
)) ) ))
+ (!(! ( set[d >>
BITS_PER_BITFIELD_LOG] & (1 << (d & (BITS_PER_BITFIELD-1)
)) ) ))
int ANY_BITS_SET(bitfield_type *set, size_t elems)
{
int ANY_BITS_SET(bitfield_type *set, size_t elems)
{
@@
-191,7
+193,7
@@
int main(int argc, char **argv)
printf("\n\n\n\nBuilding table of distances...\n\n");
printf("\n\n\n\nBuilding table of distances...\n\n");
- titles_bitfield_elems = ROUNDUP(titles /
8 / sizeof(bitfield_type), sizeof(bitfield_type)
);
+ titles_bitfield_elems = ROUNDUP(titles /
BITS_PER_BITFIELD, BITS_PER_BITFIELD
);
titles_bitfield_bytes = titles_bitfield_elems * sizeof(bitfield_type);
titles_seen = calloc(titles_bitfield_bytes, 1);
titles_bitfield_bytes = titles_bitfield_elems * sizeof(bitfield_type);
titles_seen = calloc(titles_bitfield_bytes, 1);