From 1112609635037a32435de7aa70a9188dcb591458 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 7 Apr 2020 10:28:30 -0700 Subject: Export of internal Abseil changes -- c162645dba4de6f5f1c8b6e8a29a8da9f9e0aa52 by Derek Mauro : Update linux_clang-latest container to one based on Ubuntu 18.04, which has libstdc++-8. PiperOrigin-RevId: 305287658 GitOrigin-RevId: c162645dba4de6f5f1c8b6e8a29a8da9f9e0aa52 Change-Id: I3f31daf0d8c445008c78f0e10ae6af753cea756b --- absl/base/internal/endian_test.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'absl/base') diff --git a/absl/base/internal/endian_test.cc b/absl/base/internal/endian_test.cc index 678a0bf78be1..a1691b1f82c0 100644 --- a/absl/base/internal/endian_test.cc +++ b/absl/base/internal/endian_test.cc @@ -54,18 +54,14 @@ const uint32_t k32ValueBE{0x67452301}; const uint16_t k16ValueBE{0x2301}; #endif -template -std::vector GenerateAllValuesForType() { - std::vector result; - result.reserve(size_t{1} << (sizeof(T) * 8)); - T next = std::numeric_limits::min(); - while (true) { - result.push_back(next); - if (next == std::numeric_limits::max()) { - return result; - } - ++next; +std::vector GenerateAllUint16Values() { + std::vector result; + result.reserve(size_t{1} << (sizeof(uint16_t) * 8)); + for (uint32_t i = std::numeric_limits::min(); + i <= std::numeric_limits::max(); ++i) { + result.push_back(static_cast(i)); } + return result; } template @@ -150,7 +146,7 @@ void Swap64(char* bytes) { } TEST(EndianessTest, Uint16) { - GBSwapHelper(GenerateAllValuesForType(), &Swap16); + GBSwapHelper(GenerateAllUint16Values(), &Swap16); } TEST(EndianessTest, Uint32) { -- cgit 1.4.1