Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using SIZEOF_VOID_P, remove unsused SYS_IS_CYGWIN32 #502

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ case $host_os in
* ) CYGWIN=no;;
esac
AM_CONDITIONAL([SYS_IS_CYGWIN], [test "$CYGWIN" = "yes"])
if test "$CYGWIN" = "yes"; then
AC_DEFINE(SYS_IS_CYGWIN32, 1, are we on CYGWIN?)
else
AC_DEFINE(SYS_IS_CYGWIN32, 0, are we on CYGWIN?)
fi

dnl ## User setting: Debug mode (off by default)
AC_ARG_ENABLE([debug],
Expand Down
2 changes: 1 addition & 1 deletion src/bitarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef UInt Block;
#define MAXVERTS 512
#endif

#if SIZEOF_VOID_P == 8
#if SYS_IS_64_BIT
// To avoid division and mod
static size_t const NR_BLOCKS_LOOKUP[MAXVERTS + 1] = {
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Expand Down
6 changes: 1 addition & 5 deletions src/homos.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,8 @@
} \
}

#if SIZEOF_VOID_P == 4 && DIGRAPHS_HAVE___BUILTIN_CTZLL
#undef DIGRAPHS_HAVE___BUILTIN_CTZLL
#endif

// The following macro is bitmap_decode_ctz_callpack from https://git.io/fho4p
#ifdef DIGRAPHS_HAVE___BUILTIN_CTZLL
#if SYS_IS_64_BIT && defined(DIGRAPHS_HAVE___BUILTIN_CTZLL)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should point out that this check (and also the one it replaces) does not seem to fit the code it wraps 100%: I think what you really need to check is whether sizeof(unsigned long long) == 8, and then use unsigned long long instead of uin64_t below (as uint64_t may be long, not long long, which is technically a different type, even if it has the same size as long). Anyway, it probably doesn't matter in practice on most systems, and I didn't want to make a semantic change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean, I'd be happy to accept a PR that made this change, or to make this change myself.

#define FOR_SET_BITS(__bit_array, __nr_bits, __variable) \
for (size_t k = 0; k < NR_BLOCKS_LOOKUP[__nr_bits]; ++k) { \
Block block = __bit_array->blocks[k]; \
Expand Down
7 changes: 2 additions & 5 deletions src/perms.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@
#define MAXVERTS 512
#define UNDEFINED MAXVERTS + 1

#if SIZEOF_VOID_P == 8
#define SMALLINTLIMIT 1152921504606846976
#else
#define SMALLINTLIMIT 268435456
#endif
// smallest positive integer that doesn't fit into a small integer object
#define SMALLINTLIMIT (INT_INTOBJ_MAX + 1)

typedef uint16_t* Perm;

Expand Down