Formatting: force pointers to the left side.

This commit is contained in:
Ben Vanik
2015-06-30 16:16:33 -07:00
parent 90e86d0172
commit d7a5c74bf3
12 changed files with 478 additions and 481 deletions

View File

@@ -61,12 +61,12 @@ inline uint64_t byte_swap(uint64_t value) {
return XENIA_BASE_BYTE_SWAP_64(value);
}
inline float byte_swap(float value) {
uint32_t temp = byte_swap(*reinterpret_cast<uint32_t *>(&value));
return *reinterpret_cast<float *>(&temp);
uint32_t temp = byte_swap(*reinterpret_cast<uint32_t*>(&value));
return *reinterpret_cast<float*>(&temp);
}
inline double byte_swap(double value) {
uint64_t temp = byte_swap(*reinterpret_cast<uint64_t *>(&value));
return *reinterpret_cast<double *>(&temp);
uint64_t temp = byte_swap(*reinterpret_cast<uint64_t*>(&value));
return *reinterpret_cast<double*>(&temp);
}
template <typename T>
inline T byte_swap(T value) {
@@ -80,19 +80,19 @@ inline T byte_swap(T value) {
template <typename T>
struct be {
be() = default;
be(const T &src) : value(xe::byte_swap(src)) {}
be(const be &other) { value = other.value; }
be(const T& src) : value(xe::byte_swap(src)) {}
be(const be& other) { value = other.value; }
operator T() const { return xe::byte_swap(value); }
be<T> &operator+=(int a) {
be<T>& operator+=(int a) {
*this = *this + a;
return *this;
}
be<T> &operator-=(int a) {
be<T>& operator-=(int a) {
*this = *this - a;
return *this;
}
be<T> &operator++() {
be<T>& operator++() {
*this += 1;
return *this;
} // ++a
@@ -100,7 +100,7 @@ struct be {
*this += 1;
return (*this - 1);
} // a++
be<T> &operator--() {
be<T>& operator--() {
*this -= 1;
return *this;
} // --a

View File

@@ -25,7 +25,7 @@ bool IsDebuggerAttached();
// If no debugger is present, a signal will be raised.
void Break();
void DebugPrint(const char *fmt, ...);
void DebugPrint(const char* fmt, ...);
} // namespace debugging
} // namespace xe

View File

@@ -19,7 +19,7 @@ bool IsDebuggerAttached() { return IsDebuggerPresent() ? true : false; }
void Break() { __debugbreak(); }
void DebugPrint(const char *fmt, ...) {
void DebugPrint(const char* fmt, ...) {
StringBuffer buff;
va_list va;

View File

@@ -16,7 +16,7 @@ namespace xe {
// Copyright (c) Microsoft Corporation. All rights reserved.
uint16_t float_to_half(float value) {
uint32_t Result;
uint32_t IValue = ((uint32_t *)(&value))[0];
uint32_t IValue = ((uint32_t*)(&value))[0];
uint32_t Sign = (IValue & 0x80000000U) >> 16U;
IValue = IValue & 0x7FFFFFFFU; // Hack off the sign
if (IValue > 0x47FFEFFFU) {
@@ -63,7 +63,7 @@ float half_to_float(uint16_t value) {
uint32_t Result = ((value & 0x8000) << 16) | // Sign
((Exponent + 112) << 23) | // Exponent
(Mantissa << 13); // Mantissa
return *(float *)&Result;
return *(float*)&Result;
}
} // namespace xe