diff options
Diffstat (limited to 'src/libstddjb')
-rw-r--r-- | src/libstddjb/bitarray_count.c | 5 | ||||
-rw-r--r-- | src/libstddjb/buffer_get.c | 2 | ||||
-rw-r--r-- | src/libstddjb/selfpipe_read.c | 4 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/libstddjb/bitarray_count.c b/src/libstddjb/bitarray_count.c index 8f4ab50..19ed09e 100644 --- a/src/libstddjb/bitarray_count.c +++ b/src/libstddjb/bitarray_count.c @@ -1,7 +1,6 @@ /* ISC license. */ #include <sys/types.h> -#include <skalibs/uint64.h> #include <skalibs/bitarray.h> #define B0(n) n, n+1, n+1, n+2 @@ -9,11 +8,11 @@ #define B2(n) B1(n), B1(n+1), B1(n+1), B1(n+2) #define B3(n) B2(n), B2(n+1), B2(n+1), B2(n+2) -uint64_t bitarray_countones (unsigned char const *c, size_t n) +size_t bitarray_countones (unsigned char const *c, size_t n) { static unsigned char const table[256] = { B3(0) } ; size_t len = bitarray_div8(n) ; - uint64_t total = 0 ; + size_t total = 0 ; size_t i = 0 ; if (n & 7) len-- ; for (; i < len ; i++) total += table[c[i]] ; diff --git a/src/libstddjb/buffer_get.c b/src/libstddjb/buffer_get.c index 0d689ef..bf01012 100644 --- a/src/libstddjb/buffer_get.c +++ b/src/libstddjb/buffer_get.c @@ -8,6 +8,6 @@ ssize_t buffer_get (buffer *b, char *s, size_t len) { size_t w = 0 ; int r = buffer_getall(b, s, len, &w) ; - return r == -1 ? errno == EPIPE ? (errno = 0, (ssize_t)w) : -1 : + return r == -1 ? errno == EPIPE ? (errno = 0, w) : -1 : !r ? (errno = EWOULDBLOCK, -1) : w ; } diff --git a/src/libstddjb/selfpipe_read.c b/src/libstddjb/selfpipe_read.c index b31c6bd..92adf02 100644 --- a/src/libstddjb/selfpipe_read.c +++ b/src/libstddjb/selfpipe_read.c @@ -16,7 +16,7 @@ int selfpipe_read (void) { struct signalfd_siginfo buf ; ssize_t r = sanitize_read(fd_read(selfpipe_fd, (char *)&buf, sizeof(struct signalfd_siginfo))) ; - return (r <= 0) ? r : (int)buf.ssi_signo ; + return (r <= 0) ? r : buf.ssi_signo ; } #else @@ -25,7 +25,7 @@ int selfpipe_read (void) { char c ; ssize_t r = sanitize_read((fd_read(selfpipe_fd, &c, 1))) ; - return (r <= 0) ? r : (int)c ; + return (r <= 0) ? r : c ; } #endif |