mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-31 02:00:27 +02:00
Update to v106r84 release.
byuu says: Changelog: - fixed a few TLCS900H CPU and disassembler bugs - hooked up a basic Neo Geo Pocket emulator skeleton and memory map; can run a few instructions from the BIOS - emulated the flash memory used by Neo Geo Pocket games - added sourcery to the higan source archives - fixed ternary expressions in sfc/ppu-fast [hex_usr]
This commit is contained in:
@@ -61,7 +61,7 @@ namespace bit {
|
||||
//count number of bits set in a byte
|
||||
inline auto count(uintmax x) -> uint {
|
||||
uint count = 0;
|
||||
do count += x & 1; while(x >>= 1);
|
||||
while(x) x &= x - 1, count++; //clear the least significant bit
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#warning "these defines break if statements with multiple parameters to templates"
|
||||
|
||||
#define if1(statement) if(statement)
|
||||
#define if2(condition, false) ([](auto&& value) -> decltype(condition) { \
|
||||
#define if2(condition, false) ([&](auto&& value) -> decltype(condition) { \
|
||||
return (bool)value ? value : (decltype(condition))false; \
|
||||
})(condition)
|
||||
#define if3(condition, true, false) ((condition) ? (true) : (decltype(true))(false))
|
||||
|
20
nall/literals.hpp
Normal file
20
nall/literals.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
namespace nall {
|
||||
|
||||
inline constexpr auto operator"" _Kibit(unsigned long long value) { return value * 1024 / 8; }
|
||||
inline constexpr auto operator"" _Mibit(unsigned long long value) { return value * 1024 * 1024 / 8; }
|
||||
inline constexpr auto operator"" _Gibit(unsigned long long value) { return value * 1024 * 1024 * 1024 / 8; }
|
||||
inline constexpr auto operator"" _Tibit(unsigned long long value) { return value * 1024 * 1024 * 1024 * 1024 / 8; }
|
||||
|
||||
inline constexpr auto operator"" _KiB(unsigned long long value) { return value * 1024; }
|
||||
inline constexpr auto operator"" _MiB(unsigned long long value) { return value * 1024 * 1024; }
|
||||
inline constexpr auto operator"" _GiB(unsigned long long value) { return value * 1024 * 1024 * 1024; }
|
||||
inline constexpr auto operator"" _TiB(unsigned long long value) { return value * 1024 * 1024 * 1024 * 1024; }
|
||||
|
||||
inline constexpr auto operator"" _KHz(unsigned long long value) { return value * 1000; }
|
||||
inline constexpr auto operator"" _MHz(unsigned long long value) { return value * 1000 * 1000; }
|
||||
inline constexpr auto operator"" _GHz(unsigned long long value) { return value * 1000 * 1000 * 1000; }
|
||||
inline constexpr auto operator"" _THz(unsigned long long value) { return value * 1000 * 1000 * 1000 * 1000; }
|
||||
|
||||
}
|
@@ -39,6 +39,7 @@
|
||||
#include <nall/interpolation.hpp>
|
||||
#include <nall/intrinsics.hpp>
|
||||
#include <nall/iterator.hpp>
|
||||
#include <nall/literals.hpp>
|
||||
#include <nall/locale.hpp>
|
||||
#include <nall/location.hpp>
|
||||
#include <nall/map.hpp>
|
||||
|
@@ -28,10 +28,10 @@ template<uint Precision = 64> struct Integer {
|
||||
inline auto& operator++() { data = mask(data + 1); return *this; }
|
||||
inline auto& operator--() { data = mask(data - 1); return *this; }
|
||||
|
||||
inline auto operator!() const { return Integer{!data}; }
|
||||
inline auto operator~() const { return Integer{~data}; }
|
||||
inline auto operator+() const { return Integer<>{+(int64_t)data}; }
|
||||
inline auto operator-() const { return Integer<>{-(int64_t)data}; }
|
||||
inline auto operator!() const { return !data; }
|
||||
inline auto operator~() const { return Integer<>{mask(~data)}; }
|
||||
inline auto operator+() const { return Integer<>{+data}; }
|
||||
inline auto operator-() const { return Integer<>{data == sign() ? data : -data}; }
|
||||
|
||||
#define lhs data
|
||||
#define rhs value
|
||||
@@ -49,11 +49,6 @@ template<uint Precision = 64> struct Integer {
|
||||
#undef lhs
|
||||
#undef rhs
|
||||
|
||||
#define lhs (int64_t)data
|
||||
#define rhs value
|
||||
#undef lhs
|
||||
#undef rhs
|
||||
|
||||
//warning: this does not and cannot short-circuit; value is always evaluated
|
||||
template<typename T> inline auto orElse(const T& value) { return Integer<>{data ? data : value}; }
|
||||
|
||||
|
@@ -26,9 +26,9 @@ template<uint Precision = 64> struct Natural {
|
||||
inline auto& operator++() { data = mask(data + 1); return *this; }
|
||||
inline auto& operator--() { data = mask(data - 1); return *this; }
|
||||
|
||||
inline auto operator!() const { return Natural{!data}; }
|
||||
inline auto operator~() const { return Natural{~data}; }
|
||||
inline auto operator+() const { return Natural<>{+(uint64_t)data}; }
|
||||
inline auto operator!() const { return !data; }
|
||||
inline auto operator~() const { return Natural<>{mask(~data)}; }
|
||||
inline auto operator+() const { return Natural<>{+data}; }
|
||||
inline auto operator-() const { return Natural<>{-(uint64_t)data}; }
|
||||
|
||||
#define lhs data
|
||||
|
Reference in New Issue
Block a user