Better Fibonacci sequence calculation I attempted to make better Fibonacci sequence calculation algorithm in C++. This was the best I could:

constexpr unsigned fibonacci(unsigned n) {
    unsigned result[2] = {1, 0};
    for (unsigned i = 1; i &lt; n; ++i)
        result[i%2] = result[0] + result[1];
    return result[1 - n%2];
}


...which runs at O(n) time complexity and O(1) space complexity.
Is there any better?
(Uh-oh: better - better define a quality measure!)  


Your code doesn't tell what it's about.  
constexpr looks good - "my" environment complains with C++11.  
"The array&amp;index manipulation" where "simultaneous assignment" is wanted is hard to read (could be worse: the elements of result[] could be non-interchangeable).
Alas, what I found for "modern C++" is ghastly compared to python's a, b = b, a + b. I&nbsp;appreciate the attempt to avoid avoidable assignments; I'm mildly curious if it makes any difference in the code generated by an optimising compiler.  
Is there any better? Well, with output size limited by a constant, there's a tighter limit:
the runtime of your code is in O(1), just as any other.
In a comment, you express concern about the complexity of multiplication. If you accept ("bit-wise") "shift" as a (very) cheap operation, you can take three steps in the Fibonacci sequence at once without an increase in "logic gate complexity":


#include &lt;cstdlib&gt;
#include &lt;tuple&gt;
#include &lt;iostream&gt;

/// Iterates an a,b = b,a+b sequence in steps of three.
//constexpr
static unsigned long tri(int previous, int current, const unsigned int n) {
    if (n &lt; 2)
        return n ? current : previous;
    std::div_t split = std::div(n-2, 3);
    while (0 &lt;= --split.rem)
        std::tie(previous, current)
            = std::make_tuple(current, current+previous);
    unsigned long
        a = current - previous,
        b = current + previous;      
    while (0 &lt;= --split.quot)
        std::tie(a, b) = std::make_tuple(b, (b&lt;&lt;2)+a);

    return b;
}
/// Iterates the Fibonacci sequence in steps of three.
unsigned long fibonacci(const unsigned int n) {
    return tri(0, 1, n);
}
/// Iterates the Lucas numbers in steps of three.
unsigned long lucas(const unsigned int n) {
    return tri(2, 1, n);
}


(For variants using arrays of precomputed elements in stead of "the setup-loop" (and a main()), consult the edit history.)
(b*Phi³ coincidentally can be computed with just two summands (and no other power up to 2³² can).)