summaryrefslogtreecommitdiff
path: root/absl/crc
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-11-29 12:11:06 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2022-11-29 12:12:02 -0800
commit67a8b2270f54f68fdfd69795012e9a64e2a225e0 (patch)
treec524326380558f2b4cd080a040789a7649eea568 /absl/crc
parentee2fc89eb87d95a5002817e2153ccaace72c7286 (diff)
Fix MSVC builds that reject C-style arrays of size 0
std::array has a special-case to allow this https://en.cppreference.com/w/cpp/container/array Fixes #1332 PiperOrigin-RevId: 491703960 Change-Id: Ib83a1f0865448314e463e8ebf39ae3b842f762ea
Diffstat (limited to 'absl/crc')
-rw-r--r--absl/crc/internal/crc_memcpy_x86_64.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/absl/crc/internal/crc_memcpy_x86_64.cc b/absl/crc/internal/crc_memcpy_x86_64.cc
index aee7bf0a..1c3299ee 100644
--- a/absl/crc/internal/crc_memcpy_x86_64.cc
+++ b/absl/crc/internal/crc_memcpy_x86_64.cc
@@ -46,6 +46,7 @@
#include <intrin.h>
#endif
+#include <array>
#include <cstddef>
#include <cstdint>
#include <type_traits>
@@ -87,8 +88,8 @@ constexpr int kIntLoadsPerVec = sizeof(__m128i) / sizeof(uint64_t);
template <int vec_regions, int int_regions>
inline void LargeTailCopy(crc32c_t* crcs, char** dst, const char** src,
size_t region_size, size_t copy_rounds) {
- __m128i data[vec_regions];
- uint64_t int_data[kIntLoadsPerVec * int_regions];
+ std::array<__m128i, vec_regions> data;
+ std::array<uint64_t, kIntLoadsPerVec * int_regions> int_data;
while (copy_rounds > 0) {
#ifdef __GNUC__
@@ -241,8 +242,8 @@ crc32c_t AcceleratedCrcMemcpyEngine<vec_regions, int_regions>::Compute(
const std::size_t tail_size = length - (kRegions * region_size);
// Holding registers for data in each region.
- __m128i vec_data[vec_regions];
- uint64_t int_data[int_regions * kIntLoadsPerVec];
+ std::array<__m128i, vec_regions> vec_data;
+ std::array<uint64_t, int_regions * kIntLoadsPerVec> int_data;
// Main loop.
while (copy_rounds > kBlocksPerCacheLine) {