Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1include_guard(GLOBAL)3include(CheckCXXSourceCompiles)4include(CMakePushCheckState)5cmake_push_check_state(RESET)7# Check for clmul instructions support.8if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")9set(CMAKE_REQUIRED_FLAGS "-mpclmul")10endif()11check_cxx_source_compiles("12#include <immintrin.h>13#include <stdint.h>15int main()16{17__m128i a = _mm_cvtsi64_si128((uint64_t)7);18__m128i b = _mm_clmulepi64_si128(a, a, 37);19__m128i c = _mm_srli_epi64(b, 41);20__m128i d = _mm_xor_si128(b, c);21uint64_t e = _mm_cvtsi128_si64(d);22return e == 0;23}24" HAVE_CLMUL25)26if(HAVE_CLMUL)27set(CLMUL_CXXFLAGS ${CMAKE_REQUIRED_FLAGS})28endif()30if(CMAKE_CXX_STANDARD LESS 20)31# Check for working clz builtins.32check_cxx_source_compiles("33int main()34{35unsigned a = __builtin_clz(1);36unsigned long b = __builtin_clzl(1);37unsigned long long c = __builtin_clzll(1);38}39" HAVE_CLZ40)41endif()43cmake_pop_check_state()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.