Skip to content
  • Tim Allen's avatar
    Update to v106r77 release. · bb1dd8c6
    Tim Allen authored
    byuu says:
    
    So this turned out to be a rather unproductive ten-hour rabbit hole, but
    ...
    
    I reworked nall/primitives.hpp a lot. And because the changes are
    massive, testing of this WIP for regressions is critically important. I
    really can't stress that enough, we're almost certainly going to have
    some hidden regressions here ...
    
    We now have a nall/primitives/ subfolder that splits up the classes into
    manageable components. The bit-field support is now shared between both
    Natural and Integer. All of the assignment operator overloads are now
    templated and take references instead of values. Things like the
    GSU::Register class are non-copyable on account of the function<>
    object inside of it, and previously only operator= would work with
    classes like that.
    
    The big change is nall/primitives/operators.hpp, which is a really
    elaborate system to compute the minimum number of bits needed for any
    operation, and to return a Natural<T> or Integer<T> when one or both of
    the arguments are such a type.
    
    Unfortunately, it doesn't really work yet ... Kirby's Dream Land 3
    breaks if we include operators.hpp. Zelda 3 runs fine with this, but I
    had to make a huge amount of core changes, including introducing a new
    ternary(bool, lhs, rhs) function to nall/algorithm to get past
    Natural<X> and Natural<Y> not being equivalent (is_integral types get a
    special exemption to ternary ?: type equivalence, yet it's impossible to
    simulate with our own classes, which is bullshit.) The horrifying part
    is that ternary() will evaluate both lhs and rhs, unlike ?:
    
    I converted some of the functions to test ? uint(x) : uint(y), and
    others to ternary(test, x, y) ... I don't have a strong preference
    either way yet.
    
    But the part where things may have gotten broken is in the changes to
    where ternary() was placed. Some cases like in the GBA PPU renderer, it
    was rather unclear the order of evaluations, so I may have made a
    mistake somewhere.
    
    So again, please please test this if you can. Or even better, look over
    the diff.
    
    Longer-term, I'd really like the enable nall/primitives/operators.hpp,
    but right now I'm not sure why Kirby's Dream Land 3 is breaking. Help
    would be appreciated, but ... it's gonna be really complex and difficult
    to debug, so I'm probably gonna be on my own here ... sigh.
    bb1dd8c6