mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
byuu says: Changelog: - nall: converted range, iterator, vector to 64-bit - added (very poor) ColecoVision emulation (including Coleco Adam expansion) - added MSX skeleton - added Neo Geo Pocket skeleton - moved audio,video,resource folders into emulator folder - SFC heuristics: BS-X Town cart is "ZBSJ" [hex_usr] The nall change is for future work on things like BPA: I need to be able to handle files larger than 4GB. It is extremely possible that there are still some truncations to 32-bit lurking around, and even more disastrously, possibly some -1s lurking that won't sign-extend to `(uint64_t)0-1`. There's a lot more classes left to do: `string`, `array_view`, `array_span`, etc.
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#pragma once
|
|
|
|
namespace nall {
|
|
|
|
template<typename T> auto vector<T>::operator[](uint64_t offset) -> T& {
|
|
#ifdef DEBUG
|
|
struct out_of_bounds {};
|
|
if(offset >= size()) throw out_of_bounds{};
|
|
#endif
|
|
return _pool[offset];
|
|
}
|
|
|
|
template<typename T> auto vector<T>::operator[](uint64_t offset) const -> const T& {
|
|
#ifdef DEBUG
|
|
struct out_of_bounds {};
|
|
if(offset >= size()) throw out_of_bounds{};
|
|
#endif
|
|
return _pool[offset];
|
|
}
|
|
|
|
template<typename T> auto vector<T>::operator()(uint64_t offset) -> T& {
|
|
while(offset >= size()) append(T());
|
|
return _pool[offset];
|
|
}
|
|
|
|
template<typename T> auto vector<T>::operator()(uint64_t offset, const T& value) const -> const T& {
|
|
if(offset >= size()) return value;
|
|
return _pool[offset];
|
|
}
|
|
|
|
template<typename T> auto vector<T>::left() -> T& {
|
|
return _pool[0];
|
|
}
|
|
|
|
template<typename T> auto vector<T>::left() const -> const T& {
|
|
return _pool[0];
|
|
}
|
|
|
|
template<typename T> auto vector<T>::right() -> T& {
|
|
return _pool[_size - 1];
|
|
}
|
|
|
|
template<typename T> auto vector<T>::right() const -> const T& {
|
|
return _pool[_size - 1];
|
|
}
|
|
|
|
}
|