Codechange: rename byte to uint8_t (#12308)
This commit is contained in:
@@ -93,14 +93,14 @@ public:
|
||||
* @param size the amount of bytes to allocate.
|
||||
* @return the given amounts of bytes zeroed.
|
||||
*/
|
||||
inline void *operator new(size_t size) { return CallocT<byte>(size); }
|
||||
inline void *operator new(size_t size) { return CallocT<uint8_t>(size); }
|
||||
|
||||
/**
|
||||
* Memory allocator for an array of class instances.
|
||||
* @param size the amount of bytes to allocate.
|
||||
* @return the given amounts of bytes zeroed.
|
||||
*/
|
||||
inline void *operator new[](size_t size) { return CallocT<byte>(size); }
|
||||
inline void *operator new[](size_t size) { return CallocT<uint8_t>(size); }
|
||||
|
||||
/**
|
||||
* Memory release for a single class instance.
|
||||
|
@@ -46,7 +46,7 @@ inline void MemMoveT(T *destination, const T *source, size_t num = 1)
|
||||
* @param num number of items to be set (!not number of bytes!)
|
||||
*/
|
||||
template <typename T>
|
||||
inline void MemSetT(T *ptr, byte value, size_t num = 1)
|
||||
inline void MemSetT(T *ptr, uint8_t value, size_t num = 1)
|
||||
{
|
||||
memset(ptr, value, num * sizeof(T));
|
||||
}
|
||||
|
@@ -140,7 +140,7 @@ public:
|
||||
inline constexpr OverflowSafeInt operator * (const int factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; }
|
||||
inline constexpr OverflowSafeInt operator * (const uint factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; }
|
||||
inline constexpr OverflowSafeInt operator * (const uint16_t factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; }
|
||||
inline constexpr OverflowSafeInt operator * (const byte factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; }
|
||||
inline constexpr OverflowSafeInt operator * (const uint8_t factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; }
|
||||
|
||||
/* Operators for division. */
|
||||
inline constexpr OverflowSafeInt& operator /= (const int64_t divisor) { this->m_value /= divisor; return *this; }
|
||||
@@ -200,10 +200,10 @@ template <class T> inline constexpr OverflowSafeInt<T> operator * (const uint a
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator / (const uint a, const OverflowSafeInt<T> b) { return (OverflowSafeInt<T>)a / (int)b; }
|
||||
|
||||
/* Sometimes we got byte operator OverflowSafeInt instead of vice versa. Handle that properly. */
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator + (const byte a, const OverflowSafeInt<T> b) { return b + (uint)a; }
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator - (const byte a, const OverflowSafeInt<T> b) { return -b + (uint)a; }
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator * (const byte a, const OverflowSafeInt<T> b) { return b * (uint)a; }
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator / (const byte a, const OverflowSafeInt<T> b) { return (OverflowSafeInt<T>)a / (int)b; }
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator + (const uint8_t a, const OverflowSafeInt<T> b) { return b + (uint)a; }
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator - (const uint8_t a, const OverflowSafeInt<T> b) { return -b + (uint)a; }
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator * (const uint8_t a, const OverflowSafeInt<T> b) { return b * (uint)a; }
|
||||
template <class T> inline constexpr OverflowSafeInt<T> operator / (const uint8_t a, const OverflowSafeInt<T> b) { return (OverflowSafeInt<T>)a / (int)b; }
|
||||
|
||||
typedef OverflowSafeInt<int64_t> OverflowSafeInt64;
|
||||
typedef OverflowSafeInt<int32_t> OverflowSafeInt32;
|
||||
|
@@ -123,9 +123,9 @@ DEFINE_POOL_METHOD(inline void *)::AllocateItem(size_t size, size_t index)
|
||||
memset((void *)item, 0, sizeof(Titem));
|
||||
}
|
||||
} else if (Tzero) {
|
||||
item = (Titem *)CallocT<byte>(size);
|
||||
item = (Titem *)CallocT<uint8_t>(size);
|
||||
} else {
|
||||
item = (Titem *)MallocT<byte>(size);
|
||||
item = (Titem *)MallocT<uint8_t>(size);
|
||||
}
|
||||
this->data[index] = item;
|
||||
SetBit(this->used_bitmap[index / BITMAP_SIZE], index % BITMAP_SIZE);
|
||||
|
@@ -73,7 +73,7 @@ void SetRandomSeed(uint32_t seed)
|
||||
uint32_t Random(const std::source_location location)
|
||||
{
|
||||
if (_networking && (!_network_server || (NetworkClientSocket::IsValidID(0) && NetworkClientSocket::Get(0)->status != NetworkClientSocket::STATUS_INACTIVE))) {
|
||||
Debug(random, 0, "{:08x}; {:02x}; {:04x}; {:02x}; {}:{}", TimerGameEconomy::date, TimerGameEconomy::date_fract, _frame_counter, (byte)_current_company, location.file_name(), location.line());
|
||||
Debug(random, 0, "{:08x}; {:02x}; {:04x}; {:02x}; {}:{}", TimerGameEconomy::date, TimerGameEconomy::date_fract, _frame_counter, (uint8_t)_current_company, location.file_name(), location.line());
|
||||
}
|
||||
|
||||
return _random.Next();
|
||||
|
Reference in New Issue
Block a user