@@ -158,19 +158,24 @@ class HttpHeader {
158158 std::vector<std::string> values_;
159159};
160160
161- // Abseil does not guarantee compatibility with 32-bit targets.
162- #if defined(_WIN64) || defined(__LP64__) || defined(__x86_64__) || \
163- defined (__ppc64__)
161+ // Abseil does not guarantee compatibility with 32-bit platforms that they do
162+ // not test with. Support for such platforms is a community effort. Using
163+ // std::unordered_map on 32-bit platforms reduces the likelihood of issues
164+ // arising due to this arrangement.
165+ #if UINTPTR_MAX == UINT64_MAX
164166// 64-bit architecture
165167using HttpHeaders = absl::flat_hash_map<HttpHeaderName, HttpHeader>;
166168#else
167169// 32-bit architecture
170+ using HttpHeaders = std::unordered_map<HttpHeaderName, HttpHeader>;
171+ #endif // UINTPTR_MAX == UINT64_MAX
168172
169173GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
170174} // namespace rest_internal
171175} // namespace cloud
172176} // namespace google
173177
178+ #if UINTPTR_MAX != UINT64_MAX
174179// This specialization has to be in the global namespace.
175180template <>
176181struct std ::hash<google::cloud::rest_internal::HttpHeaderName> {
@@ -179,18 +184,6 @@ struct std::hash<google::cloud::rest_internal::HttpHeaderName> {
179184 return std::hash<std::string>()(k.name ());
180185 }
181186};
182-
183- namespace google {
184- namespace cloud {
185- namespace rest_internal {
186- GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
187-
188- using HttpHeaders = std::unordered_map<HttpHeaderName, HttpHeader>;
189- #endif
190-
191- GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
192- } // namespace rest_internal
193- } // namespace cloud
194- } // namespace google
187+ #endif // UINTPTR_MAX != UINT64_MAX
195188
196189#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_HTTP_HEADER_H
0 commit comments