Skip to content
This repository has been archived by the owner on Dec 13, 2017. It is now read-only.

ensure 64bit type for bitfield #2

Merged
merged 1 commit into from Jan 14, 2016
Merged

ensure 64bit type for bitfield #2

merged 1 commit into from Jan 14, 2016

Conversation

satta
Copy link
Contributor

@satta satta commented Jan 13, 2016

size_t is not guaranteed to be >= 64 bit in length. However, this is expected in kdq.h:

#define __KDQ_TYPE(type) \
    typedef struct { \
        size_t front:58, bits:6, count, mask; \
        type *a; \
    } kdq_##type##_t;

This patch fixes building minimap on architectures where it's generally less (i.e. '32-bit' platforms), where otherwise:

$ uname -m
i686
$ make
gcc -c -g -Wall -O2 -Wc++-compat -Wno-unused-function  -I. main.c -o main.o
gcc -c -g -Wall -O2 -Wc++-compat -Wno-unused-function  -I. kthread.c -o kthread.o
gcc -c -g -Wall -O2 -Wc++-compat -Wno-unused-function  -I. misc.c -o misc.o
gcc -c -g -Wall -O2 -Wc++-compat -Wno-unused-function  -I. bseq.c -o bseq.o
gcc -c -g -Wall -O2 -Wc++-compat -Wno-unused-function  -I. sketch.c -o sketch.o
gcc -c -g -Wall -O2 -Wc++-compat -Wno-unused-function  -I. sdust.c -o sdust.o
sdust.c:20:1: error: width of ‘front’ exceeds its type
make: *** [sdust.o] Error 1

size_t is not guaranteed to be >= 64 bit in length. This fixes
building minimap on architectures where it's generally less (i.e.
32-bit platforms).
lh3 added a commit that referenced this pull request Jan 14, 2016
ensure 64bit type for bitfield
@lh3 lh3 merged commit 1cd6ae3 into lh3:master Jan 14, 2016
@satta satta deleted the ensure_64bit_field branch January 14, 2016 00:30
@lh3
Copy link
Owner

lh3 commented Jan 14, 2016

Thanks. But probably minimap/miniasm won't work on 32-bit systems anyway.

@satta
Copy link
Contributor Author

satta commented Jan 14, 2016

I can add a build time test to run on Debian's buildd machines. They carry quite a variety of architectures. Can you suggest a small but non-trivial test case? I tried a very simple case (Leishmania major chromosome 1 with a bunch of artificial 'reads' sampled from it) and it worked fine on i686. I suspect problems will only appear once reference or query lengths go beyond 32-bit uints?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants