// © 2018 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html // // From the double-conversion library. Original license: // // Copyright 2010 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ICU PATCH: ifdef around UCONFIG_NO_FORMATTING #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING #include <algorithm> #include <cstring> // ICU PATCH: Customize header file paths for ICU. #include "double-conversion-bignum.h" #include "double-conversion-utils.h" // ICU PATCH: Wrap in ICU namespace U_NAMESPACE_BEGIN namespace double_conversion { Bignum::Chunk& Bignum::RawBigit(const int index) { … } const Bignum::Chunk& Bignum::RawBigit(const int index) const { … } template<typename S> static int BitSize(const S value) { … } // Guaranteed to lie in one Bigit. void Bignum::AssignUInt16(const uint16_t value) { … } void Bignum::AssignUInt64(uint64_t value) { … } void Bignum::AssignBignum(const Bignum& other) { … } static uint64_t ReadUInt64(const Vector<const char> buffer, const int from, const int digits_to_read) { … } void Bignum::AssignDecimalString(const Vector<const char> value) { … } static uint64_t HexCharValue(const int c) { … } // Unlike AssignDecimalString(), this function is "only" used // for unit-tests and therefore not performance critical. void Bignum::AssignHexString(Vector<const char> value) { … } void Bignum::AddUInt64(const uint64_t operand) { … } void Bignum::AddBignum(const Bignum& other) { … } void Bignum::SubtractBignum(const Bignum& other) { … } void Bignum::ShiftLeft(const int shift_amount) { … } void Bignum::MultiplyByUInt32(const uint32_t factor) { … } void Bignum::MultiplyByUInt64(const uint64_t factor) { … } void Bignum::MultiplyByPowerOfTen(const int exponent) { … } void Bignum::Square() { … } void Bignum::AssignPowerUInt16(uint16_t base, const int power_exponent) { … } // Precondition: this/other < 16bit. uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) { … } template<typename S> static int SizeInHexChars(S number) { … } static char HexCharOfValue(const int value) { … } bool Bignum::ToHexString(char* buffer, const int buffer_size) const { … } Bignum::Chunk Bignum::BigitOrZero(const int index) const { … } int Bignum::Compare(const Bignum& a, const Bignum& b) { … } int Bignum::PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c) { … } void Bignum::Clamp() { … } void Bignum::Align(const Bignum& other) { … } void Bignum::BigitsShiftLeft(const int shift_amount) { … } void Bignum::SubtractTimes(const Bignum& other, const int factor) { … } } // namespace double_conversion // ICU PATCH: Close ICU namespace U_NAMESPACE_END #endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING