-- 0c8282d75798c77733eee6167870bcc6acc0bfc1 by Evan Brown <ezb@google.com>: Provide mutable access to the key in node handles using std::launder when compiled with C++17 or later. Also, document why we can't provide mutable access to the key without C++17. Note: we use Policy::mutable_key() because btree already uses Policy::key() internally to get const key access, and we want to avoid calling std::launder unless we need mutable access to the key. PiperOrigin-RevId: 326519000 -- 8018d0c3044400f0a731b0d2d00b606742c98818 by Xiaoyi Zhang <zhangxy@google.com>: Move `Status` internal symbols from the public header into an internal header file. PiperOrigin-RevId: 326471847 -- 87a7644864ba7c003b0611898aaba1b71c840376 by Abseil Team <absl-team@google.com>: Avoid a costly divide (the division accounts for 10% of the time spent in the function). When the division is signed, the compiler has to generate a div. When it is unsigned, it can generate a shift: https://godbolt.org/z/vGfTv4. As per the test above the div, we know that the value is unsigned. PiperOrigin-RevId: 326453275 GitOrigin-RevId: 0c8282d75798c77733eee6167870bcc6acc0bfc1 Change-Id: I0a953558358055ab3dc6a533d8930698509b1195pull/772/head
parent
1beb3191c2
commit
c6b3f2cf58
15 changed files with 184 additions and 31 deletions
@ -0,0 +1,51 @@ |
||||
// Copyright 2019 The Abseil Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
#ifndef ABSL_STATUS_INTERNAL_STATUS_INTERNAL_H_ |
||||
#define ABSL_STATUS_INTERNAL_STATUS_INTERNAL_H_ |
||||
|
||||
#include <string> |
||||
|
||||
#include "absl/container/inlined_vector.h" |
||||
#include "absl/strings/cord.h" |
||||
|
||||
namespace absl { |
||||
ABSL_NAMESPACE_BEGIN |
||||
|
||||
enum class StatusCode : int; |
||||
|
||||
namespace status_internal { |
||||
|
||||
// Container for status payloads.
|
||||
struct Payload { |
||||
std::string type_url; |
||||
absl::Cord payload; |
||||
}; |
||||
|
||||
using Payloads = absl::InlinedVector<Payload, 1>; |
||||
|
||||
// Reference-counted representation of Status data.
|
||||
struct StatusRep { |
||||
std::atomic<int32_t> ref; |
||||
absl::StatusCode code; |
||||
std::string message; |
||||
std::unique_ptr<status_internal::Payloads> payloads; |
||||
}; |
||||
|
||||
absl::StatusCode MapToLocalCode(int value); |
||||
} // namespace status_internal
|
||||
|
||||
ABSL_NAMESPACE_END |
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_STATUS_INTERNAL_STATUS_INTERNAL_H_
|
Loading…
Reference in new issue