1bdd1243dSDimitry Andric //===----------------------------------------------------------------------===// 2bdd1243dSDimitry Andric // 3bdd1243dSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4bdd1243dSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5bdd1243dSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6bdd1243dSDimitry Andric // 7bdd1243dSDimitry Andric //===----------------------------------------------------------------------===// 8bdd1243dSDimitry Andric 9bdd1243dSDimitry Andric #ifndef _LIBCPP___BIT_BLSR_H 10bdd1243dSDimitry Andric #define _LIBCPP___BIT_BLSR_H 11bdd1243dSDimitry Andric 12bdd1243dSDimitry Andric #include <__config> 13bdd1243dSDimitry Andric 14bdd1243dSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 15bdd1243dSDimitry Andric # pragma GCC system_header 16bdd1243dSDimitry Andric #endif 17bdd1243dSDimitry Andric 18bdd1243dSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 19bdd1243dSDimitry Andric 20*5f757f3fSDimitry Andric inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned __libcpp_blsr(unsigned __x) _NOEXCEPT { 21bdd1243dSDimitry Andric return __x ^ (__x & -__x); 22bdd1243dSDimitry Andric } 23bdd1243dSDimitry Andric 24*5f757f3fSDimitry Andric inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned long __libcpp_blsr(unsigned long __x) _NOEXCEPT { 25bdd1243dSDimitry Andric return __x ^ (__x & -__x); 26bdd1243dSDimitry Andric } 27bdd1243dSDimitry Andric 28*5f757f3fSDimitry Andric inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned long long __libcpp_blsr(unsigned long long __x) _NOEXCEPT { 29bdd1243dSDimitry Andric return __x ^ (__x & -__x); 30bdd1243dSDimitry Andric } 31bdd1243dSDimitry Andric 32bdd1243dSDimitry Andric _LIBCPP_END_NAMESPACE_STD 33bdd1243dSDimitry Andric 34bdd1243dSDimitry Andric #endif // _LIBCPP___BIT_BLSR_H 35