Path: blob/main/contrib/llvm-project/compiler-rt/lib/orc/stl_extras.h
39566 views
//===-------- stl_extras.h - Useful STL related functions-------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of the ORC runtime support library.9//10//===----------------------------------------------------------------------===//1112#ifndef ORC_RT_STL_EXTRAS_H13#define ORC_RT_STL_EXTRAS_H1415#include <cstdint>16#include <utility>17#include <tuple>1819namespace __orc_rt {2021/// Substitute for std::identity.22/// Switch to std::identity once we can use c++20.23template <class Ty> struct identity {24using is_transparent = void;25using argument_type = Ty;2627Ty &operator()(Ty &self) const { return self; }28const Ty &operator()(const Ty &self) const { return self; }29};3031/// Substitute for std::bit_ceil.32constexpr uint64_t bit_ceil(uint64_t Val) noexcept {33Val |= (Val >> 1);34Val |= (Val >> 2);35Val |= (Val >> 4);36Val |= (Val >> 8);37Val |= (Val >> 16);38Val |= (Val >> 32);39return Val + 1;40}4142} // namespace __orc_rt4344#endif // ORC_RT_STL_EXTRAS454647