mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-31 11:41:59 +02:00
Update to v106r58 release.
byuu says: The main thing I worked on today was emulating the MBC7 EEPROM. And... I have many things to say about that, but not here, and not now... The missing EEPROM support is why the accelerometer was broken. Although it's not evidently clear that I'm emulating the actual values incorrectly. I'll think about it and get it fixed, though. bsnes went from ~308fps to ~328fps, and I don't even know why. Probably something somewhere in the 140KB of changes to other things made in this WIP.
This commit is contained in:
@@ -2,6 +2,14 @@
|
||||
|
||||
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);
|
||||
@@ -23,20 +31,20 @@ template<typename T> vector<T>::operator bool() const {
|
||||
return _size;
|
||||
}
|
||||
|
||||
template<typename T> auto vector<T>::capacity() const -> uint {
|
||||
return _left + _size + _right;
|
||||
template<typename T> template<typename Cast> auto vector<T>::capacity() const -> uint {
|
||||
return (_left + _size + _right) * sizeof(T) / sizeof(Cast);
|
||||
}
|
||||
|
||||
template<typename T> auto vector<T>::size() const -> uint {
|
||||
return _size;
|
||||
template<typename T> template<typename Cast> auto vector<T>::size() const -> uint {
|
||||
return _size * sizeof(T) / sizeof(Cast);
|
||||
}
|
||||
|
||||
template<typename T> auto vector<T>::data() -> T* {
|
||||
return _pool;
|
||||
template<typename T> template<typename Cast> auto vector<T>::data(uint offset) -> Cast* {
|
||||
return (Cast*)_pool + offset;
|
||||
}
|
||||
|
||||
template<typename T> auto vector<T>::data() const -> const T* {
|
||||
return _pool;
|
||||
template<typename T> template<typename Cast> auto vector<T>::data(uint offset) const -> const Cast* {
|
||||
return (const Cast*)_pool + offset;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,6 +16,16 @@ template<typename T> auto vector<T>::find(const T& value) const -> maybe<uint> {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
template<typename T> auto vector<T>::findSorted(const T& value) const -> maybe<uint> {
|
||||
int l = 0, r = size() - 1;
|
||||
while(l <= r) {
|
||||
int m = l + (r - l >> 1);
|
||||
if(value == _pool[m]) return m;
|
||||
value < _pool[m] ? r = m - 1 : l = m + 1;
|
||||
}
|
||||
return nothing;
|
||||
}
|
||||
|
||||
template<typename T> auto vector<T>::foreach(const function<void (const T&)>& callback) -> void {
|
||||
for(uint n : range(size())) callback(_pool[n]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user