mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-30 15:43:19 -04:00
Merge branch 'main' of https://github.com/zeldaret/tp
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef BINARY_H
|
||||
#define BINARY_H
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JGadget/search.h"
|
||||
|
||||
@@ -14,7 +15,12 @@ struct TEBit {
|
||||
const void* parseVariableUInt_16_32_following(const void* pu16, u32* pu32First, u32* pu32Second,
|
||||
TEBit* tebit);
|
||||
|
||||
inline bool isPower2(unsigned int arg0) {
|
||||
return arg0 != 0 && (arg0 & arg0 - 1) == 0;
|
||||
}
|
||||
|
||||
inline u32 align_roundUp(unsigned int arg0, unsigned int uAlign) {
|
||||
JUT_ASSERT(98, isPower2(uAlign));
|
||||
return (arg0 + uAlign - 1) & ~(uAlign - 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ struct TLinkList : TNodeLinkList {
|
||||
iterator end() { return iterator(TNodeLinkList::end()); }
|
||||
const_iterator end() const { return const_iterator(const_cast<TLinkList*>(this)->end()); }
|
||||
T& front() { return *begin(); }
|
||||
T& back() { return *--end(); }
|
||||
T& back() { JUT_ASSERT(652, !empty()); return *--end(); }
|
||||
void pop_front() { erase(TNodeLinkList::begin()); }
|
||||
void Push_front(T* element) { Insert(begin(), element); }
|
||||
void Push_back(T* element) { Insert(end(), element); }
|
||||
|
||||
@@ -111,14 +111,14 @@ inline Iterator findUpperBound_binary_end(Iterator first, Iterator last, const T
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename Predicate>
|
||||
Iterator findUpperBound_binary_current(Iterator first, Iterator last, Iterator current, const T& val, Predicate p) {
|
||||
inline Iterator findUpperBound_binary_current(Iterator first, Iterator last, Iterator current, const T& val, Predicate p) {
|
||||
return current == last || p(val, *current) ?
|
||||
findUpperBound_binary_end(first, current, val, p) :
|
||||
findUpperBound_binary_begin(current, last, val, p);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T>
|
||||
Iterator findUpperBound_binary_current(Iterator first, Iterator last, Iterator current, const T& val) {
|
||||
inline Iterator findUpperBound_binary_current(Iterator first, Iterator last, Iterator current, const T& val) {
|
||||
return findUpperBound_binary_current(first, last, current, val, std::less<T>());
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ struct TVector_pointer_void : TVector<void*, TAllocator> {
|
||||
void insert(void**, void* const&);
|
||||
|
||||
void clear() { erase(begin(), end()); }
|
||||
void push_back(const void*& ref) { insert(end(), (void* const&)ref); }
|
||||
void push_back(void* const& ref) { insert(end(), ref); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@@ -66,7 +66,7 @@ struct TVector_pointer : TVector_pointer_void {
|
||||
T* end() { return (T*)TVector_pointer_void::end(); }
|
||||
|
||||
void push_back(const T& ref) {
|
||||
static_cast<TVector_pointer_void*>(this)->push_back((const void*&)ref);
|
||||
static_cast<TVector_pointer_void*>(this)->push_back(ref);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user