Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libcrc32c for openSUSE:Factory checked in at 2022-08-01 21:31:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libcrc32c (Old) and /work/SRC/openSUSE:Factory/.libcrc32c.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libcrc32c" Mon Aug 1 21:31:59 2022 rev:2 rq:991737 version:1.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libcrc32c/libcrc32c.changes 2021-06-07 22:44:52.644624642 +0200 +++ /work/SRC/openSUSE:Factory/.libcrc32c.new.1533/libcrc32c.changes 2022-08-01 21:32:43.870057923 +0200 @@ -1,0 +2,7 @@ +Fri Jul 29 14:08:36 UTC 2022 - Callum Farmer <gm...@opensuse.org> + +- Update to 1.1.2: + * Fix (unused) ReadUint64LE for BE machines + * Remove unnecessary reinterpret_cast + +------------------------------------------------------------------- Old: ---- crc32c-1.1.1.tar.gz New: ---- crc32c-1.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libcrc32c.spec ++++++ --- /var/tmp/diff_new_pack.zPzZ8Z/_old 2022-08-01 21:32:44.418059496 +0200 +++ /var/tmp/diff_new_pack.zPzZ8Z/_new 2022-08-01 21:32:44.426059518 +0200 @@ -1,7 +1,7 @@ # # spec file for package libcrc32c # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,16 +16,16 @@ # -%define packagename crc32c +%define rname crc32c %define soname 1 Name: libcrc32c -Version: 1.1.1 +Version: 1.1.2 Release: 0 Summary: CRC32C implementation with support for CPU-specific acceleration instructions License: BSD-3-Clause Group: Development/Libraries/C and C++ URL: https://github.com/google/crc32c -Source: https://github.com/google/crc32c/archive/refs/tags/%{version}.tar.gz#/crc32c-%{version}.tar.gz +Source: %{url}/archive/%{version}/%{rname}-%{version}.tar.gz BuildRequires: cmake BuildRequires: gcc-c++ @@ -50,7 +50,7 @@ The polynomial was introduced by G. Castagnoli, S. Braeuer and M. Herrmann. %package -n %{name}-devel -Summary: C++ header files and library symbolic links for %{packagename} +Summary: C++ header files and library symbolic links for %{rname} Group: Development/Libraries/C and C++ Requires: %{name}%{soname} = %{version} @@ -60,7 +60,7 @@ you will need to install %{name}-devel. %prep -%autosetup -n %{packagename}-%{version} +%autosetup -n %{rname}-%{version} %build %cmake -DCRC32C_BUILD_TESTS=0 -DCRC32C_BUILD_BENCHMARKS=0 -DCRC32C_USE_GLOG=0 @@ -79,7 +79,7 @@ %files -n %{name}-devel %doc AUTHORS CONTRIBUTING.md README.md -%{_includedir}/%{packagename} +%{_includedir}/%{rname} %{_libdir}/%{name}.so %{_libdir}/cmake/Crc32c ++++++ crc32c-1.1.1.tar.gz -> crc32c-1.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/.appveyor.yml new/crc32c-1.1.2/.appveyor.yml --- old/crc32c-1.1.1/.appveyor.yml 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/.appveyor.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -# Build matrix / environment variables are explained on: -# https://www.appveyor.com/docs/appveyor-yml/ -# This file can be validated on: https://ci.appveyor.com/tools/validate-yaml - -version: "{build}" - -environment: - matrix: - # AppVeyor currently has no custom job name feature. - # http://help.appveyor.com/discussions/questions/1623-can-i-provide-a-friendly-name-for-jobs - - JOB: Visual Studio 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: Visual Studio 16 2019 - -platform: - - x86 - - x64 - -configuration: - - RelWithDebInfo - - Debug - -build_script: - - git submodule update --init --recursive - - mkdir build - - cd build - - if "%platform%"=="x86" (set CMAKE_GENERATOR_PLATFORM="Win32") - else (set CMAKE_GENERATOR_PLATFORM="%platform%") - - cmake --version - - cmake .. -G "%CMAKE_GENERATOR%" -A "%CMAKE_GENERATOR_PLATFORM%" - -DCMAKE_CONFIGURATION_TYPES="%CONFIGURATION%" -DCRC32C_USE_GLOG=0 - - cmake --build . --config "%CONFIGURATION%" - - cd .. - -test_script: - - build\%CONFIGURATION%\crc32c_tests.exe - - build\%CONFIGURATION%\crc32c_capi_tests.exe - - build\%CONFIGURATION%\crc32c_bench.exe diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/.github/workflows/build.yml new/crc32c-1.1.2/.github/workflows/build.yml --- old/crc32c-1.1.1/.github/workflows/build.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/crc32c-1.1.2/.github/workflows/build.yml 2021-10-05 21:47:30.000000000 +0200 @@ -0,0 +1,102 @@ +# Copyright 2021 The CRC32C Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. See the AUTHORS file for names of contributors. + +name: ci +on: [push, pull_request] + +permissions: + contents: read + +jobs: + build-and-test: + name: >- + CI + ${{ matrix.os }} + ${{ matrix.compiler }} + ${{ matrix.optimized && 'release' || 'debug' }} + ${{ matrix.shared_lib && 'shared' || 'static' }} + ${{ matrix.use_glog && 'glog' || 'no-glog' }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + compiler: [clang, gcc, msvc] + os: [ubuntu-latest, macos-latest, windows-latest] + optimized: [true, false] + shared_lib: [true, false] + use_glog: [true, false] + exclude: + # Our glog config doesn't work with shared libraries. + - use_glog: true + shared_lib: true + # MSVC only works on Windows. + - os: ubuntu-latest + compiler: msvc + - os: macos-latest + compiler: msvc + # Not testing with GCC on macOS. + - os: macos-latest + compiler: gcc + # Only testing with MSVC on Windows. + - os: windows-latest + compiler: clang + - os: windows-latest + compiler: gcc + # Not testing fringe configurations (glog, shared libraries) on Windows. + - os: windows-latest + use_glog: true + - os: windows-latest + shared_lib: true + include: + - compiler: clang + CC: clang + CXX: clang++ + - compiler: gcc + CC: gcc + CXX: g++ + - compiler: msvc + CC: + CXX: + + env: + CMAKE_BUILD_DIR: ${{ github.workspace }}/build + CMAKE_BUILD_TYPE: ${{ matrix.optimized && 'RelWithDebInfo' || 'Debug' }} + CC: ${{ matrix.CC }} + CXX: ${{ matrix.CXX }} + BINARY_SUFFIX: ${{ startsWith(matrix.os, 'windows') && '.exe' || '' }} + BINARY_PATH: >- + ${{ format( + startsWith(matrix.os, 'windows') && '{0}\build\{1}\' || '{0}/build/', + github.workspace, + matrix.optimized && 'RelWithDebInfo' || 'Debug') }} + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Generate build config + run: >- + cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" + -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} + -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/install_test/ + -DBUILD_SHARED_LIBS=${{ matrix.shared_lib && '1' || '0' }} + -DCRC32C_USE_GLOG=${{ matrix.use_glog && '1' || '0' }} + + - name: Build + run: >- + cmake --build "${{ env.CMAKE_BUILD_DIR }}" + --config "${{ env.CMAKE_BUILD_TYPE }}" + + - name: Run C++ API Tests + run: ${{ env.BINARY_PATH }}crc32c_tests${{ env.BINARY_SUFFIX }} + + - name: Run C API Tests + run: ${{ env.BINARY_PATH }}crc32c_capi_tests${{ env.BINARY_SUFFIX }} + + - name: Run Benchmarks + run: ${{ env.BINARY_PATH }}crc32c_bench${{ env.BINARY_SUFFIX }} + + - name: Test CMake installation + run: cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/.gitignore new/crc32c-1.1.2/.gitignore --- old/crc32c-1.1.1/.gitignore 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/.gitignore 2021-10-05 21:47:30.000000000 +0200 @@ -1,6 +1,7 @@ # Editors. *.sw* .DS_Store +/.cache /.vscode # Build directory. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/.travis.yml new/crc32c-1.1.2/.travis.yml --- old/crc32c-1.1.1/.travis.yml 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,76 +0,0 @@ -# Build matrix / environment variables are explained on: -# http://about.travis-ci.org/docs/user/build-configuration/ -# This file can be validated on: http://lint.travis-ci.org/ - -language: cpp -dist: bionic -osx_image: xcode10.3 - -compiler: -- gcc -- clang -os: -- linux -- osx - -env: -- GLOG=1 SHARED_LIB=0 BUILD_TYPE=Debug -- GLOG=1 SHARED_LIB=0 BUILD_TYPE=RelWithDebInfo -- GLOG=0 SHARED_LIB=0 BUILD_TYPE=Debug -- GLOG=0 SHARED_LIB=0 BUILD_TYPE=RelWithDebInfo -- GLOG=0 SHARED_LIB=1 BUILD_TYPE=Debug -- GLOG=0 SHARED_LIB=1 BUILD_TYPE=RelWithDebInfo - -addons: - apt: - sources: - - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: - - clang-9 - - cmake - - gcc-9 - - g++-9 - - ninja-build - homebrew: - packages: - - cmake - - gcc@9 - - llvm@9 - - ninja - update: true - -install: -# The following Homebrew packages aren't linked by default, and need to be -# prepended to the path explicitly. -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then - export PATH="$(brew --prefix llvm)/bin:$PATH"; - fi -# /usr/bin/gcc points to an older compiler on both Linux and macOS. -- if [ "$CXX" = "g++" ]; then export CXX="g++-9" CC="gcc-9"; fi -# /usr/bin/clang points to an older compiler on both Linux and macOS. -# -# Homebrew's llvm package doesn't ship a versioned clang++ binary, so the values -# below don't work on macOS. Fortunately, the path change above makes the -# default values (clang and clang++) resolve to the correct compiler on macOS. -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then - if [ "$CXX" = "clang++" ]; then export CXX="clang++-9" CC="clang-9"; fi; - fi -- echo ${CC} -- echo ${CXX} -- ${CXX} --version -- cmake --version - -before_script: -- mkdir -p build && cd build -- cmake .. -G Ninja -DCRC32C_USE_GLOG=$GLOG -DCMAKE_BUILD_TYPE=$BUILD_TYPE - -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_INSTALL_PREFIX=$HOME/.local -- cmake --build . -- cd .. - -script: -- build/crc32c_tests -- build/crc32c_capi_tests -- build/crc32c_bench -- cd build && cmake --build . --target install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/.ycm_extra_conf.py new/crc32c-1.1.2/.ycm_extra_conf.py --- old/crc32c-1.1.1/.ycm_extra_conf.py 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/.ycm_extra_conf.py 2021-10-05 21:47:30.000000000 +0200 @@ -4,10 +4,10 @@ """YouCompleteMe configuration that interprets a .clang_complete file. This module implementes the YouCompleteMe configuration API documented at: -https://github.com/Valloric/ycmd#ycm_extra_confpy-specification +https://github.com/ycm-core/ycmd#ycm_extra_confpy-specification The implementation loads and processes a .clang_complete file, documented at: -https://github.com/Rip-Rip/clang_complete/blob/master/README.md +https://github.com/xavierd/clang_complete/blob/master/README.md """ import os diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/AUTHORS new/crc32c-1.1.2/AUTHORS --- old/crc32c-1.1.1/AUTHORS 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/AUTHORS 2021-10-05 21:47:30.000000000 +0200 @@ -7,3 +7,5 @@ Fangming Fang <fangming.f...@arm.com> Vadim Skipin <vadim.ski...@gmail.com> +Rodrigo Tobar <rto...@icrar.org> +Harry Mallon <hjmal...@gmail.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/CMakeLists.txt new/crc32c-1.1.2/CMakeLists.txt --- old/crc32c-1.1.1/CMakeLists.txt 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/CMakeLists.txt 2021-10-05 21:47:30.000000000 +0200 @@ -275,7 +275,7 @@ PRIVATE "${PROJECT_BINARY_DIR}/include/crc32c/crc32c_config.h" "src/crc32c_arm64.h" - "src/crc32c_arm64_linux_check.h" + "src/crc32c_arm64_check.h" "src/crc32c_internal.h" "src/crc32c_portable.cc" "src/crc32c_prefetch.h" @@ -362,6 +362,12 @@ # Warnings as errors in Visual Studio for this project's targets. if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set_property(TARGET crc32c_capi_tests APPEND PROPERTY COMPILE_OPTIONS "/WX") + + # The Windows SDK version currently on CI produces warnings when some + # headers are #included using C99 compatibity mode or above. This workaround + # can be removed once the Windows SDK on our CI is upgraded. + set_property(TARGET crc32c_capi_tests + APPEND PROPERTY COMPILE_OPTIONS "/wd5105") endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_test(NAME crc32c_capi_tests COMMAND crc32c_capi_tests) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/README.md new/crc32c-1.1.2/README.md --- old/crc32c-1.1.1/README.md 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/README.md 2021-10-05 21:47:30.000000000 +0200 @@ -1,7 +1,6 @@ # CRC32C -[](https://travis-ci.org/google/crc32c) -[](https://ci.appveyor.com/project/pwnall/crc32c) +[](https://github.com/google/crc32c/actions/workflows/build.yml) New file format authors should consider [HighwayHash](https://github.com/google/highwayhash). The initial version of @@ -65,7 +64,7 @@ If you don't mind more setup in return for more speed, replace `autocomplete-clang` and `linter-clang` with `you-complete-me`. This requires -[setting up ycmd](https://github.com/Valloric/ycmd#building). +[setting up ycmd](https://github.com/ycm-core/ycmd#building). ```bash apm install autocomplete-plus build build-cmake clang-format language-cmake \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/src/crc32c.cc new/crc32c-1.1.2/src/crc32c.cc --- old/crc32c-1.1.1/src/crc32c.cc 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/src/crc32c.cc 2021-10-05 21:47:30.000000000 +0200 @@ -8,7 +8,7 @@ #include <cstdint> #include "./crc32c_arm64.h" -#include "./crc32c_arm64_linux_check.h" +#include "./crc32c_arm64_check.h" #include "./crc32c_internal.h" #include "./crc32c_sse42.h" #include "./crc32c_sse42_check.h" @@ -20,8 +20,8 @@ static bool can_use_sse42 = CanUseSse42(); if (can_use_sse42) return ExtendSse42(crc, data, count); #elif HAVE_ARM64_CRC32C - static bool can_use_arm_linux = CanUseArm64Linux(); - if (can_use_arm_linux) return ExtendArm64(crc, data, count); + static bool can_use_arm64_crc32 = CanUseArm64Crc32(); + if (can_use_arm64_crc32) return ExtendArm64(crc, data, count); #endif // HAVE_SSE42 && (defined(_M_X64) || defined(__x86_64__)) return ExtendPortable(crc, data, count); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/src/crc32c_arm64.cc new/crc32c-1.1.2/src/crc32c_arm64.cc --- old/crc32c-1.1.1/src/crc32c_arm64.cc 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/src/crc32c_arm64.cc 2021-10-05 21:47:30.000000000 +0200 @@ -62,7 +62,7 @@ namespace crc32c { -uint32_t ExtendArm64(uint32_t crc, const uint8_t *buf, size_t size) { +uint32_t ExtendArm64(uint32_t crc, const uint8_t *data, size_t size) { int64_t length = size; uint32_t crc0, crc1, crc2, crc3; uint64_t t0, t1, t2; @@ -72,7 +72,6 @@ const poly64_t k0 = 0x8d96551c, k1 = 0xbd6f81f8, k2 = 0xdcb17aa4; crc = crc ^ kCRC32Xor; - const uint8_t *p = reinterpret_cast<const uint8_t *>(buf); while (length >= KBYTES) { crc0 = crc; @@ -81,14 +80,14 @@ crc3 = 0; // Process 1024 bytes in parallel. - CRC32C1024BYTES(p); + CRC32C1024BYTES(data); // Merge the 4 partial CRC32C values. t2 = (uint64_t)vmull_p64(crc2, k2); t1 = (uint64_t)vmull_p64(crc1, k1); t0 = (uint64_t)vmull_p64(crc0, k0); - crc = __crc32cd(crc3, *(uint64_t *)p); - p += sizeof(uint64_t); + crc = __crc32cd(crc3, *(uint64_t *)data); + data += sizeof(uint64_t); crc ^= __crc32cd(0, t2); crc ^= __crc32cd(0, t1); crc ^= __crc32cd(0, t0); @@ -97,23 +96,23 @@ } while (length >= 8) { - crc = __crc32cd(crc, *(uint64_t *)p); - p += 8; + crc = __crc32cd(crc, *(uint64_t *)data); + data += 8; length -= 8; } if (length & 4) { - crc = __crc32cw(crc, *(uint32_t *)p); - p += 4; + crc = __crc32cw(crc, *(uint32_t *)data); + data += 4; } if (length & 2) { - crc = __crc32ch(crc, *(uint16_t *)p); - p += 2; + crc = __crc32ch(crc, *(uint16_t *)data); + data += 2; } if (length & 1) { - crc = __crc32cb(crc, *p); + crc = __crc32cb(crc, *data); } return crc ^ kCRC32Xor; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/src/crc32c_arm64.h new/crc32c-1.1.2/src/crc32c_arm64.h --- old/crc32c-1.1.1/src/crc32c_arm64.h 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/src/crc32c_arm64.h 2021-10-05 21:47:30.000000000 +0200 @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -// Linux-specific code checking the availability for ARM CRC32C instructions. +// ARM-specific code -#ifndef CRC32C_CRC32C_ARM_LINUX_H_ -#define CRC32C_CRC32C_ARM_LINUX_H_ +#ifndef CRC32C_CRC32C_ARM_H_ +#define CRC32C_CRC32C_ARM_H_ #include <cstddef> #include <cstdint> @@ -22,4 +22,4 @@ #endif // HAVE_ARM64_CRC32C -#endif // CRC32C_CRC32C_ARM_LINUX_H_ +#endif // CRC32C_CRC32C_ARM_H_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/src/crc32c_arm64_check.h new/crc32c-1.1.2/src/crc32c_arm64_check.h --- old/crc32c-1.1.1/src/crc32c_arm64_check.h 1970-01-01 01:00:00.000000000 +0100 +++ new/crc32c-1.1.2/src/crc32c_arm64_check.h 2021-10-05 21:47:30.000000000 +0200 @@ -0,0 +1,66 @@ +// Copyright 2017 The CRC32C Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. See the AUTHORS file for names of contributors. + +// ARM-specific code checking for the availability of CRC32C instructions. + +#ifndef CRC32C_CRC32C_ARM_CHECK_H_ +#define CRC32C_CRC32C_ARM_CHECK_H_ + +#include <cstddef> +#include <cstdint> + +#include "crc32c/crc32c_config.h" + +#if HAVE_ARM64_CRC32C + +#ifdef __linux__ +#if HAVE_STRONG_GETAUXVAL +#include <sys/auxv.h> +#elif HAVE_WEAK_GETAUXVAL +// getauxval() is not available on Android until API level 20. Link it as a weak +// symbol. +extern "C" unsigned long getauxval(unsigned long type) __attribute__((weak)); + +#define AT_HWCAP 16 +#endif // HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL +#endif // defined (__linux__) + +#ifdef __APPLE__ +#include <sys/types.h> +#include <sys/sysctl.h> +#endif // defined (__APPLE__) + +namespace crc32c { + +inline bool CanUseArm64Crc32() { +#if defined (__linux__) && (HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL) + // From 'arch/arm64/include/uapi/asm/hwcap.h' in Linux kernel source code. + constexpr unsigned long kHWCAP_PMULL = 1 << 4; + constexpr unsigned long kHWCAP_CRC32 = 1 << 7; + unsigned long hwcap = +#if HAVE_STRONG_GETAUXVAL + // Some compilers warn on (&getauxval != nullptr) in the block below. + getauxval(AT_HWCAP); +#elif HAVE_WEAK_GETAUXVAL + (&getauxval != nullptr) ? getauxval(AT_HWCAP) : 0; +#else +#error This is supposed to be nested inside a check for HAVE_*_GETAUXVAL. +#endif // HAVE_STRONG_GETAUXVAL + return (hwcap & (kHWCAP_PMULL | kHWCAP_CRC32)) == + (kHWCAP_PMULL | kHWCAP_CRC32); +#elif defined(__APPLE__) + int val = 0; + size_t len = sizeof(val); + return sysctlbyname("hw.optional.armv8_crc32", &val, &len, nullptr, 0) == 0 + && val != 0; +#else + return false; +#endif // HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL +} + +} // namespace crc32c + +#endif // HAVE_ARM64_CRC32C + +#endif // CRC32C_CRC32C_ARM_CHECK_H_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/src/crc32c_arm64_linux_check.h new/crc32c-1.1.2/src/crc32c_arm64_linux_check.h --- old/crc32c-1.1.1/src/crc32c_arm64_linux_check.h 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/src/crc32c_arm64_linux_check.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,48 +0,0 @@ -// Copyright 2017 The CRC32C Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. See the AUTHORS file for names of contributors. - -// ARM Linux-specific code checking for the availability of CRC32C instructions. - -#ifndef CRC32C_CRC32C_ARM_LINUX_CHECK_H_ -#define CRC32C_CRC32C_ARM_LINUX_CHECK_H_ - -// X86-specific code checking for the availability of SSE4.2 instructions. - -#include <cstddef> -#include <cstdint> - -#include "crc32c/crc32c_config.h" - -#if HAVE_ARM64_CRC32C - -#if HAVE_STRONG_GETAUXVAL -#include <sys/auxv.h> -#elif HAVE_WEAK_GETAUXVAL -// getauxval() is not available on Android until API level 20. Link it as a weak -// symbol. -extern "C" unsigned long getauxval(unsigned long type) __attribute__((weak)); - -#define AT_HWCAP 16 -#endif // HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL - -namespace crc32c { - -inline bool CanUseArm64Linux() { -#if HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL - // From 'arch/arm64/include/uapi/asm/hwcap.h' in Linux kernel source code. - constexpr unsigned long kHWCAP_PMULL = 1 << 4; - constexpr unsigned long kHWCAP_CRC32 = 1 << 7; - unsigned long hwcap = (&getauxval != nullptr) ? getauxval(AT_HWCAP) : 0; - return (hwcap & (kHWCAP_PMULL | kHWCAP_CRC32)) == - (kHWCAP_PMULL | kHWCAP_CRC32); -#else - return false; -#endif // HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL -} - -} // namespace crc32c - -#endif // HAVE_ARM64_CRC32C - -#endif // CRC32C_CRC32C_ARM_LINUX_CHECK_H_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/src/crc32c_benchmark.cc new/crc32c-1.1.2/src/crc32c_benchmark.cc --- old/crc32c-1.1.1/src/crc32c_benchmark.cc 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/src/crc32c_benchmark.cc 2021-10-05 21:47:30.000000000 +0200 @@ -14,7 +14,7 @@ #endif // CRC32C_TESTS_BUILT_WITH_GLOG #include "./crc32c_arm64.h" -#include "./crc32c_arm64_linux_check.h" +#include "./crc32c_arm64_check.h" #include "./crc32c_internal.h" #include "./crc32c_sse42.h" #include "./crc32c_sse42_check.h" @@ -56,8 +56,8 @@ #if HAVE_ARM64_CRC32C -BENCHMARK_DEFINE_F(CRC32CBenchmark, ArmLinux)(benchmark::State& state) { - if (!crc32c::CanUseArm64Linux()) { +BENCHMARK_DEFINE_F(CRC32CBenchmark, ArmCRC32C)(benchmark::State& state) { + if (!crc32c::CanUseArm64Crc32()) { state.SkipWithError("ARM CRC32C instructions not available or not enabled"); return; } @@ -67,7 +67,7 @@ crc = crc32c::ExtendArm64(crc, block_buffer_, block_size_); state.SetBytesProcessed(state.iterations() * block_size_); } -BENCHMARK_REGISTER_F(CRC32CBenchmark, ArmLinux) +BENCHMARK_REGISTER_F(CRC32CBenchmark, ArmCRC32C) ->RangeMultiplier(16) ->Range(256, 16777216); // Block size. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crc32c-1.1.1/src/crc32c_read_le.h new/crc32c-1.1.2/src/crc32c_read_le.h --- old/crc32c-1.1.1/src/crc32c_read_le.h 2019-11-11 07:05:20.000000000 +0100 +++ new/crc32c-1.1.2/src/crc32c_read_le.h 2021-10-05 21:47:30.000000000 +0200 @@ -30,14 +30,14 @@ // Reads a little-endian 64-bit integer from a 64-bit-aligned buffer. inline uint64_t ReadUint64LE(const uint8_t* buffer) { #if BYTE_ORDER_BIG_ENDIAN - return ((static_cast<uint32_t>(static_cast<uint8_t>(buffer[0]))) | - (static_cast<uint32_t>(static_cast<uint8_t>(buffer[1])) << 8) | - (static_cast<uint32_t>(static_cast<uint8_t>(buffer[2])) << 16) | - (static_cast<uint32_t>(static_cast<uint8_t>(buffer[3])) << 24) | - (static_cast<uint32_t>(static_cast<uint8_t>(buffer[4])) << 32) | - (static_cast<uint32_t>(static_cast<uint8_t>(buffer[5])) << 40) | - (static_cast<uint32_t>(static_cast<uint8_t>(buffer[6])) << 48) | - (static_cast<uint32_t>(static_cast<uint8_t>(buffer[7])) << 56)); + return ((static_cast<uint64_t>(static_cast<uint8_t>(buffer[0]))) | + (static_cast<uint64_t>(static_cast<uint8_t>(buffer[1])) << 8) | + (static_cast<uint64_t>(static_cast<uint8_t>(buffer[2])) << 16) | + (static_cast<uint64_t>(static_cast<uint8_t>(buffer[3])) << 24) | + (static_cast<uint64_t>(static_cast<uint8_t>(buffer[4])) << 32) | + (static_cast<uint64_t>(static_cast<uint8_t>(buffer[5])) << 40) | + (static_cast<uint64_t>(static_cast<uint8_t>(buffer[6])) << 48) | + (static_cast<uint64_t>(static_cast<uint8_t>(buffer[7])) << 56)); #else // !BYTE_ORDER_BIG_ENDIAN uint64_t result; // This should be optimized to a single instruction.