!16 fix alignment code in SSE4.2-optimized CRC32C
From: @ikernel-mryao Reviewed-by: @Charlie_li Signed-off-by: @Charlie_li
This commit is contained in:
commit
df9430a329
@ -0,0 +1,40 @@
|
|||||||
|
From 2964b803b857932ff7499d7bebb61dc5514dab7c Mon Sep 17 00:00:00 2001
|
||||||
|
From: costan <costan@google.com>
|
||||||
|
Date: Wed, 23 Aug 2017 20:59:46 -0700
|
||||||
|
Subject: [PATCH] leveldb: Fix alignment code in SSE4.2-optimized CRC32C.
|
||||||
|
|
||||||
|
When faced with a pointer that is misaligned by K bytes (pointer % 8 ==
|
||||||
|
K), the code previously moved forward by K bytes. In order to end up
|
||||||
|
with an aligned pointer, the code must move by 8 - K bytes.
|
||||||
|
|
||||||
|
This lands https://github.com/google/leveldb/pull/488
|
||||||
|
|
||||||
|
-------------
|
||||||
|
Created by MOE: https://github.com/google/moe
|
||||||
|
MOE_MIGRATED_REVID=166295921
|
||||||
|
---
|
||||||
|
port/port_posix_sse.cc | 8 ++++++--
|
||||||
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/port/port_posix_sse.cc b/port/port_posix_sse.cc
|
||||||
|
index 1e519ba..08d9aee 100644
|
||||||
|
--- a/port/port_posix_sse.cc
|
||||||
|
+++ b/port/port_posix_sse.cc
|
||||||
|
@@ -92,8 +92,12 @@ uint32_t AcceleratedCRC32C(uint32_t crc, const char* buf, size_t size) {
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
if (size > 16) {
|
||||||
|
- // Process unaligned bytes
|
||||||
|
- for (unsigned int i = reinterpret_cast<uintptr_t>(p) % 8; i; --i) {
|
||||||
|
+ // Point x at first 8-byte aligned byte in string. This must be inside the
|
||||||
|
+ // string, due to the size check above.
|
||||||
|
+ const uintptr_t pval = reinterpret_cast<uintptr_t>(p);
|
||||||
|
+ const uint8_t* x = reinterpret_cast<const uint8_t*>(((pval + 7) >> 3) << 3);
|
||||||
|
+ // Process bytes until p is 8-byte aligned.
|
||||||
|
+ while (p != x) {
|
||||||
|
STEP1;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.40.0.windows.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: leveldb
|
Name: leveldb
|
||||||
Version: 1.20
|
Version: 1.20
|
||||||
Release: 5
|
Release: 6
|
||||||
Summary: A key/value database library
|
Summary: A key/value database library
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: https://github.com/google/leveldb
|
URL: https://github.com/google/leveldb
|
||||||
@ -11,6 +11,7 @@ Patch0002: 0002-Added-a-DB-SuspendCompations-and-DB-ResumeCompaction.patch
|
|||||||
Patch0003: 0003-allow-Get-calls-to-avoid-copies-into-std-string.patch
|
Patch0003: 0003-allow-Get-calls-to-avoid-copies-into-std-string.patch
|
||||||
Patch0004: 0004-bloom_test-failure-on-big-endian-archs.patch
|
Patch0004: 0004-bloom_test-failure-on-big-endian-archs.patch
|
||||||
Patch0005: 0005-broken-db-fix-assertion-in-leveldb-InternalKey-Encod.patch
|
Patch0005: 0005-broken-db-fix-assertion-in-leveldb-InternalKey-Encod.patch
|
||||||
|
Patch0006: 0006-leveldb-Fix-alignment-code-in-SSE4.2-optimized-CRC32.patch
|
||||||
|
|
||||||
BuildRequires: make gcc-c++ snappy-devel
|
BuildRequires: make gcc-c++ snappy-devel
|
||||||
|
|
||||||
@ -72,6 +73,9 @@ make -j1 check
|
|||||||
%{_libdir}/pkgconfig/leveldb.pc
|
%{_libdir}/pkgconfig/leveldb.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 25 2023 yaoguangzhong <yaoguangzhong@xfusion.com> - 1.20-6
|
||||||
|
- fix alignment code in SSE4.2-optimized CRC32C
|
||||||
|
|
||||||
* Tue Apr 18 2023 yaoguangzhong <yaoguangzhong@xfusion.com> - 1.20-5
|
* Tue Apr 18 2023 yaoguangzhong <yaoguangzhong@xfusion.com> - 1.20-5
|
||||||
- fix assertion in leveldb::InternalKey::Encode, mark base as corrupt
|
- fix assertion in leveldb::InternalKey::Encode, mark base as corrupt
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user