# ---------------------------------------------------------------------------
CONFIG =
-LDFLGS =
+LDFLGS = -lpthread
CFLAGS = -I$(SUBDIR_LIB)/include -std=gnu99 -Wall
ifneq ($(CPU),0)
SUFFIX :=
endif
-ifneq ($(MACHINE),$(filter %mingw32 %-windows-gnu,$(MACHINE)))
- LDFLGS += -lpthread
+ifeq ($(THREAD),0)
+ CFLAGS += -DSLUNKBUILD_NOTHREADS
endif
ifneq ($(STRIP),0)
LDFLGS += -mconsole -municode
endif
-ifeq ($(THREAD),0)
- CFLAGS += -DSLUNKBUILD_NOTHREADS
-endif
-
# ---------------------------------------------------------------------------
# File names
# ---------------------------------------------------------------------------
* **Linux** (kernel version 3.17, or later) — 32-Bit (i686) and 64-Bit (AMD64)
* **Various BSD flavors** (tested on NetBSD 9.2, FreeBSD 13.0 and OpenBSD 7.0) — 32-Bit (i686) and 64-Bit (AMD64)
* **Solaris** (tested on Solaris 11.4 and OmniOS/illumos) — 32-Bit (i686) and 64-Bit (AMD64)
+* **GNU/Hurd** (tested on Debian GNU/Hurd 0.9) — 32-Bit (i686)
* **Mac OS X** (tested on macOS 11 “Big Sur”) — Intel x86-64 (AMD64) and Apple Silicon (AArch64)
The SlunkCrypt GUI application currently runs on the following platforms:
# define OS_TYPE_NAME "Cygwin"
#elif defined(__linux__)
# define OS_TYPE_NAME "Linux"
+#elif defined(__gnu_hurd__)
+# define OS_TYPE_NAME "GNU/Hurd"
#elif defined(__FreeBSD__)
# define OS_TYPE_NAME "FreeBSD"
#elif defined(__DragonFly__)
// 128-Bit math support
// ==========================================================================
-#define READ_U128(X) ((((__uint128_t)(X).hi) << 64U) | ((__uint128_t)(X).lo))
+#if defined(__GNUC__) && defined(__SIZEOF_INT128__)
+# define HAVE_UINT128_SUPPORT 1
+# define PACK_U128(X) ((((__uint128_t)(X).hi) << 64) | (X).lo)
+#endif
static INLINE void multiply_u128(uint128_t *const out, const uint128_t lhs, const uint128_t rhs)
{
-#if defined(__GNUC__) && defined(__SIZEOF_INT128__)
- const __uint128_t tmp = READ_U128(lhs) * READ_U128(rhs);
- out->hi = (uint64_t)(tmp >> 64U);
- out->lo = (uint64_t)(tmp & 0xFFFFFFFFFFFFFFFF);
+#ifdef HAVE_UINT128_SUPPORT
+ const __uint128_t product = PACK_U128(lhs) * PACK_U128(rhs);
+ *out = (uint128_t) { product >> 64, product };
#else
const uint64_t lolo = (lhs.lo & 0xFFFFFFFF) * (rhs.lo & 0xFFFFFFFF);
const uint64_t hilo = (lhs.lo >> 32U) * (rhs.lo & 0xFFFFFFFF);