mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-20 09:11:23 +02:00
Update to v101r02 release.
byuu says: Changelog: - Emulator: use `(uintmax)-1 >> 1` for the units of time - MD: implemented 13 new 68K instructions (basically all of the remaining easy ones); 21 remain - nall: replaced `(u)intmax_t` (64-bit) with *actual* `(u)intmax` type (128-bit where available) - this extends to everything: atoi, string, etc. You can even print 128-bit variables if you like 22,552 opcodes still don't exist in the 68K map. Looking like quite a few entries will be blank once I finish.
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace nall {
|
||||
|
||||
auto string::integer() const -> intmax_t {
|
||||
auto string::integer() const -> intmax {
|
||||
return toInteger(data());
|
||||
}
|
||||
|
||||
auto string::natural() const -> uintmax_t {
|
||||
auto string::natural() const -> uintmax {
|
||||
return toNatural(data());
|
||||
}
|
||||
|
||||
auto string::hex() const -> uintmax_t {
|
||||
auto string::hex() const -> uintmax {
|
||||
return toHex(data());
|
||||
}
|
||||
|
||||
|
@@ -67,6 +67,15 @@ template<> struct stringify<signed long long> {
|
||||
char _data[2 + sizeof(signed long long) * 3];
|
||||
};
|
||||
|
||||
#if INTMAX_BITS >= 128
|
||||
template<> struct stringify<int128_t> {
|
||||
stringify(int128_t source) { fromInteger(_data, source); }
|
||||
auto data() const -> const char* { return _data; }
|
||||
auto size() const -> uint { return strlen(_data); }
|
||||
char _data[2 + sizeof(int128_t) * 3];
|
||||
};
|
||||
#endif
|
||||
|
||||
template<uint Bits> struct stringify<Integer<Bits>> {
|
||||
stringify(Integer<Bits> source) { fromInteger(_data, source); }
|
||||
auto data() const -> const char* { return _data; }
|
||||
@@ -111,6 +120,15 @@ template<> struct stringify<unsigned long long> {
|
||||
char _data[1 + sizeof(unsigned long long) * 3];
|
||||
};
|
||||
|
||||
#if INTMAX_BITS >= 128
|
||||
template<> struct stringify<uint128_t> {
|
||||
stringify(uint128_t source) { fromNatural(_data, source); }
|
||||
auto data() const -> const char* { return _data; }
|
||||
auto size() const -> uint { return strlen(_data); }
|
||||
char _data[1 + sizeof(uint128_t) * 3];
|
||||
};
|
||||
#endif
|
||||
|
||||
template<uint Bits> struct stringify<Natural<Bits>> {
|
||||
stringify(Natural<Bits> source) { fromNatural(_data, source); }
|
||||
auto data() const -> const char* { return _data; }
|
||||
|
@@ -84,9 +84,9 @@ template<typename T> auto pad(const T& value, long precision, char padchar) -> s
|
||||
return buffer;
|
||||
}
|
||||
|
||||
auto hex(uintmax_t value, long precision, char padchar) -> string {
|
||||
auto hex(uintmax value, long precision, char padchar) -> string {
|
||||
string buffer;
|
||||
buffer.resize(sizeof(uintmax_t) * 2);
|
||||
buffer.resize(sizeof(uintmax) * 2);
|
||||
char* p = buffer.get();
|
||||
|
||||
uint size = 0;
|
||||
@@ -101,9 +101,9 @@ auto hex(uintmax_t value, long precision, char padchar) -> string {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
auto octal(uintmax_t value, long precision, char padchar) -> string {
|
||||
auto octal(uintmax value, long precision, char padchar) -> string {
|
||||
string buffer;
|
||||
buffer.resize(sizeof(uintmax_t) * 3);
|
||||
buffer.resize(sizeof(uintmax) * 3);
|
||||
char* p = buffer.get();
|
||||
|
||||
uint size = 0;
|
||||
@@ -117,9 +117,9 @@ auto octal(uintmax_t value, long precision, char padchar) -> string {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
auto binary(uintmax_t value, long precision, char padchar) -> string {
|
||||
auto binary(uintmax value, long precision, char padchar) -> string {
|
||||
string buffer;
|
||||
buffer.resize(sizeof(uintmax_t) * 8);
|
||||
buffer.resize(sizeof(uintmax) * 8);
|
||||
char* p = buffer.get();
|
||||
|
||||
uint size = 0;
|
||||
@@ -135,10 +135,10 @@ auto binary(uintmax_t value, long precision, char padchar) -> string {
|
||||
|
||||
template<typename T> auto pointer(const T* value, long precision) -> string {
|
||||
if(value == nullptr) return "(nullptr)";
|
||||
return {"0x", hex((uintptr_t)value, precision)};
|
||||
return {"0x", hex((uintptr)value, precision)};
|
||||
}
|
||||
|
||||
auto pointer(uintptr_t value, long precision) -> string {
|
||||
auto pointer(uintptr value, long precision) -> string {
|
||||
if(value == 0) return "(nullptr)";
|
||||
return {"0x", hex(value, precision)};
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ struct ManagedNode {
|
||||
protected:
|
||||
string _name;
|
||||
string _value;
|
||||
uintptr_t _metadata = 0;
|
||||
uintptr _metadata = 0;
|
||||
vector<SharedNode> _children;
|
||||
|
||||
inline auto _evaluate(string query) const -> bool;
|
||||
@@ -59,8 +59,8 @@ struct Node {
|
||||
|
||||
auto text() const -> string { return value().strip(); }
|
||||
auto boolean() const -> bool { return text() == "true"; }
|
||||
auto integer() const -> intmax_t { return text().integer(); }
|
||||
auto natural() const -> uintmax_t { return text().natural(); }
|
||||
auto integer() const -> intmax { return text().integer(); }
|
||||
auto natural() const -> uintmax { return text().natural(); }
|
||||
auto real() const -> double { return text().real(); }
|
||||
|
||||
auto setName(const string& name = "") -> Node& { shared->_name = name; return *this; }
|
||||
|
@@ -92,7 +92,7 @@ auto slice(string_view self, int offset, int length) -> string {
|
||||
return result;
|
||||
}
|
||||
|
||||
auto fromInteger(char* result, intmax_t value) -> char* {
|
||||
auto fromInteger(char* result, intmax value) -> char* {
|
||||
bool negative = value < 0;
|
||||
if(negative) value = -value;
|
||||
|
||||
@@ -111,7 +111,7 @@ auto fromInteger(char* result, intmax_t value) -> char* {
|
||||
return result;
|
||||
}
|
||||
|
||||
auto fromNatural(char* result, uintmax_t value) -> char* {
|
||||
auto fromNatural(char* result, uintmax value) -> char* {
|
||||
char buffer[64];
|
||||
uint size = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user