{"capsule":{"id":"70fd398d5cec67b2e369c9e97ef60def","name":"gcd_binary_u32","domain":"math","source_code":"/// Binary (Stein's) GCD for `u32`: subtraction and shifts, no division.\n///\n/// The modulo loop it replaces costs ~288 cycles/op on this board because\n/// every `%` is a real divide. Stein's algorithm needs none: strip the common\n/// power of two, then repeatedly subtract the smaller from the larger and\n/// discard the factors of two. Same result for every input, including\n/// `gcd(0, 0) = 0`, and it terminates because the larger operand strictly\n/// decreases each round.\npub const fn gcd_binary_u32(mut a: u32, mut b: u32) -> u32 {\n    if a == 0 {\n        return b;\n    }\n    if b == 0 {\n        return a;\n    }\n    let shift = (a | b).trailing_zeros();\n    a >>= a.trailing_zeros();\n    loop {\n        b >>= b.trailing_zeros();\n        if a > b {\n            let tmp = a;\n            a = b;\n            b = tmp;\n        }\n        b -= a;\n        if b == 0 {\n            return a << shift;\n        }\n    }\n}","inputs":[{"name":"a","pin_type":"u32","direction":"input"},{"name":"b","pin_type":"u32","direction":"input"}],"output":{"name":"out","pin_type":"u32","direction":"output"},"signature_key":"(u32,u32)->u32","c64_report":{"code_bytes":914,"ram_budget_ratio":{"num":457,"den":32768},"fits_fast_page":true,"ast_node_count":60,"zero_unsafe":true,"zero_external_crates":true,"zero_floats":true},"marine_salience":{"peak_count":20,"period_jitter":{"num":29,"den":216},"amplitude_jitter":{"num":707,"den":3705},"combined_jitter":{"num":86719,"den":533520},"salience_score":{"num":2234005,"den":26676},"salience_trit":"Pos","wave_signature":{"frequencies_hz":[475,864,1425,2419,4104,3369,3024,4147],"phases_mrad":[687,0,1278,6262,3622,1966,0,1869],"amplitudes":[83,8,62,53,49,41,8,29],"interference_hash":[33,155,7,24,235,56,237,73,191,94,22,190,137,27,166,76,216,218,230,137,75,46,213,188,163,255,228,235,36,32,97,12]}},"author_aye":"aye::Peter+Omni(0+1)::aarch64","author_resonance_hz":432,"published_epoch_ns":1794918519135083024,"compiled_text_bytes":75,"asm_instruction_count":27,"asm_preview":"gcd_binary_u32:\n    mov    eax, esi\n    test    edi, edi\n    je    .LBB7_3\n    test    eax, eax\n    je    .LBB7_2\n    rep        bsf    ecx, edi\n    mov    edx, edi\n    shr    edx, cl\n    mov    esi, eax\n.LBB7_5:\n    mov    r8d, edx\n    rep        bsf    ecx, esi\n    shr    esi, cl\n    mov    ecx, edx\n    sub    ecx, esi\n    mov    edx, esi\n    cmovb    edx, r8d\n    sub    esi, r8d\n    cmovb    esi, ecx\n    test    esi, esi\n    jne    .LBB7_5\n    or    eax, edi\n    rep        bsf    ecx, eax\n    shl    edx, cl\n    mov    eax, edx\n    ret\n.LBB7_2:\n    mov    eax, edi\n.LBB7_3:\n    ret","output_digest_blake3":"eb3e1ec8f830d4b3d48692b56997e674"},"efficiency":{"capsule_id":"70fd398d5cec67b2e369c9e97ef60def","vote_count":1,"total_historical_votes":1,"net_trit_score":1,"net_trit_balanced":"+","consensus_trit":"Pos","speed_ops_per_us":{"num":200000000,"den":9206271},"ns_per_op":{"num":9206271,"den":200000},"cycles_per_op":{"num":29457667,"den":200000},"c64_memory_ratio":{"num":75,"den":65536},"timing_salience":{"num":7279327994006842828,"den":75340935415396327},"efficiency_index":{"num":2033820746654693827,"den":64597378375719850}},"ns_per_op_pq":"9206271/200000","speed_ops_per_us_pq":"200000000/9206271","cycles_per_op_pq":"29457667/200000","marine_salience_pq":"2234005/26676","vote_trits":"+","equivalence_class":"(u32,u32)->u32::eb3e1ec8f830"}