Oops! Small glitch in the optimized version (missed a bit).

Fixed:

add-bitsets: func [a b /local c i n carry] [
    carry: 0
    c: make bitset! length? a
    repeat i (length? a) [
        n: i - 1
        switch carry + add get-bit a n get-bit b n [
            0 []
            1 [set-bit c n  carry: 0]
            2 [carry: 1]
            3 [set-bit c n  carry: 1]
        ]
    ]
    if carry <> 0 [
        i: 0
        while [bit-set? c i][
            clear-bit c i
            i: i + 1
        ]
        set-bit c i
    ]
    c
]


-- Gregg                         

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to