chromium/v8/src/bigint/util.h

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// "Generic" helper functions (not specific to BigInts).

#include <stdint.h>

#include <type_traits>

#ifdef _MSC_VER
#include <intrin.h>  // For _BitScanReverse.
#endif

#ifndef V8_BIGINT_UTIL_H_
#define V8_BIGINT_UTIL_H_

// Integer division, rounding up.
#define DIV_CEIL(x, y)

namespace v8 {
namespace bigint {

// Rounds up x to a multiple of y.
inline constexpr int RoundUp(int x, int y) {}

// Different environments disagree on how 64-bit uintptr_t and uint64_t are
// defined, so we have to use templates to be generic.
template <typename T, typename = typename std::enable_if<
                          std::is_unsigned<T>::value && sizeof(T) == 8>::type>
constexpr int CountLeadingZeros(T value) {}

constexpr int CountLeadingZeros(uint32_t value) {}

inline constexpr int CountTrailingZeros(uint32_t value) {}

inline constexpr int BitLength(int n) {}

inline constexpr bool IsPowerOfTwo(int value) {}

}  // namespace bigint
}  // namespace v8

#endif  // V8_BIGINT_UTIL_H_