From: Ralph Corderoy Date: Mon, 24 Apr 2017 21:08:09 +0000 (+0100) Subject: sbr/vector.c: Replace Nbby with 's CHAR_BIT. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/28bf8af2f50b353b5702b8c9214d4106f998c638 sbr/vector.c: Replace Nbby with 's CHAR_BIT. POSIX mandates CHAR_BIT is 8; see stdint.h(0p). --- diff --git a/h/mh.h b/h/mh.h index 79a230b0..b15bd328 100644 --- a/h/mh.h +++ b/h/mh.h @@ -10,7 +10,6 @@ #define OK 0 /* ditto on success */ #define DONE 1 /* trinary logic */ #define ALL "" -#define Nbby 8 /* number of bits/byte */ #define MAXARGS 1000 /* max arguments to exec */ #define NFOLDERS 1000 /* max folder arguments on command line */ diff --git a/sbr/vector.c b/sbr/vector.c index fc5cc00d..f0c8bb4c 100644 --- a/sbr/vector.c +++ b/sbr/vector.c @@ -27,11 +27,8 @@ * constants in the code below must also be changed to a 1 that's at * least as wide as the new type. */ -#ifndef Nbby -# define Nbby 8 -#endif -#define BVEC_WORD(vec, max) ((max) / (sizeof *vec->bits * Nbby)) -#define BVEC_OFFSET(vec, max) ((max) % (sizeof *vec->bits * Nbby)) +#define BVEC_WORD(vec, max) ((max) / (sizeof *vec->bits * CHAR_BIT)) +#define BVEC_OFFSET(vec, max) ((max) % (sizeof *vec->bits * CHAR_BIT)) #define BVEC_BYTES(vec, n) \ ((BVEC_WORD (vec, n) + (BVEC_OFFSET (vec, n) == 0 ? 0 : 1)) * \ sizeof *vec->bits) @@ -52,7 +49,7 @@ bvector_create (size_t init_size) { bytes = BVEC_BYTES (vec, init_size ? init_size : VEC_INIT_SIZE); vec->bits = mh_xcalloc (1, bytes); - vec->maxsize = bytes * Nbby; + vec->maxsize = bytes * CHAR_BIT; return vec; }