Rebase and add Rabin–Karp algorithm

This commit is contained in:
Alexander David Frick 2022-04-30 14:29:40 -05:00 committed by GitHub
parent 620374a0a2
commit 3cef06b380
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@ -21,7 +21,7 @@ config("zlib_internal_config") {
if (!is_debug) {
# Build code using -O3, see: crbug.com/1084371.
# configs = [ "//build/config/compiler:optimize_speed" ]
configs = [ "//build/config/compiler:optimize_speed" ]
}
if (is_debug || use_libfuzzer) {
# Enable zlib's asserts in debug and fuzzer builds.
@ -216,6 +216,7 @@ source_set("zlib_crc32_simd") {
sources = [
"crc32_simd.c",
"crc32_simd.h",
"crc_folding.c",
]
if (!is_win || is_clang) {
@ -229,38 +230,34 @@ source_set("zlib_crc32_simd") {
configs += [ ":zlib_internal_config" ]
public_configs = [ ":zlib_crc32_simd_config" ]
public_deps = [ ":zlib_common_headers" ]
}
config("zlib_x86_simd_config") {
config("zlib_slide_hash_simd_config") {
if (use_x86_x64_optimizations) {
defines = [
"CRC32_SIMD_SSE42_PCLMUL",
"DEFLATE_FILL_WINDOW_SSE2",
]
defines = [ "DEFLATE_SLIDE_HASH_SSE2" ]
}
if (use_arm_neon_optimizations) {
defines = [ "DEFLATE_SLIDE_HASH_NEON" ]
}
}
source_set("zlib_x86_simd") {
source_set("zlib_slide_hash_simd") {
visibility = [ ":*" ]
if (use_x86_x64_optimizations) {
sources = [
"crc_folding.c",
"fill_window_sse.c",
]
if (!is_win || is_clang) {
cflags = [
"-msse4.2",
"-mpclmul",
]
sources = [ "slide_hash_simd.h" ]
}
if (use_arm_neon_optimizations) {
sources = [ "slide_hash_simd.h" ]
}
configs += [ ":zlib_internal_config" ]
public_configs = [ ":zlib_x86_simd_config" ]
public_configs = [ ":zlib_slide_hash_simd_config" ]
public_deps = [ ":zlib_common_headers" ]
}
@ -330,20 +327,18 @@ component("zlib") {
deps += [
":zlib_adler32_simd",
":zlib_inflate_chunk_simd",
":zlib_slide_hash_simd",
]
if (use_x86_x64_optimizations) {
deps += [ ":zlib_crc32_simd" ]
} else if (use_arm_neon_optimizations) {
sources += [ "contrib/optimizations/slide_hash_neon.h" ]
deps += [ ":zlib_arm_crc32" ]
}
} else {
sources += [ "inflate.c" ]
}
deps += [ ":zlib_x86_simd" ]
if (is_android) {
import("//build/config/android/config.gni")
if (defined(android_ndk_root) && android_ndk_root != "") {