mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 06:06:23 +00:00
chore(Deps/Acelite): Update to 6.5.10 (#3450)
This commit is contained in:
207
deps/acelite/ace/CDR_Base.cpp
vendored
207
deps/acelite/ace/CDR_Base.cpp
vendored
@@ -52,7 +52,7 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
|
||||
}
|
||||
#else
|
||||
char const * const o4 = ACE_ptr_align_binary (orig, 4);
|
||||
// this is an _if_, not a _while_. The mistmatch can only be by 2.
|
||||
// this is an _if_, not a _while_. The mismatch can only be by 2.
|
||||
if (orig != o4)
|
||||
{
|
||||
ACE_CDR::swap_2 (orig, target);
|
||||
@@ -74,7 +74,7 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
|
||||
// end marks our barrier for not falling outside.
|
||||
char const * const end = orig + 2 * (n & (~3));
|
||||
|
||||
// See if we're aligned for writting in 64 or 32 bit chunks...
|
||||
// See if we're aligned for writing in 64 or 32 bit chunks...
|
||||
#if ACE_SIZEOF_LONG == 8 && \
|
||||
!((defined(__amd64__) || defined (__x86_64__)) && defined(__GNUG__))
|
||||
if (target == ACE_ptr_align_binary (target, 8))
|
||||
@@ -110,25 +110,22 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
|
||||
__asm mov 4[edx], ebx;
|
||||
#elif ACE_SIZEOF_LONG == 8
|
||||
// 64 bit architecture.
|
||||
ACE_REGISTER unsigned long a =
|
||||
* reinterpret_cast<const unsigned long*> (orig);
|
||||
unsigned long a = * reinterpret_cast<const unsigned long*> (orig);
|
||||
|
||||
ACE_REGISTER unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
|
||||
ACE_REGISTER unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
|
||||
unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
|
||||
unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
|
||||
|
||||
a = (a1 | a2);
|
||||
|
||||
* reinterpret_cast<unsigned long*> (target) = a;
|
||||
#else
|
||||
ACE_REGISTER ACE_UINT32 a =
|
||||
* reinterpret_cast<const ACE_UINT32*> (orig);
|
||||
ACE_REGISTER ACE_UINT32 b =
|
||||
* reinterpret_cast<const ACE_UINT32*> (orig + 4);
|
||||
ACE_UINT32 a = * reinterpret_cast<const ACE_UINT32*> (orig);
|
||||
ACE_UINT32 b = * reinterpret_cast<const ACE_UINT32*> (orig + 4);
|
||||
|
||||
ACE_REGISTER ACE_UINT32 a1 = (a & 0x00ff00ffU) << 8;
|
||||
ACE_REGISTER ACE_UINT32 b1 = (b & 0x00ff00ffU) << 8;
|
||||
ACE_REGISTER ACE_UINT32 a2 = (a & 0xff00ff00U) >> 8;
|
||||
ACE_REGISTER ACE_UINT32 b2 = (b & 0xff00ff00U) >> 8;
|
||||
ACE_UINT32 a1 = (a & 0x00ff00ffU) << 8;
|
||||
ACE_UINT32 b1 = (b & 0x00ff00ffU) << 8;
|
||||
ACE_UINT32 a2 = (a & 0xff00ff00U) >> 8;
|
||||
ACE_UINT32 b2 = (b & 0xff00ff00U) >> 8;
|
||||
|
||||
a = (a1 | a2);
|
||||
b = (b1 | b2);
|
||||
@@ -181,11 +178,10 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
|
||||
__asm mov 4[edx], bx;
|
||||
#elif ACE_SIZEOF_LONG == 8
|
||||
// 64 bit architecture.
|
||||
ACE_REGISTER unsigned long a =
|
||||
* reinterpret_cast<const unsigned long*> (orig);
|
||||
unsigned long a = * reinterpret_cast<const unsigned long*> (orig);
|
||||
|
||||
ACE_REGISTER unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
|
||||
ACE_REGISTER unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
|
||||
unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
|
||||
unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
|
||||
|
||||
a = (a1 | a2);
|
||||
|
||||
@@ -206,15 +202,13 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
|
||||
* reinterpret_cast<ACE_UINT16*> (target + 6) = b4;
|
||||
#endif
|
||||
#else
|
||||
ACE_REGISTER ACE_UINT32 a =
|
||||
* reinterpret_cast<const ACE_UINT32*> (orig);
|
||||
ACE_REGISTER ACE_UINT32 b =
|
||||
* reinterpret_cast<const ACE_UINT32*> (orig + 4);
|
||||
ACE_UINT32 a = * reinterpret_cast<const ACE_UINT32*> (orig);
|
||||
ACE_UINT32 b = * reinterpret_cast<const ACE_UINT32*> (orig + 4);
|
||||
|
||||
ACE_REGISTER ACE_UINT32 a1 = (a & 0x00ff00ff) << 8;
|
||||
ACE_REGISTER ACE_UINT32 b1 = (b & 0x00ff00ff) << 8;
|
||||
ACE_REGISTER ACE_UINT32 a2 = (a & 0xff00ff00) >> 8;
|
||||
ACE_REGISTER ACE_UINT32 b2 = (b & 0xff00ff00) >> 8;
|
||||
ACE_UINT32 a1 = (a & 0x00ff00ff) << 8;
|
||||
ACE_UINT32 b1 = (b & 0x00ff00ff) << 8;
|
||||
ACE_UINT32 a2 = (a & 0xff00ff00) >> 8;
|
||||
ACE_UINT32 b2 = (b & 0xff00ff00) >> 8;
|
||||
|
||||
a = (a1 | a2);
|
||||
b = (b1 | b2);
|
||||
@@ -248,10 +242,12 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
|
||||
ACE_CDR::swap_2 (orig, target);
|
||||
orig += 2;
|
||||
target += 2;
|
||||
// fallthrough
|
||||
case 2:
|
||||
ACE_CDR::swap_2 (orig, target);
|
||||
orig += 2;
|
||||
target += 2;
|
||||
// fallthrough
|
||||
case 1:
|
||||
ACE_CDR::swap_2 (orig, target);
|
||||
}
|
||||
@@ -296,10 +292,8 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
|
||||
{
|
||||
while (orig < end)
|
||||
{
|
||||
ACE_REGISTER unsigned long a =
|
||||
* reinterpret_cast<const long*> (orig);
|
||||
ACE_REGISTER unsigned long b =
|
||||
* reinterpret_cast<const long*> (orig + 8);
|
||||
unsigned long a = * reinterpret_cast<const long*> (orig);
|
||||
unsigned long b = * reinterpret_cast<const long*> (orig + 8);
|
||||
|
||||
#if defined(ACE_HAS_INTEL_ASSEMBLY)
|
||||
asm ("bswapq %1" : "=r" (a) : "0" (a));
|
||||
@@ -307,14 +301,14 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
|
||||
asm ("rol $32, %1" : "=r" (a) : "0" (a));
|
||||
asm ("rol $32, %1" : "=r" (b) : "0" (b));
|
||||
#else
|
||||
ACE_REGISTER unsigned long a84 = (a & 0x000000ff000000ffL) << 24;
|
||||
ACE_REGISTER unsigned long b84 = (b & 0x000000ff000000ffL) << 24;
|
||||
ACE_REGISTER unsigned long a73 = (a & 0x0000ff000000ff00L) << 8;
|
||||
ACE_REGISTER unsigned long b73 = (b & 0x0000ff000000ff00L) << 8;
|
||||
ACE_REGISTER unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8;
|
||||
ACE_REGISTER unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
|
||||
ACE_REGISTER unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
|
||||
ACE_REGISTER unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
|
||||
unsigned long a84 = (a & 0x000000ff000000ffL) << 24;
|
||||
unsigned long b84 = (b & 0x000000ff000000ffL) << 24;
|
||||
unsigned long a73 = (a & 0x0000ff000000ff00L) << 8;
|
||||
unsigned long b73 = (b & 0x0000ff000000ff00L) << 8;
|
||||
unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8;
|
||||
unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
|
||||
unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
|
||||
unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
|
||||
|
||||
a = (a84 | a73 | a62 | a51);
|
||||
b = (b84 | b73 | b62 | b51);
|
||||
@@ -332,10 +326,8 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
|
||||
// We are out of luck, we have to write in 4 byte chunks.
|
||||
while (orig < end)
|
||||
{
|
||||
ACE_REGISTER unsigned long a =
|
||||
* reinterpret_cast<const long*> (orig);
|
||||
ACE_REGISTER unsigned long b =
|
||||
* reinterpret_cast<const long*> (orig + 8);
|
||||
unsigned long a = * reinterpret_cast<const long*> (orig);
|
||||
unsigned long b = * reinterpret_cast<const long*> (orig + 8);
|
||||
|
||||
#if defined(ACE_HAS_INTEL_ASSEMBLY)
|
||||
asm ("bswapq %1" : "=r" (a) : "0" (a));
|
||||
@@ -343,14 +335,14 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
|
||||
asm ("rol $32, %1" : "=r" (a) : "0" (a));
|
||||
asm ("rol $32, %1" : "=r" (b) : "0" (b));
|
||||
#else
|
||||
ACE_REGISTER unsigned long a84 = (a & 0x000000ff000000ffL) << 24;
|
||||
ACE_REGISTER unsigned long b84 = (b & 0x000000ff000000ffL) << 24;
|
||||
ACE_REGISTER unsigned long a73 = (a & 0x0000ff000000ff00L) << 8;
|
||||
ACE_REGISTER unsigned long b73 = (b & 0x0000ff000000ff00L) << 8;
|
||||
ACE_REGISTER unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8;
|
||||
ACE_REGISTER unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
|
||||
ACE_REGISTER unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
|
||||
ACE_REGISTER unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
|
||||
unsigned long a84 = (a & 0x000000ff000000ffL) << 24;
|
||||
unsigned long b84 = (b & 0x000000ff000000ffL) << 24;
|
||||
unsigned long a73 = (a & 0x0000ff000000ff00L) << 8;
|
||||
unsigned long b73 = (b & 0x0000ff000000ff00L) << 8;
|
||||
unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8;
|
||||
unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
|
||||
unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
|
||||
unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
|
||||
|
||||
a = (a84 | a73 | a62 | a51);
|
||||
b = (b84 | b73 | b62 | b51);
|
||||
@@ -382,14 +374,10 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
|
||||
while (orig < end)
|
||||
{
|
||||
#if defined (ACE_HAS_PENTIUM) && defined (__GNUG__)
|
||||
ACE_REGISTER unsigned int a =
|
||||
*reinterpret_cast<const unsigned int*> (orig);
|
||||
ACE_REGISTER unsigned int b =
|
||||
*reinterpret_cast<const unsigned int*> (orig + 4);
|
||||
ACE_REGISTER unsigned int c =
|
||||
*reinterpret_cast<const unsigned int*> (orig + 8);
|
||||
ACE_REGISTER unsigned int d =
|
||||
*reinterpret_cast<const unsigned int*> (orig + 12);
|
||||
unsigned int a = *reinterpret_cast<const unsigned int*> (orig);
|
||||
unsigned int b = *reinterpret_cast<const unsigned int*> (orig + 4);
|
||||
unsigned int c = *reinterpret_cast<const unsigned int*> (orig + 8);
|
||||
unsigned int d = *reinterpret_cast<const unsigned int*> (orig + 12);
|
||||
|
||||
asm ("bswap %1" : "=r" (a) : "0" (a));
|
||||
asm ("bswap %1" : "=r" (b) : "0" (b));
|
||||
@@ -418,14 +406,10 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
|
||||
__asm mov 8[esi], ebx
|
||||
__asm mov 12[esi], eax
|
||||
#else
|
||||
ACE_REGISTER ACE_UINT32 a =
|
||||
* reinterpret_cast<const ACE_UINT32*> (orig);
|
||||
ACE_REGISTER ACE_UINT32 b =
|
||||
* reinterpret_cast<const ACE_UINT32*> (orig + 4);
|
||||
ACE_REGISTER ACE_UINT32 c =
|
||||
* reinterpret_cast<const ACE_UINT32*> (orig + 8);
|
||||
ACE_REGISTER ACE_UINT32 d =
|
||||
* reinterpret_cast<const ACE_UINT32*> (orig + 12);
|
||||
ACE_UINT32 a = * reinterpret_cast<const ACE_UINT32*> (orig);
|
||||
ACE_UINT32 b = * reinterpret_cast<const ACE_UINT32*> (orig + 4);
|
||||
ACE_UINT32 c = * reinterpret_cast<const ACE_UINT32*> (orig + 8);
|
||||
ACE_UINT32 d = * reinterpret_cast<const ACE_UINT32*> (orig + 12);
|
||||
|
||||
// Expect the optimizer reordering this A LOT.
|
||||
// We leave it this way for clarity.
|
||||
@@ -452,10 +436,12 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
|
||||
ACE_CDR::swap_4 (orig, target);
|
||||
orig += 4;
|
||||
target += 4;
|
||||
// fallthrough
|
||||
case 2:
|
||||
ACE_CDR::swap_4 (orig, target);
|
||||
orig += 4;
|
||||
target += 4;
|
||||
// fallthrough
|
||||
case 1:
|
||||
ACE_CDR::swap_4 (orig, target);
|
||||
}
|
||||
@@ -598,21 +584,6 @@ ACE_CDR::consolidate (ACE_Message_Block *dst,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (NONNATIVE_LONGLONG)
|
||||
bool
|
||||
ACE_CDR::LongLong::operator== (const ACE_CDR::LongLong &rhs) const
|
||||
{
|
||||
return this->h == rhs.h && this->l == rhs.l;
|
||||
}
|
||||
|
||||
bool
|
||||
ACE_CDR::LongLong::operator!= (const ACE_CDR::LongLong &rhs) const
|
||||
{
|
||||
return this->l != rhs.l || this->h != rhs.h;
|
||||
}
|
||||
|
||||
#endif /* NONNATIVE_LONGLONG */
|
||||
|
||||
#if defined (NONNATIVE_LONGDOUBLE)
|
||||
ACE_CDR::LongDouble&
|
||||
ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
|
||||
@@ -843,7 +814,7 @@ ACE_CDR::Fixed ACE_CDR::Fixed::from_integer (ACE_CDR::ULongLong val)
|
||||
|
||||
ACE_CDR::Fixed ACE_CDR::Fixed::from_floating (LongDouble val)
|
||||
{
|
||||
#ifdef ACE_OPENVMS
|
||||
#if defined ACE_OPENVMS || (defined ACE_VXWORKS && !defined __RTP__)
|
||||
typedef double BigFloat;
|
||||
#elif defined NONNATIVE_LONGDOUBLE
|
||||
typedef LongDouble::NativeImpl BigFloat;
|
||||
@@ -852,7 +823,7 @@ ACE_CDR::Fixed ACE_CDR::Fixed::from_floating (LongDouble val)
|
||||
#endif
|
||||
|
||||
Fixed f;
|
||||
f.digits_ = 0;
|
||||
f.digits_ = f.scale_ = 0;
|
||||
bool negative = false;
|
||||
if (val < 0)
|
||||
{
|
||||
@@ -864,7 +835,10 @@ ACE_CDR::Fixed ACE_CDR::Fixed::from_floating (LongDouble val)
|
||||
const size_t digits_left =
|
||||
static_cast<size_t> (1 + ((val > 0) ? std::log10 (val) : 0));
|
||||
if (digits_left > MAX_DIGITS)
|
||||
return f;
|
||||
{
|
||||
ACE_OS::memset (f.value_, 0, sizeof f.value_);
|
||||
return f;
|
||||
}
|
||||
|
||||
f.digits_ = MAX_DIGITS;
|
||||
f.scale_ = 0;
|
||||
@@ -914,42 +888,25 @@ void ACE_CDR::Fixed::normalize (UShort min_scale)
|
||||
if (this->value_[15] & 0xf0 || !this->scale_)
|
||||
return;
|
||||
|
||||
size_t bytes = 0; // number of bytes to shift down
|
||||
while (2 * (bytes + 1) < this->scale_
|
||||
&& this->scale_ - 2 * (bytes + 1) >= min_scale
|
||||
&& !this->value_[14 - bytes])
|
||||
++bytes;
|
||||
// Calculate the number of nibbles that can be moved.
|
||||
ACE_CDR::Octet nibbles = 0;
|
||||
while (this->digit(nibbles) == 0 && this->scale_ - nibbles > min_scale)
|
||||
++nibbles;
|
||||
|
||||
const bool extra_nibble = 2 * (bytes + 1) <= this->scale_
|
||||
&& this->scale_ - 2 * (bytes + 1) >= min_scale
|
||||
&& !(this->value_[14 - bytes] & 0xf);
|
||||
const size_t nibbles = 1 /*[15].high*/ + bytes * 2 + extra_nibble;
|
||||
this->digits_ -= static_cast<Octet> (nibbles);
|
||||
this->scale_ -= static_cast<Octet> (nibbles);
|
||||
// Move and clear the nibbles.
|
||||
for (ACE_CDR::Octet idx = nibbles; idx != this->digits_; ++idx) {
|
||||
this->digit (idx - nibbles, this->digit (idx));
|
||||
this->digit (idx, 0);
|
||||
}
|
||||
|
||||
if (extra_nibble)
|
||||
{
|
||||
const bool sign = this->sign ();
|
||||
std::memmove (this->value_ + bytes + 1, this->value_, 15 - bytes);
|
||||
std::memset (this->value_, 0, bytes + 1);
|
||||
this->value_[15] |= sign ? NEGATIVE : POSITIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->value_[15] = (this->value_[14 - bytes] & 0xf) << 4
|
||||
| (this->value_[15] & 0xf);
|
||||
for (size_t i = 14; i > bytes; --i)
|
||||
this->value_[i] = (this->value_[i - bytes - 1] & 0xf) << 4
|
||||
| (this->value_[i - bytes] >> 4);
|
||||
this->value_[bytes] = this->value_[0] >> 4;
|
||||
std::memset (this->value_, 0, bytes);
|
||||
}
|
||||
this->scale_ -= nibbles;
|
||||
this->digits_ -= nibbles;
|
||||
}
|
||||
|
||||
ACE_CDR::Fixed ACE_CDR::Fixed::from_string (const char *str)
|
||||
{
|
||||
const bool negative = str && *str == '-';
|
||||
if (negative || (str && *str == '+'))
|
||||
const bool negative = *str == '-';
|
||||
if (negative || *str == '+')
|
||||
++str;
|
||||
|
||||
const size_t span = ACE_OS::strspn (str, ".0123456789");
|
||||
@@ -1157,14 +1114,16 @@ ACE_CDR::Fixed::ConstIterator ACE_CDR::Fixed::pre_add (const ACE_CDR::Fixed &f)
|
||||
|
||||
if (f.digits_ - f.scale_ > this->digits_ - this->scale_)
|
||||
{
|
||||
this->digits_ += f.digits_ - f.scale_ - this->digits_ + this->scale_;
|
||||
if (this->digits_ > MAX_DIGITS)
|
||||
ACE_CDR::Octet new_digits = this->digits_ + (f.digits_ - f.scale_) - (this->digits_ - this->scale_);
|
||||
if (new_digits > MAX_DIGITS)
|
||||
{
|
||||
for (size_t i = 0; i < static_cast<size_t> (this->digits_ - MAX_DIGITS); ++i)
|
||||
for (size_t i = 0; i < static_cast<size_t> (new_digits - MAX_DIGITS); ++i)
|
||||
this->digit (static_cast<int> (i), 0);
|
||||
this->normalize (this->scale_ - MAX_DIGITS - this->digits_);
|
||||
this->normalize (this->scale_ - (new_digits - MAX_DIGITS));
|
||||
this->digits_ = MAX_DIGITS;
|
||||
}
|
||||
else
|
||||
this->digits_ = new_digits;
|
||||
}
|
||||
return rhs_iter;
|
||||
}
|
||||
@@ -1391,10 +1350,15 @@ ACE_CDR::Fixed &ACE_CDR::Fixed::operator/= (const Fixed &rhs)
|
||||
if (neg)
|
||||
this->value_[15] = (this->value_[15] & 0xf0) | POSITIVE;
|
||||
|
||||
Fixed r, q = this->div_helper2 (rhs_no_scale, r);
|
||||
Fixed r;
|
||||
Fixed q = this->div_helper2 (rhs_no_scale, r);
|
||||
q.scale_ = this->scale_;
|
||||
|
||||
if (!r)
|
||||
return *this = neg ? -q : q;;
|
||||
if (!r) {
|
||||
*this = neg ? -q : q;
|
||||
this->normalize ();
|
||||
return *this;
|
||||
}
|
||||
|
||||
const int shift = q.lshift (MAX_DIGITS);
|
||||
if (shift)
|
||||
@@ -1458,6 +1422,7 @@ ACE_CDR::Fixed ACE_CDR::Fixed::div_helper1 (const Fixed &rhs, Fixed &r) const
|
||||
if (q > 9)
|
||||
q = 9;
|
||||
Fixed t = from_integer (LongLong (q)) * rhs;
|
||||
t.scale_ = this->scale_;
|
||||
for (int i = 0; i < 2 && t > *this; ++i)
|
||||
{
|
||||
--q;
|
||||
|
||||
Reference in New Issue
Block a user