From bc8a6dd2e35d644eb4e964a015b7b426f1870e3a Mon Sep 17 00:00:00 2001 From: John Keiser Date: Sat, 1 Aug 2020 14:42:38 -0700 Subject: [PATCH] Remove dead code --- src/arm64/bitmanipulation.h | 11 ----------- src/fallback/bitmanipulation.h | 36 ---------------------------------- src/haswell/bitmanipulation.h | 17 ---------------- src/westmere/bitmanipulation.h | 17 ---------------- 4 files changed, 81 deletions(-) diff --git a/src/arm64/bitmanipulation.h b/src/arm64/bitmanipulation.h index e0d380e7e..727ef7456 100644 --- a/src/arm64/bitmanipulation.h +++ b/src/arm64/bitmanipulation.h @@ -55,17 +55,6 @@ really_inline bool add_overflow(uint64_t value1, uint64_t value2, uint64_t *resu #endif } -#if 0 // Currently unused -really_inline bool mul_overflow(uint64_t value1, uint64_t value2, uint64_t *result) { -#ifdef SIMDJSON_REGULAR_VISUAL_STUDIO - *result = value1 * value2; - return !!__umulh(value1, value2); -#else - return __builtin_umulll_overflow(value1, value2, (unsigned long long *)result); -#endif -} -#endif // Currently unused - } // namespace arm64 } // namespace { diff --git a/src/fallback/bitmanipulation.h b/src/fallback/bitmanipulation.h index ab223bb3f..ad6c0749c 100644 --- a/src/fallback/bitmanipulation.h +++ b/src/fallback/bitmanipulation.h @@ -24,29 +24,6 @@ static unsigned char _BitScanReverse64(unsigned long* ret, uint64_t x) { } #endif -// -// These are currently unused, but one day will be. -// -#if 0 // Currently unused -NO_SANITIZE_UNDEFINED -really_inline int trailing_zeroes(uint64_t input_num) { -#ifdef _MSC_VER - unsigned long ret; - // Search the mask data from least significant bit (LSB) - // to the most significant bit (MSB) for a set bit (1). - _BitScanForward64(&ret, input_num); - return (int)ret; -#else // _MSC_VER - return __builtin_ctzll(input_num); -#endif // _MSC_VER -} - -/* result might be undefined when input_num is zero */ -really_inline uint64_t clear_lowest_bit(uint64_t input_num) { - return input_num & (input_num-1); -} -#endif // Currently unused - /* result might be undefined when input_num is zero */ really_inline int leading_zeroes(uint64_t input_num) { #ifdef _MSC_VER @@ -62,19 +39,6 @@ really_inline int leading_zeroes(uint64_t input_num) { #endif// _MSC_VER } -#if 0 // Currently unused -really_inline bool add_overflow(uint64_t value1, uint64_t value2, uint64_t *result) { - *result = value1 + value2; - return *result < value1; -} - -really_inline bool mul_overflow(uint64_t value1, uint64_t value2, uint64_t *result) { - *result = value1 * value2; - // TODO there must be a faster way - return value2 > 0 && value1 > std::numeric_limits::max() / value2; -} -#endif // Currently unused - } // namespace fallback } // namespace { diff --git a/src/haswell/bitmanipulation.h b/src/haswell/bitmanipulation.h index e7b0769c4..dc032b360 100644 --- a/src/haswell/bitmanipulation.h +++ b/src/haswell/bitmanipulation.h @@ -53,23 +53,6 @@ really_inline bool add_overflow(uint64_t value1, uint64_t value2, #endif } -#if 0 // Currently unused -#if defined(SIMDJSON_REGULAR_VISUAL_STUDIO) || defined(SIMDJSON_IS_32BITS) -#pragma intrinsic(_umul128) -#endif -really_inline bool mul_overflow(uint64_t value1, uint64_t value2, - uint64_t *result) { -#ifdef SIMDJSON_REGULAR_VISUAL_STUDIO - uint64_t high; - *result = _umul128(value1, value2, &high); - return high; -#else - return __builtin_umulll_overflow(value1, value2, - (unsigned long long *)result); -#endif -} -#endif // Currently unused - } // namespace SIMDJSON_IMPLEMENTATION } // namespace { diff --git a/src/westmere/bitmanipulation.h b/src/westmere/bitmanipulation.h index d221f971b..63e12691c 100644 --- a/src/westmere/bitmanipulation.h +++ b/src/westmere/bitmanipulation.h @@ -62,23 +62,6 @@ really_inline bool add_overflow(uint64_t value1, uint64_t value2, #endif } -#if 0 // Currently unused -#if defined(SIMDJSON_REGULAR_VISUAL_STUDIO) || defined(SIMDJSON_IS_32BITS) -#pragma intrinsic(_umul128) -#endif -really_inline bool mul_overflow(uint64_t value1, uint64_t value2, - uint64_t *result) { -#ifdef SIMDJSON_REGULAR_VISUAL_STUDIO - uint64_t high; - *result = _umul128(value1, value2, &high); - return high; -#else - return __builtin_umulll_overflow(value1, value2, - (unsigned long long *)result); -#endif -} -#endif // Currently unused - } // namespace SIMDJSON_IMPLEMENTATION } // namespace {