Update to v106r65 release.

byuu says:

This synchronizes bsnes/higan with many recent internal nall changes.

This will be the last WIP until I am situated in Japan. Apologies for the
bugfixes that didn't get applied yet, I ran out of time.
This commit is contained in:
Tim Allen
2018-10-04 20:11:23 +10:00
parent 336d20123f
commit 03b06257d3
75 changed files with 2242 additions and 1371 deletions

View File

@@ -2,14 +2,6 @@
namespace nall {
template<typename T> vector<T>::vector(Literal::Capacity capacity) {
reserve(capacity.value);
}
template<typename T> vector<T>::vector(Literal::Size size) {
resize(size.value);
}
template<typename T> vector<T>::vector(const initializer_list<T>& values) {
reserveRight(values.size());
for(auto& value : values) append(value);

View File

@@ -119,7 +119,7 @@ template<typename T> auto vector<T>::resizeLeft(uint size, const T& value) -> bo
if(size > _size) { //grow
reserveLeft(size);
_pool -= size - _size;
for(uint n : reverse(range(size - _size))) new(_pool + n) T(value);
for(uint n : nall::reverse(range(size - _size))) new(_pool + n) T(value);
_left -= size - _size;
_size = size;
return true;

View File

@@ -11,7 +11,27 @@ template<> struct vector<uint8_t> : vector_base<uint8_t> {
}
template<typename U> auto appendm(U value, uint size) -> void {
for(uint byte : reverse(range(size))) append(uint8_t(value >> byte * 8));
for(uint byte : nall::reverse(range(size))) append(uint8_t(value >> byte * 8));
}
//note: string_view is not declared here yet ...
auto appends(array_view<uint8_t> memory) -> void {
for(uint8_t byte : memory) append(byte);
}
template<typename U> auto readl(int offset, uint size) -> U {
if(offset < 0) offset = this->size() - abs(offset);
U value = 0;
for(uint byte : range(size)) value |= (U)operator[](offset + byte) << byte * 8;
return value;
}
auto view(uint offset, uint length) -> array_view<uint8_t> {
#ifdef DEBUG
struct out_of_bounds {};
if(offset + length >= size()) throw out_of_bounds{};
#endif
return {data() + offset, length};
}
};

View File

@@ -10,6 +10,12 @@ template<typename T> auto vector<T>::sort(const function<bool (const T& lhs, con
nall::sort(_pool, _size, comparator);
}
template<typename T> auto vector<T>::reverse() -> void {
vector<T> reversed;
for(uint n : range(size())) reversed.prepend(_pool[n]);
operator=(move(reversed));
}
template<typename T> auto vector<T>::find(const function<bool (const T& lhs)>& comparator) -> maybe<uint> {
for(uint n : range(size())) if(comparator(_pool[n])) return n;
return nothing;