Update to v106r30 release.

byuu says:

Changelog:

  - nall/GNUmakefile: fixed findstring parameter arguments [Screwtape]
  - nall/Windows: always include -mthreads -lpthread for all
    applications
  - nall/memory: code restructuring

I really wanted to work on the new PPU today, but I thought I'd spend a
few minutes making some minor improvements to nall::memory, that was
five and a half hours ago. Now I have a 67KiB diff of changes. Sigh.
This commit is contained in:
Tim Allen
2018-05-28 11:16:27 +10:00
parent 6882bd98cf
commit 685cec6583
73 changed files with 372 additions and 389 deletions

View File

@@ -96,7 +96,7 @@ auto string::operator=(string&& source) -> type& {
auto string::_allocate() -> void {
char _temp[SSO];
memory::copy(_temp, _text, SSO);
_data = (char*)memory::allocate(_capacity + 1 + sizeof(uint));
_data = memory::allocate<char>(_capacity + 1 + sizeof(uint));
memory::copy(_data, _temp, SSO);
_refs = (uint*)(_data + _capacity + 1); //always aligned by 32 via reserve()
*_refs = 1;
@@ -104,7 +104,7 @@ auto string::_allocate() -> void {
//COW -> Unique
auto string::_copy() -> void {
auto _temp = (char*)memory::allocate(_capacity + 1 + sizeof(uint));
auto _temp = memory::allocate<char>(_capacity + 1 + sizeof(uint));
memory::copy(_temp, _data, _size = min(_capacity, _size));
_temp[_size] = 0;
--*_refs;
@@ -115,7 +115,7 @@ auto string::_copy() -> void {
//COW -> Resize
auto string::_resize() -> void {
_data = (char*)memory::resize(_data, _capacity + 1 + sizeof(uint));
_data = memory::resize<char>(_data, _capacity + 1 + sizeof(uint));
_refs = (uint*)(_data + _capacity + 1);
*_refs = 1;
}

View File

@@ -70,7 +70,7 @@ auto string::operator=(string&& source) -> string& {
}
auto string::_allocate() -> char* {
auto _temp = (char*)memory::allocate(_capacity + 1 + sizeof(uint));
auto _temp = memory::allocate<char>(_capacity + 1 + sizeof(uint));
*_temp = 0;
_refs = (uint*)(_temp + _capacity + 1); //this will always be aligned by 32 via reserve()
*_refs = 1;
@@ -78,7 +78,7 @@ auto string::_allocate() -> char* {
}
auto string::_copy() -> char* {
auto _temp = (char*)memory::allocate(_capacity + 1 + sizeof(uint));
auto _temp = memory::allocate<char>(_capacity + 1 + sizeof(uint));
memory::copy(_temp, _data, _size = min(_capacity, _size));
_temp[_size] = 0;
--*_refs;

View File

@@ -50,10 +50,10 @@ auto string::reserve(uint capacity) -> type& {
if(_capacity < SSO) {
char _temp[SSO];
memory::copy(_temp, _text, SSO);
_data = (char*)memory::allocate(_capacity = capacity + 1);
_data = memory::allocate<char>(_capacity = capacity + 1);
memory::copy(_data, _temp, SSO);
} else {
_data = (char*)memory::resize(_data, _capacity = capacity + 1);
_data = memory::resize<char>(_data, _capacity = capacity + 1);
}
return *this;
}
@@ -68,7 +68,7 @@ auto string::operator=(const string& source) -> type& {
if(&source == this) return *this;
reset();
if(source._capacity >= SSO) {
_data = (char*)memory::allocate(source._capacity + 1);
_data = memory::allocate<char>(source._capacity + 1);
_capacity = source._capacity;
_size = source._size;
memory::copy(_data, source._data, source._size + 1);

View File

@@ -39,7 +39,7 @@ auto string::reset() -> type& {
auto string::reserve(uint capacity) -> type& {
if(capacity > _capacity) {
_capacity = bit::round(capacity + 1) - 1;
_data = (char*)memory::resize(_data, _capacity + 1);
_data = memory::resize<char>(_data, _capacity + 1);
_data[_capacity] = 0;
}
return *this;
@@ -54,7 +54,7 @@ auto string::resize(uint size) -> type& {
auto string::operator=(const string& source) -> type& {
if(&source == this) return *this;
reset();
_data = (char*)memory::allocate(source._size + 1);
_data = memory::allocate<char>(source._size + 1);
_capacity = source._size;
_size = source._size;
memory::copy(_data, source.data(), source.size() + 1);

View File

@@ -7,7 +7,7 @@ namespace nall {
auto string::format(const nall::string_format& params) -> type& {
auto size = (int)this->size();
auto data = (char*)memory::allocate(size);
auto data = memory::allocate<char>(size);
memory::copy(data, this->data(), size);
int x = 0;