mirror of
https://github.com/mozilla/DeepSpeech.git
synced 2025-10-26 11:19:39 +00:00
Change double_conversion namespace
This commit is contained in:
parent
5ad89c85ec
commit
4ea2a84fc7
@ -7,3 +7,6 @@ The following procedure was run to remove unneeded files:
|
||||
|
||||
cd kenlm
|
||||
rm -rf windows include lm/filter lm/builder util/stream util/getopt.* python
|
||||
|
||||
This was done in order to ensure uniqueness of double_conversion:
|
||||
git grep 'double_conversion' | cut -d':' -f1 | sort | uniq | xargs sed -ri 's/double_conversion/kenlm_double_conversion/g'
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#include "bignum.h"
|
||||
#include "ieee.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
static int NormalizedExponent(uint64_t significand, int exponent) {
|
||||
ASSERT(significand != 0);
|
||||
@ -637,4 +637,4 @@ static void FixupMultiply10(int estimated_power, bool is_even,
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
enum BignumDtoaMode {
|
||||
// Return the shortest correct representation.
|
||||
@ -79,6 +79,6 @@ enum BignumDtoaMode {
|
||||
void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
|
||||
Vector<char> buffer, int* length, int* point);
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_BIGNUM_DTOA_H_
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#include "bignum.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
Bignum::Bignum()
|
||||
: bigits_(bigits_buffer_, kBigitCapacity), used_digits_(0), exponent_(0) {
|
||||
@ -761,4 +761,4 @@ void Bignum::SubtractTimes(const Bignum& other, int factor) {
|
||||
}
|
||||
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
class Bignum {
|
||||
public:
|
||||
@ -140,6 +140,6 @@ class Bignum {
|
||||
DISALLOW_COPY_AND_ASSIGN(Bignum);
|
||||
};
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_BIGNUM_H_
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#include "cached-powers.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
struct CachedPower {
|
||||
uint64_t significand;
|
||||
@ -172,4 +172,4 @@ void PowersOfTenCache::GetCachedPowerForDecimalExponent(int requested_exponent,
|
||||
ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance);
|
||||
}
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "diy-fp.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
class PowersOfTenCache {
|
||||
public:
|
||||
@ -59,6 +59,6 @@ class PowersOfTenCache {
|
||||
int* found_exponent);
|
||||
};
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_CACHED_POWERS_H_
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include "diy-fp.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
void DiyFp::Multiply(const DiyFp& other) {
|
||||
// Simply "emulates" a 128 bit multiplication.
|
||||
@ -54,4 +54,4 @@ void DiyFp::Multiply(const DiyFp& other) {
|
||||
f_ = result_f;
|
||||
}
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
// This "Do It Yourself Floating Point" class implements a floating-point number
|
||||
// with a uint64 significand and an int exponent. Normalized DiyFp numbers will
|
||||
@ -113,6 +113,6 @@ class DiyFp {
|
||||
int e_;
|
||||
};
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_DIY_FP_H_
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
#include "strtod.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
const DoubleToStringConverter& DoubleToStringConverter::EcmaScriptConverter() {
|
||||
int flags = UNIQUE_ZERO | EMIT_POSITIVE_EXPONENT_SIGN;
|
||||
@ -886,4 +886,4 @@ double StringToDoubleConverter::StringToIeee(
|
||||
return sign? -converted: converted;
|
||||
}
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
class DoubleToStringConverter {
|
||||
public:
|
||||
@ -531,6 +531,6 @@ class StringToDoubleConverter {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
|
||||
};
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
#include "diy-fp.h"
|
||||
#include "ieee.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
// The minimal and maximal target exponent define the range of w's binary
|
||||
// exponent, where 'w' is the result of multiplying the input by a cached power
|
||||
@ -661,4 +661,4 @@ bool FastDtoa(double v,
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
enum FastDtoaMode {
|
||||
// Computes the shortest representation of the given input. The returned
|
||||
@ -83,6 +83,6 @@ bool FastDtoa(double d,
|
||||
int* length,
|
||||
int* decimal_point);
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_FAST_DTOA_H_
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "fixed-dtoa.h"
|
||||
#include "ieee.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
// Represents a 128bit type. This class should be replaced by a native type on
|
||||
// platforms that support 128bit integers.
|
||||
@ -399,4 +399,4 @@ bool FastFixedDtoa(double v,
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
// Produces digits necessary to print a given number with
|
||||
// 'fractional_count' digits after the decimal point.
|
||||
@ -51,6 +51,6 @@ namespace double_conversion {
|
||||
bool FastFixedDtoa(double v, int fractional_count,
|
||||
Vector<char> buffer, int* length, int* decimal_point);
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_FIXED_DTOA_H_
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "diy-fp.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
// We assume that doubles and uint64_t have the same endianness.
|
||||
static uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }
|
||||
@ -393,6 +393,6 @@ class Single {
|
||||
const uint32_t d32_;
|
||||
};
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_DOUBLE_H_
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include "cached-powers.h"
|
||||
#include "ieee.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
// 2^53 = 9007199254740992.
|
||||
// Any integer with at most 15 decimal digits will hence fit into a double
|
||||
@ -555,4 +555,4 @@ float Strtof(Vector<const char> buffer, int exponent) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
// The buffer must only contain digits in the range [0-9]. It must not
|
||||
// contain a dot or a sign. It must not start with '0', and must not be empty.
|
||||
@ -40,6 +40,6 @@ double Strtod(Vector<const char> buffer, int exponent);
|
||||
// contain a dot or a sign. It must not start with '0', and must not be empty.
|
||||
float Strtof(Vector<const char> buffer, int exponent);
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_STRTOD_H_
|
||||
|
||||
@ -126,7 +126,7 @@ typedef unsigned __int64 uint64_t;
|
||||
DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
#endif
|
||||
|
||||
namespace double_conversion {
|
||||
namespace kenlm_double_conversion {
|
||||
|
||||
static const int kCharSize = sizeof(char);
|
||||
|
||||
@ -315,6 +315,6 @@ inline Dest BitCast(Source* source) {
|
||||
return BitCast<Dest>(reinterpret_cast<uintptr_t>(source));
|
||||
}
|
||||
|
||||
} // namespace double_conversion
|
||||
} // namespace kenlm_double_conversion
|
||||
|
||||
#endif // DOUBLE_CONVERSION_UTILS_H_
|
||||
|
||||
@ -162,8 +162,8 @@ void FilePiece::Initialize(const char *name, std::ostream *show_progress, std::s
|
||||
|
||||
namespace {
|
||||
|
||||
static const double_conversion::StringToDoubleConverter kConverter(
|
||||
double_conversion::StringToDoubleConverter::ALLOW_TRAILING_JUNK | double_conversion::StringToDoubleConverter::ALLOW_LEADING_SPACES,
|
||||
static const kenlm_double_conversion::StringToDoubleConverter kConverter(
|
||||
kenlm_double_conversion::StringToDoubleConverter::ALLOW_TRAILING_JUNK | kenlm_double_conversion::StringToDoubleConverter::ALLOW_LEADING_SPACES,
|
||||
std::numeric_limits<double>::quiet_NaN(),
|
||||
std::numeric_limits<double>::quiet_NaN(),
|
||||
"inf",
|
||||
|
||||
@ -5,17 +5,17 @@
|
||||
|
||||
namespace util {
|
||||
namespace {
|
||||
const double_conversion::DoubleToStringConverter kConverter(double_conversion::DoubleToStringConverter::NO_FLAGS, "inf", "NaN", 'e', -6, 21, 6, 0);
|
||||
const kenlm_double_conversion::DoubleToStringConverter kConverter(kenlm_double_conversion::DoubleToStringConverter::NO_FLAGS, "inf", "NaN", 'e', -6, 21, 6, 0);
|
||||
} // namespace
|
||||
|
||||
char *ToString(double value, char *to) {
|
||||
double_conversion::StringBuilder builder(to, ToStringBuf<double>::kBytes);
|
||||
kenlm_double_conversion::StringBuilder builder(to, ToStringBuf<double>::kBytes);
|
||||
kConverter.ToShortest(value, &builder);
|
||||
return &to[builder.position()];
|
||||
}
|
||||
|
||||
char *ToString(float value, char *to) {
|
||||
double_conversion::StringBuilder builder(to, ToStringBuf<float>::kBytes);
|
||||
kenlm_double_conversion::StringBuilder builder(to, ToStringBuf<float>::kBytes);
|
||||
kConverter.ToShortestSingle(value, &builder);
|
||||
return &to[builder.position()];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user