Flesh out new file store's alloc

This commit is contained in:
2018-03-06 23:07:39 -06:00
parent c5bf8591e3
commit 3151b5508e
8 changed files with 204 additions and 72 deletions

View File

@@ -10,7 +10,7 @@
void oxAssert(const char *file, int line, bool pass, const char *msg);
#ifdef NDEBUG
#ifndef NDEBUG
#define ox_assert(pass, msg) oxAssert(__FILE__, __LINE__, pass, msg)
#else
#define ox_assert(pass, msg)

View File

@@ -86,10 +86,19 @@ class __attribute__((packed)) LittleEndian {
public:
inline LittleEndian() = default;
inline LittleEndian(const LittleEndian &other) {
m_value = other.m_value;
}
inline LittleEndian(T value) {
m_value = ox::bigEndianAdapt(value);
}
inline const LittleEndian &operator=(const LittleEndian &other) {
m_value = other.m_value;
return *this;
}
inline T operator=(T value) {
m_value = ox::bigEndianAdapt(value);
return value;
@@ -99,41 +108,29 @@ class __attribute__((packed)) LittleEndian {
return ox::bigEndianAdapt(m_value);
}
inline T operator+(T value) const {
return ox::bigEndianAdapt(m_value) + value;
}
inline T operator+=(T other) {
template<typename I>
inline T operator+=(I other) {
auto newVal = *this + other;
m_value = ox::bigEndianAdapt(newVal);
return newVal;
}
inline T operator-(T value) const {
return ox::bigEndianAdapt(m_value) - value;
}
inline T operator-=(T other) {
template<typename I>
inline T operator-=(I other) {
auto newVal = *this - other;
m_value = ox::bigEndianAdapt(newVal);
return newVal;
}
inline T operator*(T value) const {
return ox::bigEndianAdapt(m_value) * value;
}
inline T operator*=(T other) {
template<typename I>
inline T operator*=(I other) {
auto newVal = *this * other;
m_value = ox::bigEndianAdapt(newVal);
return newVal;
}
inline T operator/(T value) const {
return ox::bigEndianAdapt(m_value) / value;
}
inline T operator/=(T other) {
template<typename I>
inline T operator/=(I other) {
auto newVal = *this / other;
m_value = ox::bigEndianAdapt(newVal);
return newVal;