• Re: Cantor pairing... For Moebius...

    From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to sci.logic,sci.math on Mon Jun 15 15:14:32 2026
    From Newsgroup: sci.logic

    On 6/10/2026 8:55 AM, Ross Finlayson wrote:
    On 06/09/2026 03:33 PM, Chris M. Thomasson wrote:
    I tried to code up a quick and dirty way to use Cantor Pairing with
    integers instead of just unsigned. Using a mapping from Moebius in a
    different thread vs traditional unsigned Cantor.

    Its funny... His mapping is giving me different numbers for when the
    pair is two positive integers.
    ____________
    ct_cantor_integer::manifest()
    -a-a Input Pair: (47, 32)

    -a-a === Traditional Unsigned Cantor ===
    -a-a-a-a Resulting Index:-a-a 3192
    -a-a-a-a Unpacked Pair:-a-a-a-a (47, 32)
    -a-a-a-a Verification:-a-a-a-a-a SUCCESS

    -a-a === Moebius Interleaved Signed Cantor ===
    -a-a-a-a Intermediate Nat Index: 12625
    -a-a-a-a Final Mapping (Z):-a-a-a-a-a-a -6313
    -a-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (47, 32)
    -a-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS
    ____________


    Here is 3 and 4:
    ____________
    ct_cantor_integer::manifest()
    -a-a Input Pair: (3, 4)

    -a-a === Traditional Unsigned Cantor ===
    -a-a-a-a Resulting Index:-a-a 32
    -a-a-a-a Unpacked Pair:-a-a-a-a (3, 4)
    -a-a-a-a Verification:-a-a-a-a-a SUCCESS

    -a-a === Moebius Interleaved Signed Cantor ===
    -a-a-a-a Intermediate Nat Index: 113
    -a-a-a-a Final Mapping (Z):-a-a-a-a-a-a -57
    -a-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (3, 4)
    -a-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS
    ____________


    Okay, here is a run using a pair of (-11, 15)... Traditional Cantor
    Pairing does not like that too much?

    Oh it failed, but the integer map worked:
    ____________
    ct_cantor_integer::manifest()
    -a-a Input Pair: (-11, 15)

    -a-a === Traditional Unsigned Cantor ===
    -a-a-a-a Resulting Index:-a-a 25
    -a-a-a-a Unpacked Pair:-a-a-a-a (2, 4)
    -a-a-a-a Verification:-a-a-a-a-a FAILED

    -a-a === Moebius Interleaved Signed Cantor ===
    -a-a-a-a Intermediate Nat Index: 1356
    -a-a-a-a Final Mapping (Z):-a-a-a-a-a-a 678
    -a-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (-11, 15)
    -a-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS
    ____________


    Here is (42, 42), the both should work:
    ____________
    ct_cantor_integer::manifest()
    -a-a Input Pair: (42, 42)

    -a-a === Traditional Unsigned Cantor ===
    -a-a-a-a Resulting Index:-a-a 3612
    -a-a-a-a Unpacked Pair:-a-a-a-a (42, 42)
    -a-a-a-a Verification:-a-a-a-a-a SUCCESS

    -a-a === Moebius Interleaved Signed Cantor ===
    -a-a-a-a Intermediate Nat Index: 14280
    -a-a-a-a Final Mapping (Z):-a-a-a-a-a-a 7140
    -a-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (42, 42)
    -a-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS
    ____________

    Interesting!


    Fwiw, here is my crude code:
    ________________________________
    // For Moebius
    // Quick and crude Cantor mapper.
    // Works with integers, I think.
    // When all the components are positive I can use
    // traditional Cantor Pairing...
    namespace ct_cantor_integer
    {
    -a-a-a-a struct cantor_pair
    -a-a-a-a {
    -a-a-a-a-a-a-a-a int m_a;
    -a-a-a-a-a-a-a-a int m_b;
    -a-a-a-a };

    -a-a-a-a // Fold a signed integer Z into a natural number N
    -a-a-a-a unsigned long long
    -a-a-a-a fold_z_to_n(
    -a-a-a-a-a-a-a-a int z
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a if (z >= 0)
    -a-a-a-a-a-a-a-a {
    -a-a-a-a-a-a-a-a-a-a-a-a return 2ULL * static_cast<unsigned long long>(z); >> -a-a-a-a-a-a-a-a }
    -a-a-a-a-a-a-a-a else
    -a-a-a-a-a-a-a-a {
    -a-a-a-a-a-a-a-a-a-a-a-a long long positive_result = -2LL * static_cast<long >> long>(z) - 1LL;
    -a-a-a-a-a-a-a-a-a-a-a-a return static_cast<unsigned long long>(positive_result);
    -a-a-a-a-a-a-a-a }
    -a-a-a-a }

    -a-a-a-a // Unfold a natural number N back into a signed integer Z
    -a-a-a-a int
    -a-a-a-a unfold_n_to_z(
    -a-a-a-a-a-a-a-a unsigned long long n
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a if (n % 2 == 0)
    -a-a-a-a-a-a-a-a {
    -a-a-a-a-a-a-a-a-a-a-a-a return static_cast<int>(n / 2ULL);
    -a-a-a-a-a-a-a-a }
    -a-a-a-a-a-a-a-a else
    -a-a-a-a-a-a-a-a {
    -a-a-a-a-a-a-a-a-a-a-a-a return static_cast<int>(-static_cast<long long>((n + 1ULL)
    / 2ULL));
    -a-a-a-a-a-a-a-a }
    -a-a-a-a }

    -a-a-a-a // Pure, traditional unsigned Cantor pairing baseline
    -a-a-a-a unsigned long long
    -a-a-a-a traditional_pack(
    -a-a-a-a-a-a-a-a unsigned int x,
    -a-a-a-a-a-a-a-a unsigned int y
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a unsigned long long sum = x + y;
    -a-a-a-a-a-a-a-a return (sum * (sum + 1ULL)) / 2ULL + y;
    -a-a-a-a }

    -a-a-a-a // Traditional unsigned Cantor unpacker
    -a-a-a-a cantor_pair
    -a-a-a-a traditional_unpack(
    -a-a-a-a-a-a-a-a unsigned long long w
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a unsigned long long t = static_cast<unsigned long
    long>((std::sqrt(static_cast<double>(8ULL * w + 1ULL)) - 1.0) / 2.0);
    -a-a-a-a-a-a-a-a unsigned long long tri = (t * (t + 1ULL)) / 2ULL;
    -a-a-a-a-a-a-a-a unsigned long long Y = w - tri;
    -a-a-a-a-a-a-a-a unsigned long long X = t - Y;
    -a-a-a-a-a-a-a-a return { static_cast<int>(X), static_cast<int>(Y) };
    -a-a-a-a }

    -a-a-a-a // Pack two signed integers into a single unique natural number
    (Moebius phase 1)
    -a-a-a-a unsigned long long
    -a-a-a-a pack_pair_signed(
    -a-a-a-a-a-a-a-a int a,
    -a-a-a-a-a-a-a-a int b
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a unsigned long long X = fold_z_to_n(a);
    -a-a-a-a-a-a-a-a unsigned long long Y = fold_z_to_n(b);
    -a-a-a-a-a-a-a-a unsigned long long sum = X + Y;
    -a-a-a-a-a-a-a-a return (sum * (sum + 1ULL)) / 2ULL + Y;
    -a-a-a-a }

    -a-a-a-a // Unpack a single natural number back into a pair of signed
    integers (Moebius phase 2)
    -a-a-a-a cantor_pair unpack_seed_signed(
    -a-a-a-a-a-a-a-a unsigned long long w
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a unsigned long long t = static_cast<unsigned long
    long>((std::sqrt(static_cast<double>(8ULL * w + 1ULL)) - 1.0) / 2.0);
    -a-a-a-a-a-a-a-a unsigned long long tri = (t * (t + 1ULL)) / 2ULL;
    -a-a-a-a-a-a-a-a unsigned long long Y = w - tri;
    -a-a-a-a-a-a-a-a unsigned long long X = t - Y;

    -a-a-a-a-a-a-a-a return { unfold_n_to_z(X), unfold_n_to_z(Y) };
    -a-a-a-a }

    -a-a-a-a void
    -a-a-a-a manifest()
    -a-a-a-a {
    -a-a-a-a-a-a-a-a std::cout << "ct_cantor_integer::manifest()\n";

    -a-a-a-a-a-a-a-a // Testing purely positive inputs to allow comparison with >> traditional
    -a-a-a-a-a-a-a-a int orig_a = 47;
    -a-a-a-a-a-a-a-a int orig_b = 32;
    -a-a-a-a-a-a-a-a std::cout << "-a Input Pair: (" << orig_a << ", " << orig_b <<
    ")\n\n";

    -a-a-a-a-a-a-a-a //
    =====================================================================
    -a-a-a-a-a-a-a-a // TRADITIONAL UNSIGNED CANTOR PIPELINE
    -a-a-a-a-a-a-a-a //
    =====================================================================
    -a-a-a-a-a-a-a-a unsigned long long trad_index = traditional_pack(orig_a, >> orig_b);
    -a-a-a-a-a-a-a-a cantor_pair trad_recovered = traditional_unpack(trad_index);

    -a-a-a-a-a-a-a-a std::cout << "-a === Traditional Unsigned Cantor ===\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Resulting Index:-a-a " << trad_index << "\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Unpacked Pair:-a-a-a-a (" << trad_recovered.m_a
    << ", " << trad_recovered.m_b << ")\n";

    -a-a-a-a-a-a-a-a if (trad_recovered.m_a == orig_a && trad_recovered.m_b == >> orig_b) {
    -a-a-a-a-a-a-a-a-a-a-a-a std::cout << "-a-a-a Verification:-a-a-a-a-a SUCCESS\n\n";
    -a-a-a-a-a-a-a-a }
    -a-a-a-a-a-a-a-a else {
    -a-a-a-a-a-a-a-a-a-a-a-a std::cout << "-a-a-a Verification:-a-a-a-a-a FAILED\n\n";
    -a-a-a-a-a-a-a-a }

    -a-a-a-a-a-a-a-a //
    =====================================================================
    -a-a-a-a-a-a-a-a // MOEBIUS INTERLEAVED SIGNED PIPELINE
    -a-a-a-a-a-a-a-a //
    =====================================================================
    -a-a-a-a-a-a-a-a unsigned long long moebius_nat_index = pack_pair_signed(orig_a,
    orig_b);
    -a-a-a-a-a-a-a-a int moebius_final_integer = unfold_n_to_z(moebius_nat_index);

    -a-a-a-a-a-a-a-a // Reverse the mapping pipeline entirely
    -a-a-a-a-a-a-a-a unsigned long long moebius_recovered_nat =
    fold_z_to_n(moebius_final_integer);
    -a-a-a-a-a-a-a-a cantor_pair moebius_recovered_pair =
    unpack_seed_signed(moebius_recovered_nat);

    -a-a-a-a-a-a-a-a std::cout << "-a === Moebius Interleaved Signed Cantor ===\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Intermediate Nat Index: " <<
    moebius_nat_index << "\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Final Mapping (Z):-a-a-a-a-a-a " <<
    moebius_final_integer << "\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (" <<
    moebius_recovered_pair.m_a << ", " << moebius_recovered_pair.m_b <<
    ")\n";

    -a-a-a-a-a-a-a-a if (moebius_recovered_pair.m_a == orig_a &&
    moebius_recovered_pair.m_b == orig_b) {
    -a-a-a-a-a-a-a-a-a-a-a-a std::cout << "-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS\n";
    -a-a-a-a-a-a-a-a }
    -a-a-a-a-a-a-a-a else {
    -a-a-a-a-a-a-a-a-a-a-a-a std::cout << "-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a FAILED\n";
    -a-a-a-a-a-a-a-a }
    -a-a-a-a }
    }
    ________________________________


    any thoughts? Thanks everybody! :^)

    Why not typedef "unsigned long long" as "ull"?

    Because that is moronic...


    Why not figure out what operator overloads would make sense as an arithmetization and then just use the plain syntax of arithmetic?

    Why not bind a thread-local streams handle to make it so that
    std::cout is not concrete for just plain "out"?

    Yuh? Have you ever used C++ before?


    Why not make for something that's not static casts where it appears
    that the use of static_cast loses precision or overflow?

    This quick code is not meant to be arbitrary precision.


    Why not call this "Galileo pairing" since it was already around for
    hundreds of years?

    The Cantor Pairing aspect? Or the mapping from Moebius?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to sci.logic,sci.math on Mon Jun 15 20:56:58 2026
    From Newsgroup: sci.logic

    On 06/15/2026 03:14 PM, Chris M. Thomasson wrote:
    On 6/10/2026 8:55 AM, Ross Finlayson wrote:
    On 06/09/2026 03:33 PM, Chris M. Thomasson wrote:
    I tried to code up a quick and dirty way to use Cantor Pairing with
    integers instead of just unsigned. Using a mapping from Moebius in a
    different thread vs traditional unsigned Cantor.

    Its funny... His mapping is giving me different numbers for when the
    pair is two positive integers.
    ____________
    ct_cantor_integer::manifest()
    Input Pair: (47, 32)

    === Traditional Unsigned Cantor ===
    Resulting Index: 3192
    Unpacked Pair: (47, 32)
    Verification: SUCCESS

    === Moebius Interleaved Signed Cantor ===
    Intermediate Nat Index: 12625
    Final Mapping (Z): -6313
    Unpacked Pair: (47, 32)
    Verification: SUCCESS
    ____________


    Here is 3 and 4:
    ____________
    ct_cantor_integer::manifest()
    Input Pair: (3, 4)

    === Traditional Unsigned Cantor ===
    Resulting Index: 32
    Unpacked Pair: (3, 4)
    Verification: SUCCESS

    === Moebius Interleaved Signed Cantor ===
    Intermediate Nat Index: 113
    Final Mapping (Z): -57
    Unpacked Pair: (3, 4)
    Verification: SUCCESS
    ____________


    Okay, here is a run using a pair of (-11, 15)... Traditional Cantor
    Pairing does not like that too much?

    Oh it failed, but the integer map worked:
    ____________
    ct_cantor_integer::manifest()
    Input Pair: (-11, 15)

    === Traditional Unsigned Cantor ===
    Resulting Index: 25
    Unpacked Pair: (2, 4)
    Verification: FAILED

    === Moebius Interleaved Signed Cantor ===
    Intermediate Nat Index: 1356
    Final Mapping (Z): 678
    Unpacked Pair: (-11, 15)
    Verification: SUCCESS
    ____________


    Here is (42, 42), the both should work:
    ____________
    ct_cantor_integer::manifest()
    Input Pair: (42, 42)

    === Traditional Unsigned Cantor ===
    Resulting Index: 3612
    Unpacked Pair: (42, 42)
    Verification: SUCCESS

    === Moebius Interleaved Signed Cantor ===
    Intermediate Nat Index: 14280
    Final Mapping (Z): 7140
    Unpacked Pair: (42, 42)
    Verification: SUCCESS
    ____________

    Interesting!


    Fwiw, here is my crude code:
    ________________________________
    // For Moebius
    // Quick and crude Cantor mapper.
    // Works with integers, I think.
    // When all the components are positive I can use
    // traditional Cantor Pairing...
    namespace ct_cantor_integer
    {
    struct cantor_pair
    {
    int m_a;
    int m_b;
    };

    // Fold a signed integer Z into a natural number N
    unsigned long long
    fold_z_to_n(
    int z
    ) {
    if (z >= 0)
    {
    return 2ULL * static_cast<unsigned long long>(z);
    }
    else
    {
    long long positive_result = -2LL * static_cast<long
    long>(z) - 1LL;
    return static_cast<unsigned long long>(positive_result);
    }
    }

    // Unfold a natural number N back into a signed integer Z
    int
    unfold_n_to_z(
    unsigned long long n
    ) {
    if (n % 2 == 0)
    {
    return static_cast<int>(n / 2ULL);
    }
    else
    {
    return static_cast<int>(-static_cast<long long>((n + 1ULL)
    / 2ULL));
    }
    }

    // Pure, traditional unsigned Cantor pairing baseline
    unsigned long long
    traditional_pack(
    unsigned int x,
    unsigned int y
    ) {
    unsigned long long sum = x + y;
    return (sum * (sum + 1ULL)) / 2ULL + y;
    }

    // Traditional unsigned Cantor unpacker
    cantor_pair
    traditional_unpack(
    unsigned long long w
    ) {
    unsigned long long t = static_cast<unsigned long
    long>((std::sqrt(static_cast<double>(8ULL * w + 1ULL)) - 1.0) / 2.0);
    unsigned long long tri = (t * (t + 1ULL)) / 2ULL;
    unsigned long long Y = w - tri;
    unsigned long long X = t - Y;
    return { static_cast<int>(X), static_cast<int>(Y) };
    }

    // Pack two signed integers into a single unique natural number
    (Moebius phase 1)
    unsigned long long
    pack_pair_signed(
    int a,
    int b
    ) {
    unsigned long long X = fold_z_to_n(a);
    unsigned long long Y = fold_z_to_n(b);
    unsigned long long sum = X + Y;
    return (sum * (sum + 1ULL)) / 2ULL + Y;
    }

    // Unpack a single natural number back into a pair of signed
    integers (Moebius phase 2)
    cantor_pair unpack_seed_signed(
    unsigned long long w
    ) {
    unsigned long long t = static_cast<unsigned long
    long>((std::sqrt(static_cast<double>(8ULL * w + 1ULL)) - 1.0) / 2.0);
    unsigned long long tri = (t * (t + 1ULL)) / 2ULL;
    unsigned long long Y = w - tri;
    unsigned long long X = t - Y;

    return { unfold_n_to_z(X), unfold_n_to_z(Y) };
    }

    void
    manifest()
    {
    std::cout << "ct_cantor_integer::manifest()\n";

    // Testing purely positive inputs to allow comparison with
    traditional
    int orig_a = 47;
    int orig_b = 32;
    std::cout << " Input Pair: (" << orig_a << ", " << orig_b <<
    ")\n\n";

    //
    =====================================================================
    // TRADITIONAL UNSIGNED CANTOR PIPELINE
    //
    =====================================================================
    unsigned long long trad_index = traditional_pack(orig_a,
    orig_b);
    cantor_pair trad_recovered = traditional_unpack(trad_index);

    std::cout << " === Traditional Unsigned Cantor ===\n";
    std::cout << " Resulting Index: " << trad_index << "\n";
    std::cout << " Unpacked Pair: (" << trad_recovered.m_a
    << ", " << trad_recovered.m_b << ")\n";

    if (trad_recovered.m_a == orig_a && trad_recovered.m_b ==
    orig_b) {
    std::cout << " Verification: SUCCESS\n\n";
    }
    else {
    std::cout << " Verification: FAILED\n\n";
    }

    //
    =====================================================================
    // MOEBIUS INTERLEAVED SIGNED PIPELINE
    //
    =====================================================================
    unsigned long long moebius_nat_index = pack_pair_signed(orig_a, >>> orig_b);
    int moebius_final_integer = unfold_n_to_z(moebius_nat_index);

    // Reverse the mapping pipeline entirely
    unsigned long long moebius_recovered_nat =
    fold_z_to_n(moebius_final_integer);
    cantor_pair moebius_recovered_pair =
    unpack_seed_signed(moebius_recovered_nat);

    std::cout << " === Moebius Interleaved Signed Cantor ===\n";
    std::cout << " Intermediate Nat Index: " <<
    moebius_nat_index << "\n";
    std::cout << " Final Mapping (Z): " <<
    moebius_final_integer << "\n";
    std::cout << " Unpacked Pair: (" <<
    moebius_recovered_pair.m_a << ", " << moebius_recovered_pair.m_b <<
    ")\n";

    if (moebius_recovered_pair.m_a == orig_a &&
    moebius_recovered_pair.m_b == orig_b) {
    std::cout << " Verification: SUCCESS\n";
    }
    else {
    std::cout << " Verification: FAILED\n";
    }
    }
    }
    ________________________________


    any thoughts? Thanks everybody! :^)

    Why not typedef "unsigned long long" as "ull"?

    Because that is moronic...


    Why not figure out what operator overloads would make sense as an
    arithmetization and then just use the plain syntax of arithmetic?

    Why not bind a thread-local streams handle to make it so that
    std::cout is not concrete for just plain "out"?

    Yuh? Have you ever used C++ before?


    Why not make for something that's not static casts where it appears
    that the use of static_cast loses precision or overflow?

    This quick code is not meant to be arbitrary precision.


    Why not call this "Galileo pairing" since it was already around for
    hundreds of years?

    The Cantor Pairing aspect? Or the mapping from Moebius?

    Heh, have I ever programmed in C++ before.

    You know, really it was always "C/C++".

    I suppose though Java's my main yet after a while all languages look the
    same.

    These days it's "typed templating assembler", sort of the idea.


    Have I written about half a million lines of code?

    That's only 50 KLOC's, ....

    One good file is 2.5, ..., takes about a month, 12 x 20 = 240,
    by 2.5, about 600, KLOC's. Some years are better than others.


    Yeah, I know, these days I write adapters to anything,
    I just can't stand concrete worlders any more.


    The "typing and templating assembler", though, sort of a retro kick,
    though it seems to make sense to surface the machine.


    Why "out" is because "in".

    Yeah, I've "used C++ before".



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to sci.logic,sci.math on Tue Jun 16 13:32:37 2026
    From Newsgroup: sci.logic

    On 6/15/2026 8:56 PM, Ross Finlayson wrote:
    On 06/15/2026 03:14 PM, Chris M. Thomasson wrote:
    On 6/10/2026 8:55 AM, Ross Finlayson wrote:
    On 06/09/2026 03:33 PM, Chris M. Thomasson wrote:
    I tried to code up a quick and dirty way to use Cantor Pairing with
    integers instead of just unsigned. Using a mapping from Moebius in a
    different thread vs traditional unsigned Cantor.

    Its funny... His mapping is giving me different numbers for when the
    pair is two positive integers.
    ____________
    ct_cantor_integer::manifest()
    -a-a Input Pair: (47, 32)

    -a-a === Traditional Unsigned Cantor ===
    -a-a-a-a Resulting Index:-a-a 3192
    -a-a-a-a Unpacked Pair:-a-a-a-a (47, 32)
    -a-a-a-a Verification:-a-a-a-a-a SUCCESS

    -a-a === Moebius Interleaved Signed Cantor ===
    -a-a-a-a Intermediate Nat Index: 12625
    -a-a-a-a Final Mapping (Z):-a-a-a-a-a-a -6313
    -a-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (47, 32)
    -a-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS
    ____________


    Here is 3 and 4:
    ____________
    ct_cantor_integer::manifest()
    -a-a Input Pair: (3, 4)

    -a-a === Traditional Unsigned Cantor ===
    -a-a-a-a Resulting Index:-a-a 32
    -a-a-a-a Unpacked Pair:-a-a-a-a (3, 4)
    -a-a-a-a Verification:-a-a-a-a-a SUCCESS

    -a-a === Moebius Interleaved Signed Cantor ===
    -a-a-a-a Intermediate Nat Index: 113
    -a-a-a-a Final Mapping (Z):-a-a-a-a-a-a -57
    -a-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (3, 4)
    -a-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS
    ____________


    Okay, here is a run using a pair of (-11, 15)... Traditional Cantor
    Pairing does not like that too much?

    Oh it failed, but the integer map worked:
    ____________
    ct_cantor_integer::manifest()
    -a-a Input Pair: (-11, 15)

    -a-a === Traditional Unsigned Cantor ===
    -a-a-a-a Resulting Index:-a-a 25
    -a-a-a-a Unpacked Pair:-a-a-a-a (2, 4)
    -a-a-a-a Verification:-a-a-a-a-a FAILED

    -a-a === Moebius Interleaved Signed Cantor ===
    -a-a-a-a Intermediate Nat Index: 1356
    -a-a-a-a Final Mapping (Z):-a-a-a-a-a-a 678
    -a-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (-11, 15)
    -a-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS
    ____________


    Here is (42, 42), the both should work:
    ____________
    ct_cantor_integer::manifest()
    -a-a Input Pair: (42, 42)

    -a-a === Traditional Unsigned Cantor ===
    -a-a-a-a Resulting Index:-a-a 3612
    -a-a-a-a Unpacked Pair:-a-a-a-a (42, 42)
    -a-a-a-a Verification:-a-a-a-a-a SUCCESS

    -a-a === Moebius Interleaved Signed Cantor ===
    -a-a-a-a Intermediate Nat Index: 14280
    -a-a-a-a Final Mapping (Z):-a-a-a-a-a-a 7140
    -a-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (42, 42)
    -a-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS
    ____________

    Interesting!


    Fwiw, here is my crude code:
    ________________________________
    // For Moebius
    // Quick and crude Cantor mapper.
    // Works with integers, I think.
    // When all the components are positive I can use
    // traditional Cantor Pairing...
    namespace ct_cantor_integer
    {
    -a-a-a-a struct cantor_pair
    -a-a-a-a {
    -a-a-a-a-a-a-a-a int m_a;
    -a-a-a-a-a-a-a-a int m_b;
    -a-a-a-a };

    -a-a-a-a // Fold a signed integer Z into a natural number N
    -a-a-a-a unsigned long long
    -a-a-a-a fold_z_to_n(
    -a-a-a-a-a-a-a-a int z
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a if (z >= 0)
    -a-a-a-a-a-a-a-a {
    -a-a-a-a-a-a-a-a-a-a-a-a return 2ULL * static_cast<unsigned long long>(z); >>>> -a-a-a-a-a-a-a-a }
    -a-a-a-a-a-a-a-a else
    -a-a-a-a-a-a-a-a {
    -a-a-a-a-a-a-a-a-a-a-a-a long long positive_result = -2LL * static_cast<long
    long>(z) - 1LL;
    -a-a-a-a-a-a-a-a-a-a-a-a return static_cast<unsigned long long>(positive_result);
    -a-a-a-a-a-a-a-a }
    -a-a-a-a }

    -a-a-a-a // Unfold a natural number N back into a signed integer Z
    -a-a-a-a int
    -a-a-a-a unfold_n_to_z(
    -a-a-a-a-a-a-a-a unsigned long long n
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a if (n % 2 == 0)
    -a-a-a-a-a-a-a-a {
    -a-a-a-a-a-a-a-a-a-a-a-a return static_cast<int>(n / 2ULL);
    -a-a-a-a-a-a-a-a }
    -a-a-a-a-a-a-a-a else
    -a-a-a-a-a-a-a-a {
    -a-a-a-a-a-a-a-a-a-a-a-a return static_cast<int>(-static_cast<long long>((n + 1ULL)
    / 2ULL));
    -a-a-a-a-a-a-a-a }
    -a-a-a-a }

    -a-a-a-a // Pure, traditional unsigned Cantor pairing baseline
    -a-a-a-a unsigned long long
    -a-a-a-a traditional_pack(
    -a-a-a-a-a-a-a-a unsigned int x,
    -a-a-a-a-a-a-a-a unsigned int y
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a unsigned long long sum = x + y;
    -a-a-a-a-a-a-a-a return (sum * (sum + 1ULL)) / 2ULL + y;
    -a-a-a-a }

    -a-a-a-a // Traditional unsigned Cantor unpacker
    -a-a-a-a cantor_pair
    -a-a-a-a traditional_unpack(
    -a-a-a-a-a-a-a-a unsigned long long w
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a unsigned long long t = static_cast<unsigned long
    long>((std::sqrt(static_cast<double>(8ULL * w + 1ULL)) - 1.0) / 2.0);
    -a-a-a-a-a-a-a-a unsigned long long tri = (t * (t + 1ULL)) / 2ULL;
    -a-a-a-a-a-a-a-a unsigned long long Y = w - tri;
    -a-a-a-a-a-a-a-a unsigned long long X = t - Y;
    -a-a-a-a-a-a-a-a return { static_cast<int>(X), static_cast<int>(Y) };
    -a-a-a-a }

    -a-a-a-a // Pack two signed integers into a single unique natural number >>>> (Moebius phase 1)
    -a-a-a-a unsigned long long
    -a-a-a-a pack_pair_signed(
    -a-a-a-a-a-a-a-a int a,
    -a-a-a-a-a-a-a-a int b
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a unsigned long long X = fold_z_to_n(a);
    -a-a-a-a-a-a-a-a unsigned long long Y = fold_z_to_n(b);
    -a-a-a-a-a-a-a-a unsigned long long sum = X + Y;
    -a-a-a-a-a-a-a-a return (sum * (sum + 1ULL)) / 2ULL + Y;
    -a-a-a-a }

    -a-a-a-a // Unpack a single natural number back into a pair of signed
    integers (Moebius phase 2)
    -a-a-a-a cantor_pair unpack_seed_signed(
    -a-a-a-a-a-a-a-a unsigned long long w
    -a-a-a-a ) {
    -a-a-a-a-a-a-a-a unsigned long long t = static_cast<unsigned long
    long>((std::sqrt(static_cast<double>(8ULL * w + 1ULL)) - 1.0) / 2.0);
    -a-a-a-a-a-a-a-a unsigned long long tri = (t * (t + 1ULL)) / 2ULL;
    -a-a-a-a-a-a-a-a unsigned long long Y = w - tri;
    -a-a-a-a-a-a-a-a unsigned long long X = t - Y;

    -a-a-a-a-a-a-a-a return { unfold_n_to_z(X), unfold_n_to_z(Y) };
    -a-a-a-a }

    -a-a-a-a void
    -a-a-a-a manifest()
    -a-a-a-a {
    -a-a-a-a-a-a-a-a std::cout << "ct_cantor_integer::manifest()\n";

    -a-a-a-a-a-a-a-a // Testing purely positive inputs to allow comparison with
    traditional
    -a-a-a-a-a-a-a-a int orig_a = 47;
    -a-a-a-a-a-a-a-a int orig_b = 32;
    -a-a-a-a-a-a-a-a std::cout << "-a Input Pair: (" << orig_a << ", " << orig_b <<
    ")\n\n";

    -a-a-a-a-a-a-a-a //
    =====================================================================
    -a-a-a-a-a-a-a-a // TRADITIONAL UNSIGNED CANTOR PIPELINE
    -a-a-a-a-a-a-a-a //
    =====================================================================
    -a-a-a-a-a-a-a-a unsigned long long trad_index = traditional_pack(orig_a, >>>> orig_b);
    -a-a-a-a-a-a-a-a cantor_pair trad_recovered = traditional_unpack(trad_index);

    -a-a-a-a-a-a-a-a std::cout << "-a === Traditional Unsigned Cantor ===\n"; >>>> -a-a-a-a-a-a-a-a std::cout << "-a-a-a Resulting Index:-a-a " << trad_index << "\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Unpacked Pair:-a-a-a-a (" << trad_recovered.m_a
    << ", " << trad_recovered.m_b << ")\n";

    -a-a-a-a-a-a-a-a if (trad_recovered.m_a == orig_a && trad_recovered.m_b == >>>> orig_b) {
    -a-a-a-a-a-a-a-a-a-a-a-a std::cout << "-a-a-a Verification:-a-a-a-a-a SUCCESS\n\n";
    -a-a-a-a-a-a-a-a }
    -a-a-a-a-a-a-a-a else {
    -a-a-a-a-a-a-a-a-a-a-a-a std::cout << "-a-a-a Verification:-a-a-a-a-a FAILED\n\n";
    -a-a-a-a-a-a-a-a }

    -a-a-a-a-a-a-a-a //
    =====================================================================
    -a-a-a-a-a-a-a-a // MOEBIUS INTERLEAVED SIGNED PIPELINE
    -a-a-a-a-a-a-a-a //
    =====================================================================
    -a-a-a-a-a-a-a-a unsigned long long moebius_nat_index =
    pack_pair_signed(orig_a,
    orig_b);
    -a-a-a-a-a-a-a-a int moebius_final_integer = unfold_n_to_z(moebius_nat_index);

    -a-a-a-a-a-a-a-a // Reverse the mapping pipeline entirely
    -a-a-a-a-a-a-a-a unsigned long long moebius_recovered_nat =
    fold_z_to_n(moebius_final_integer);
    -a-a-a-a-a-a-a-a cantor_pair moebius_recovered_pair =
    unpack_seed_signed(moebius_recovered_nat);

    -a-a-a-a-a-a-a-a std::cout << "-a === Moebius Interleaved Signed Cantor ===\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Intermediate Nat Index: " <<
    moebius_nat_index << "\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Final Mapping (Z):-a-a-a-a-a-a " << >>>> moebius_final_integer << "\n";
    -a-a-a-a-a-a-a-a std::cout << "-a-a-a Unpacked Pair:-a-a-a-a-a-a-a-a-a-a (" <<
    moebius_recovered_pair.m_a << ", " << moebius_recovered_pair.m_b <<
    ")\n";

    -a-a-a-a-a-a-a-a if (moebius_recovered_pair.m_a == orig_a &&
    moebius_recovered_pair.m_b == orig_b) {
    -a-a-a-a-a-a-a-a-a-a-a-a std::cout << "-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a SUCCESS\n";
    -a-a-a-a-a-a-a-a }
    -a-a-a-a-a-a-a-a else {
    -a-a-a-a-a-a-a-a-a-a-a-a std::cout << "-a-a-a Verification:-a-a-a-a-a-a-a-a-a-a-a FAILED\n";
    -a-a-a-a-a-a-a-a }
    -a-a-a-a }
    }
    ________________________________


    any thoughts? Thanks everybody! :^)

    Why not typedef "unsigned long long" as "ull"?

    Because that is moronic...


    Why not figure out what operator overloads would make sense as an
    arithmetization and then just use the plain syntax of arithmetic?

    Why not bind a thread-local streams handle to make it so that
    std::cout is not concrete for just plain "out"?

    Yuh? Have you ever used C++ before?


    Why not make for something that's not static casts where it appears
    that the use of static_cast loses precision or overflow?

    This quick code is not meant to be arbitrary precision.


    Why not call this "Galileo pairing" since it was already around for
    hundreds of years?

    The Cantor Pairing aspect? Or the mapping from Moebius?

    Heh, have I ever programmed in C++ before.

    You know, really it was always "C/C++".

    Huh? C and C++ are different langs. But you know that right?



    I suppose though Java's my main yet after a while all languages look the same.

    These days it's "typed templating assembler", sort of the idea.

    assembler? Oh yeah I am familiar with that. Wrote a lot of ASM code for
    the x86/x64, SPARC, some PPC. Fwiw, the wayback machine still has some
    of my old code:

    https://web.archive.org/web/20060214112345/http://appcore.home.comcast.net/appcore/src/cpu/i686/ac_i686_gcc_asm.html



    Have I written about half a million lines of code?

    I have written a shit load of code.



    That's only 50 KLOC's, ....

    One good file is 2.5, ..., takes about a month, 12 x 20 = 240,
    by 2.5, about 600, KLOC's. Some years are better than others.


    Yeah, I know, these days I write adapters to anything,
    I just can't stand concrete worlders any more.


    The "typing and templating assembler", though, sort of a retro kick,
    though it seems to make sense to surface the machine.

    Retro? ASM is modern. I had to use it for a bunch of lock/wait free
    algorithms before C++11 or C11.



    Why "out" is because "in".

    Yeah, I've "used C++ before".

    Why in the world would you typedef such a thing!

    "Why not typedef "unsigned long long" as "ull"?"

    Oh you are canned!


    Fwiw, here is some of my old ASM code, AT&T syntax:




    # Copyright 2005 Chris Thomasson


    .align 16
    .globl np_ac_i686_atomic_dwcas_fence
    np_ac_i686_atomic_dwcas_fence:
    pushl %esi
    pushl %ebx
    movl 16(%esp), %esi
    movl (%esi), %eax
    movl 4(%esi), %edx
    movl 20(%esp), %esi
    movl (%esi), %ebx
    movl 4(%esi), %ecx
    movl 12(%esp), %esi
    lock cmpxchg8b (%esi)
    jne np_ac_i686_atomic_dwcas_fence_fail
    xorl %eax, %eax
    popl %ebx
    popl %esi
    ret

    np_ac_i686_atomic_dwcas_fence_fail:
    movl 16(%esp), %esi
    movl %eax, (%esi)
    movl %edx, 4(%esi)
    movl $1, %eax
    popl %ebx
    popl %esi
    ret




    .align 16
    .globl ac_i686_stack_mpmc_push_cas
    ac_i686_stack_mpmc_push_cas:
    movl 4(%esp), %edx
    movl (%edx), %eax
    movl 8(%esp), %ecx

    ac_i686_stack_mpmc_push_cas_retry:
    movl %eax, (%ecx)
    lock cmpxchgl %ecx, (%edx)
    jne ac_i686_stack_mpmc_push_cas_retry
    ret




    .align 16
    .globl np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas:
    pushl %esi
    pushl %ebx

    np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_reload:
    movl 12(%esp), %esi
    movl 4(%esi), %edx
    movl (%esi), %eax

    np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_retry:
    movl 16(%esp), %ebx
    movl %eax, (%ebx)
    mfence
    cmpl (%esi), %eax
    jne np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_reload
    test %eax, %eax
    je np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_fail
    movl (%eax), %ebx
    leal 1(%edx), %ecx
    lock cmpxchg8b (%esi)
    jne np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_retry

    np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_fail:
    movl 16(%esp), %esi
    xorl %ebx, %ebx
    movl %ebx, (%esi)
    popl %ebx
    popl %esi
    ret




    .align 16
    .globl np_ac_i686_stack_mpmc_pop_dwcas
    np_ac_i686_stack_mpmc_pop_dwcas:
    pushl %esi
    pushl %ebx
    movl 12(%esp), %esi
    movl 4(%esi), %edx
    movl (%esi), %eax

    np_ac_i686_stack_mpmc_pop_dwcas_retry:
    test %eax, %eax
    je np_ac_i686_stack_mpmc_pop_dwcas_fail
    movl (%eax), %ebx
    leal 1(%edx), %ecx
    lock cmpxchg8b (%esi)
    jne np_ac_i686_stack_mpmc_pop_dwcas_retry

    np_ac_i686_stack_mpmc_pop_dwcas_fail:
    popl %ebx
    popl %esi
    ret




    .align 16
    .globl ac_i686_lfgc_smr_activate
    ac_i686_lfgc_smr_activate:
    movl 4(%esp), %edx
    movl 8(%esp), %ecx

    ac_i686_lfgc_smr_activate_reload:
    movl (%ecx), %eax
    movl %eax, (%edx)
    mfence
    cmpl (%ecx), %eax
    jne ac_i686_lfgc_smr_activate_reload
    ret




    .align 16
    .globl ac_i686_lfgc_smr_deactivate
    ac_i686_lfgc_smr_deactivate:
    movl 4(%esp), %ecx
    xorl %eax, %eax
    movl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_queue_spsc_push
    ac_i686_queue_spsc_push:
    movl 4(%esp), %eax
    movl 8(%esp), %ecx
    movl 4(%eax), %edx
    # sfence may be needed here for future x86
    movl %ecx, (%edx)
    movl %ecx, 4(%eax)
    ret




    .align 16
    .globl ac_i686_queue_spsc_pop
    ac_i686_queue_spsc_pop:
    pushl %ebx
    movl 8(%esp), %ecx
    movl (%ecx), %eax
    cmpl 4(%ecx), %eax
    je ac_i686_queue_spsc_pop_failed
    movl (%eax), %edx
    # lfence may be needed here for future x86
    movl 12(%edx), %ebx
    movl %edx, (%ecx)
    movl %ebx, 12(%eax)
    popl %ebx
    ret

    ac_i686_queue_spsc_pop_failed:
    xorl %eax, %eax
    popl %ebx
    ret




    .align 16
    .globl ac_i686_mb_fence
    ac_i686_mb_fence:
    mfence
    ret




    .align 16
    .globl ac_i686_mb_naked
    ac_i686_mb_naked:
    ret




    .align 16
    .globl ac_i686_mb_store_fence
    ac_i686_mb_store_fence:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    mfence
    movl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_mb_store_naked
    ac_i686_mb_store_naked:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    movl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_mb_load_fence
    ac_i686_mb_load_fence:
    movl 4(%esp), %ecx
    movl (%ecx), %eax
    mfence
    ret




    .align 16
    .globl ac_i686_mb_load_naked
    ac_i686_mb_load_naked:
    movl 4(%esp), %ecx
    movl (%ecx), %eax
    ret




    .align 16
    .globl ac_i686_atomic_xchg_fence
    ac_i686_atomic_xchg_fence:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    xchgl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_atomic_xadd_fence
    ac_i686_atomic_xadd_fence:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    lock xaddl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_atomic_inc_fence
    ac_i686_atomic_inc_fence:
    movl 4(%esp), %ecx
    movl $1, %eax
    lock xaddl %eax, (%ecx)
    incl %eax
    ret




    .align 16
    .globl ac_i686_atomic_dec_fence
    ac_i686_atomic_dec_fence:
    movl 4(%esp), %ecx
    movl $-1, %eax
    lock xaddl %eax, (%ecx)
    decl %eax
    ret




    .align 16
    .globl ac_i686_atomic_cas_fence
    ac_i686_atomic_cas_fence:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    movl 12(%esp), %edx
    lock cmpxchgl %edx, (%ecx)
    ret



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to sci.logic,sci.math on Wed Jun 17 07:47:50 2026
    From Newsgroup: sci.logic

    On 06/16/2026 01:32 PM, Chris M. Thomasson wrote:
    On 6/15/2026 8:56 PM, Ross Finlayson wrote:
    On 06/15/2026 03:14 PM, Chris M. Thomasson wrote:
    On 6/10/2026 8:55 AM, Ross Finlayson wrote:
    On 06/09/2026 03:33 PM, Chris M. Thomasson wrote:
    I tried to code up a quick and dirty way to use Cantor Pairing with
    integers instead of just unsigned. Using a mapping from Moebius in a >>>>> different thread vs traditional unsigned Cantor.

    Its funny... His mapping is giving me different numbers for when the >>>>> pair is two positive integers.
    ____________
    ct_cantor_integer::manifest()
    Input Pair: (47, 32)

    === Traditional Unsigned Cantor ===
    Resulting Index: 3192
    Unpacked Pair: (47, 32)
    Verification: SUCCESS

    === Moebius Interleaved Signed Cantor ===
    Intermediate Nat Index: 12625
    Final Mapping (Z): -6313
    Unpacked Pair: (47, 32)
    Verification: SUCCESS
    ____________


    Here is 3 and 4:
    ____________
    ct_cantor_integer::manifest()
    Input Pair: (3, 4)

    === Traditional Unsigned Cantor ===
    Resulting Index: 32
    Unpacked Pair: (3, 4)
    Verification: SUCCESS

    === Moebius Interleaved Signed Cantor ===
    Intermediate Nat Index: 113
    Final Mapping (Z): -57
    Unpacked Pair: (3, 4)
    Verification: SUCCESS
    ____________


    Okay, here is a run using a pair of (-11, 15)... Traditional Cantor
    Pairing does not like that too much?

    Oh it failed, but the integer map worked:
    ____________
    ct_cantor_integer::manifest()
    Input Pair: (-11, 15)

    === Traditional Unsigned Cantor ===
    Resulting Index: 25
    Unpacked Pair: (2, 4)
    Verification: FAILED

    === Moebius Interleaved Signed Cantor ===
    Intermediate Nat Index: 1356
    Final Mapping (Z): 678
    Unpacked Pair: (-11, 15)
    Verification: SUCCESS
    ____________


    Here is (42, 42), the both should work:
    ____________
    ct_cantor_integer::manifest()
    Input Pair: (42, 42)

    === Traditional Unsigned Cantor ===
    Resulting Index: 3612
    Unpacked Pair: (42, 42)
    Verification: SUCCESS

    === Moebius Interleaved Signed Cantor ===
    Intermediate Nat Index: 14280
    Final Mapping (Z): 7140
    Unpacked Pair: (42, 42)
    Verification: SUCCESS
    ____________

    Interesting!


    Fwiw, here is my crude code:
    ________________________________
    // For Moebius
    // Quick and crude Cantor mapper.
    // Works with integers, I think.
    // When all the components are positive I can use
    // traditional Cantor Pairing...
    namespace ct_cantor_integer
    {
    struct cantor_pair
    {
    int m_a;
    int m_b;
    };

    // Fold a signed integer Z into a natural number N
    unsigned long long
    fold_z_to_n(
    int z
    ) {
    if (z >= 0)
    {
    return 2ULL * static_cast<unsigned long long>(z);
    }
    else
    {
    long long positive_result = -2LL * static_cast<long
    long>(z) - 1LL;
    return static_cast<unsigned long long>(positive_result); >>>>> }
    }

    // Unfold a natural number N back into a signed integer Z
    int
    unfold_n_to_z(
    unsigned long long n
    ) {
    if (n % 2 == 0)
    {
    return static_cast<int>(n / 2ULL);
    }
    else
    {
    return static_cast<int>(-static_cast<long long>((n +
    1ULL)
    / 2ULL));
    }
    }

    // Pure, traditional unsigned Cantor pairing baseline
    unsigned long long
    traditional_pack(
    unsigned int x,
    unsigned int y
    ) {
    unsigned long long sum = x + y;
    return (sum * (sum + 1ULL)) / 2ULL + y;
    }

    // Traditional unsigned Cantor unpacker
    cantor_pair
    traditional_unpack(
    unsigned long long w
    ) {
    unsigned long long t = static_cast<unsigned long
    long>((std::sqrt(static_cast<double>(8ULL * w + 1ULL)) - 1.0) / 2.0); >>>>> unsigned long long tri = (t * (t + 1ULL)) / 2ULL;
    unsigned long long Y = w - tri;
    unsigned long long X = t - Y;
    return { static_cast<int>(X), static_cast<int>(Y) };
    }

    // Pack two signed integers into a single unique natural number >>>>> (Moebius phase 1)
    unsigned long long
    pack_pair_signed(
    int a,
    int b
    ) {
    unsigned long long X = fold_z_to_n(a);
    unsigned long long Y = fold_z_to_n(b);
    unsigned long long sum = X + Y;
    return (sum * (sum + 1ULL)) / 2ULL + Y;
    }

    // Unpack a single natural number back into a pair of signed
    integers (Moebius phase 2)
    cantor_pair unpack_seed_signed(
    unsigned long long w
    ) {
    unsigned long long t = static_cast<unsigned long
    long>((std::sqrt(static_cast<double>(8ULL * w + 1ULL)) - 1.0) / 2.0); >>>>> unsigned long long tri = (t * (t + 1ULL)) / 2ULL;
    unsigned long long Y = w - tri;
    unsigned long long X = t - Y;

    return { unfold_n_to_z(X), unfold_n_to_z(Y) };
    }

    void
    manifest()
    {
    std::cout << "ct_cantor_integer::manifest()\n";

    // Testing purely positive inputs to allow comparison with
    traditional
    int orig_a = 47;
    int orig_b = 32;
    std::cout << " Input Pair: (" << orig_a << ", " << orig_b << >>>>> ")\n\n";

    //
    ===================================================================== >>>>> // TRADITIONAL UNSIGNED CANTOR PIPELINE
    //
    ===================================================================== >>>>> unsigned long long trad_index = traditional_pack(orig_a,
    orig_b);
    cantor_pair trad_recovered = traditional_unpack(trad_index); >>>>>
    std::cout << " === Traditional Unsigned Cantor ===\n";
    std::cout << " Resulting Index: " << trad_index << "\n"; >>>>> std::cout << " Unpacked Pair: (" << trad_recovered.m_a >>>>> << ", " << trad_recovered.m_b << ")\n";

    if (trad_recovered.m_a == orig_a && trad_recovered.m_b ==
    orig_b) {
    std::cout << " Verification: SUCCESS\n\n";
    }
    else {
    std::cout << " Verification: FAILED\n\n";
    }

    //
    ===================================================================== >>>>> // MOEBIUS INTERLEAVED SIGNED PIPELINE
    //
    ===================================================================== >>>>> unsigned long long moebius_nat_index =
    pack_pair_signed(orig_a,
    orig_b);
    int moebius_final_integer = unfold_n_to_z(moebius_nat_index); >>>>>
    // Reverse the mapping pipeline entirely
    unsigned long long moebius_recovered_nat =
    fold_z_to_n(moebius_final_integer);
    cantor_pair moebius_recovered_pair =
    unpack_seed_signed(moebius_recovered_nat);

    std::cout << " === Moebius Interleaved Signed Cantor ===\n"; >>>>> std::cout << " Intermediate Nat Index: " <<
    moebius_nat_index << "\n";
    std::cout << " Final Mapping (Z): " <<
    moebius_final_integer << "\n";
    std::cout << " Unpacked Pair: (" <<
    moebius_recovered_pair.m_a << ", " << moebius_recovered_pair.m_b <<
    ")\n";

    if (moebius_recovered_pair.m_a == orig_a &&
    moebius_recovered_pair.m_b == orig_b) {
    std::cout << " Verification: SUCCESS\n";
    }
    else {
    std::cout << " Verification: FAILED\n";
    }
    }
    }
    ________________________________


    any thoughts? Thanks everybody! :^)

    Why not typedef "unsigned long long" as "ull"?

    Because that is moronic...


    Why not figure out what operator overloads would make sense as an
    arithmetization and then just use the plain syntax of arithmetic?

    Why not bind a thread-local streams handle to make it so that
    std::cout is not concrete for just plain "out"?

    Yuh? Have you ever used C++ before?


    Why not make for something that's not static casts where it appears
    that the use of static_cast loses precision or overflow?

    This quick code is not meant to be arbitrary precision.


    Why not call this "Galileo pairing" since it was already around for
    hundreds of years?

    The Cantor Pairing aspect? Or the mapping from Moebius?

    Heh, have I ever programmed in C++ before.

    You know, really it was always "C/C++".

    Huh? C and C++ are different langs. But you know that right?



    I suppose though Java's my main yet after a while all languages look the
    same.

    These days it's "typed templating assembler", sort of the idea.

    assembler? Oh yeah I am familiar with that. Wrote a lot of ASM code for
    the x86/x64, SPARC, some PPC. Fwiw, the wayback machine still has some
    of my old code:

    https://web.archive.org/web/20060214112345/http://appcore.home.comcast.net/appcore/src/cpu/i686/ac_i686_gcc_asm.html




    Have I written about half a million lines of code?

    I have written a shit load of code.



    That's only 50 KLOC's, ....

    One good file is 2.5, ..., takes about a month, 12 x 20 = 240,
    by 2.5, about 600, KLOC's. Some years are better than others.


    Yeah, I know, these days I write adapters to anything,
    I just can't stand concrete worlders any more.


    The "typing and templating assembler", though, sort of a retro kick,
    though it seems to make sense to surface the machine.

    Retro? ASM is modern. I had to use it for a bunch of lock/wait free algorithms before C++11 or C11.



    Why "out" is because "in".

    Yeah, I've "used C++ before".

    Why in the world would you typedef such a thing!

    "Why not typedef "unsigned long long" as "ull"?"

    Oh you are canned!


    Fwiw, here is some of my old ASM code, AT&T syntax:




    # Copyright 2005 Chris Thomasson


    .align 16
    .globl np_ac_i686_atomic_dwcas_fence
    np_ac_i686_atomic_dwcas_fence:
    pushl %esi
    pushl %ebx
    movl 16(%esp), %esi
    movl (%esi), %eax
    movl 4(%esi), %edx
    movl 20(%esp), %esi
    movl (%esi), %ebx
    movl 4(%esi), %ecx
    movl 12(%esp), %esi
    lock cmpxchg8b (%esi)
    jne np_ac_i686_atomic_dwcas_fence_fail
    xorl %eax, %eax
    popl %ebx
    popl %esi
    ret

    np_ac_i686_atomic_dwcas_fence_fail:
    movl 16(%esp), %esi
    movl %eax, (%esi)
    movl %edx, 4(%esi)
    movl $1, %eax
    popl %ebx
    popl %esi
    ret




    .align 16
    .globl ac_i686_stack_mpmc_push_cas
    ac_i686_stack_mpmc_push_cas:
    movl 4(%esp), %edx
    movl (%edx), %eax
    movl 8(%esp), %ecx

    ac_i686_stack_mpmc_push_cas_retry:
    movl %eax, (%ecx)
    lock cmpxchgl %ecx, (%edx)
    jne ac_i686_stack_mpmc_push_cas_retry
    ret




    .align 16
    .globl np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas:
    pushl %esi
    pushl %ebx

    np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_reload:
    movl 12(%esp), %esi
    movl 4(%esi), %edx
    movl (%esi), %eax

    np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_retry:
    movl 16(%esp), %ebx
    movl %eax, (%ebx)
    mfence
    cmpl (%esi), %eax
    jne np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_reload
    test %eax, %eax
    je np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_fail
    movl (%eax), %ebx
    leal 1(%edx), %ecx
    lock cmpxchg8b (%esi)
    jne np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_retry

    np_ac_i686_lfgc_smr_stack_mpmc_pop_dwcas_fail:
    movl 16(%esp), %esi
    xorl %ebx, %ebx
    movl %ebx, (%esi)
    popl %ebx
    popl %esi
    ret




    .align 16
    .globl np_ac_i686_stack_mpmc_pop_dwcas
    np_ac_i686_stack_mpmc_pop_dwcas:
    pushl %esi
    pushl %ebx
    movl 12(%esp), %esi
    movl 4(%esi), %edx
    movl (%esi), %eax

    np_ac_i686_stack_mpmc_pop_dwcas_retry:
    test %eax, %eax
    je np_ac_i686_stack_mpmc_pop_dwcas_fail
    movl (%eax), %ebx
    leal 1(%edx), %ecx
    lock cmpxchg8b (%esi)
    jne np_ac_i686_stack_mpmc_pop_dwcas_retry

    np_ac_i686_stack_mpmc_pop_dwcas_fail:
    popl %ebx
    popl %esi
    ret




    .align 16
    .globl ac_i686_lfgc_smr_activate
    ac_i686_lfgc_smr_activate:
    movl 4(%esp), %edx
    movl 8(%esp), %ecx

    ac_i686_lfgc_smr_activate_reload:
    movl (%ecx), %eax
    movl %eax, (%edx)
    mfence
    cmpl (%ecx), %eax
    jne ac_i686_lfgc_smr_activate_reload
    ret




    .align 16
    .globl ac_i686_lfgc_smr_deactivate
    ac_i686_lfgc_smr_deactivate:
    movl 4(%esp), %ecx
    xorl %eax, %eax
    movl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_queue_spsc_push
    ac_i686_queue_spsc_push:
    movl 4(%esp), %eax
    movl 8(%esp), %ecx
    movl 4(%eax), %edx
    # sfence may be needed here for future x86
    movl %ecx, (%edx)
    movl %ecx, 4(%eax)
    ret




    .align 16
    .globl ac_i686_queue_spsc_pop
    ac_i686_queue_spsc_pop:
    pushl %ebx
    movl 8(%esp), %ecx
    movl (%ecx), %eax
    cmpl 4(%ecx), %eax
    je ac_i686_queue_spsc_pop_failed
    movl (%eax), %edx
    # lfence may be needed here for future x86
    movl 12(%edx), %ebx
    movl %edx, (%ecx)
    movl %ebx, 12(%eax)
    popl %ebx
    ret

    ac_i686_queue_spsc_pop_failed:
    xorl %eax, %eax
    popl %ebx
    ret




    .align 16
    .globl ac_i686_mb_fence
    ac_i686_mb_fence:
    mfence
    ret




    .align 16
    .globl ac_i686_mb_naked
    ac_i686_mb_naked:
    ret




    .align 16
    .globl ac_i686_mb_store_fence
    ac_i686_mb_store_fence:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    mfence
    movl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_mb_store_naked
    ac_i686_mb_store_naked:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    movl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_mb_load_fence
    ac_i686_mb_load_fence:
    movl 4(%esp), %ecx
    movl (%ecx), %eax
    mfence
    ret




    .align 16
    .globl ac_i686_mb_load_naked
    ac_i686_mb_load_naked:
    movl 4(%esp), %ecx
    movl (%ecx), %eax
    ret




    .align 16
    .globl ac_i686_atomic_xchg_fence
    ac_i686_atomic_xchg_fence:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    xchgl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_atomic_xadd_fence
    ac_i686_atomic_xadd_fence:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    lock xaddl %eax, (%ecx)
    ret




    .align 16
    .globl ac_i686_atomic_inc_fence
    ac_i686_atomic_inc_fence:
    movl 4(%esp), %ecx
    movl $1, %eax
    lock xaddl %eax, (%ecx)
    incl %eax
    ret




    .align 16
    .globl ac_i686_atomic_dec_fence
    ac_i686_atomic_dec_fence:
    movl 4(%esp), %ecx
    movl $-1, %eax
    lock xaddl %eax, (%ecx)
    decl %eax
    ret




    .align 16
    .globl ac_i686_atomic_cas_fence
    ac_i686_atomic_cas_fence:
    movl 4(%esp), %ecx
    movl 8(%esp), %eax
    movl 12(%esp), %edx
    lock cmpxchgl %edx, (%ecx)
    ret





    It's simple an idea to typedef "unsigned long long",
    also for assembler to rename the registers to make
    for a sort of "word-width agnosticism" and "architecture
    agnosticism", in a world where ILP has gone from 32 to 64,
    that these days the 64-bit is quite ubiquitous among settings
    like Intel/AMD, ARM, and MIPS/RISC-V.



    interrupt

    CLGI CLI STI STGI
    HLT
    IRET IRETD IRETQ
    LIDT SIDT
    MONITOR MWAIT
    RSM
    SKINIT

    privileges

    ARPL
    LAR
    RDPKRU WRPKRU
    VERR VERW

    alignment

    CLAC STAC

    jump/routine

    SYSCALL SYSRET
    SYSENTER SYSEXIT

    task, stack, tlb, gdt, ldt, cache

    CLTS
    CLRSSBSY SETSSBSY
    INCSSP
    INVD
    INVLPG INVLPGA INVLPGB INVPCID TLBSYNC
    LGDT SGDT
    LLDT SLDT
    LMSW
    LSL
    LTR STR
    RDSSP
    RSTORSSP SAVEPREVSSP
    WBINVD WBNOINVD
    WRSS WRUSS


    load/store
    MOV CRn MOV DRn
    RDMSR WRMSR
    SMSW
    SWAPGS

    virtual

    PSMASH PVALIDATE
    RMPADJUST RMPUPDATE
    RMPQUERY
    VMLOAD VMSAVE
    VMMCALL VMGEXIT
    VMRUN


    perf

    RDPMC
    RDTSC RDTSCP


    debug

    INT 3




    general-purpose

    context
    CPUID
    LLWPCB LWPINS LWPVAL SLWPCB
    NOP
    PAUSE

    RDFSBASE

    RDPID
    RPPRU

    UD0 UD1 UD2

    jump/routine
    CALL RET
    ENTER LEAVE
    INT
    INTO
    Jcc
    JCXZ JECXZ JRCXZ
    JMP

    register
    BOUND
    BT BTC BTR BTS
    CLC CLD CMC
    LAHF SAHF
    STC STD
    WRFSBASE WRGSBASE

    compare
    cmp
    CMP
    CMPS CMPSB CMPSW CMPSD CMPSQ
    CMPXCHG CMPXCHG8B CMPXCHG16B
    SCAS SCASB SCASW SCASD SCASQ
    SETcc
    TEST
    branch
    LOOP LOOPE LOOPNE LOOPNZ LOOPZ


    input/output
    IN
    INS INSB INSW INSD
    OUT
    OUTS OUTSB OUTSW OUTSD

    memory/cache
    CLFLUSH CLFLUSHOPT
    CLWB
    CLZERO
    LFENCE MCOMMIT MFENCE SFENCE
    MONITORX MWAITX
    PREFETCH PREFETCHW PREFETCHlevel

    memory/stack
    POP
    POPA POPAD
    POPF POPFD POPFQ
    PUSH
    PUSHA PUSHAD
    PUSHF PUSHFD PUSHFQ

    memory/segment
    XLAT XLATB

    load/store
    BEXTR
    BLCFILL BLCI BLCIC BLCMSK BLCS BLCIC BLCMSK BLSFILL BLSI BLSMSK BLSR
    BSF BSR
    BSWAP
    BZHI
    CBW CWDE CDQE CWD CDQ CQO
    CMOVcc
    LDS LES LFS LGS LSS
    LEA
    LODS LODSB LODSW LODSQ
    MOV
    MOVBE
    MOVD
    MOVMSKPD MOVMSKPS
    MOVNTI
    MOVS MOVSB MOVSW MOVSD MOVSQ
    MOVSX MOVSXD MOVZX
    PDEP PEXT
    RDRAND RDSEED
    STOD STOSB STOSW STOSD STODQ
    XADD XCHG




    bitwise/math
    and or nand nor
    complement
    roll
    AND ANDN
    LZCNT TZCNT
    NOT
    OR XOR
    POPCNT
    RCL RCR ROL ROR RORX
    SAL SHL SAR SARX SHL SHLD SHLX SHR SHRD SHRX
    T1MSKC TZMSK
    math
    plus minus mul div muldiv
    ADC ADCX ADD
    DEC INC
    DIV IDIV IMUL MUL MULX
    NEG
    SBB SUB





    ignored / unimplemented

    bcd binary coded decimal
    AAA AAD AAM AAS
    DAA DAS

    CRC32





    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to sci.logic,sci.math on Wed Jun 17 20:48:21 2026
    From Newsgroup: sci.logic

    On 6/17/2026 7:47 AM, Ross Finlayson wrote:
    [...]

    RossrCa I appreciate the enthusiasm, but IrCOve actually written and shipped some of my lockrCafree algorithms in real assembly on x86, SPARC, and PPC.
    The rest lived in research branches or internal tooling, but the point
    stands: the code I posted reflects hardware constraints, not stylistic preferences.

    Your suggestions... typedefs (ull?, puke), operator overloads,
    threadrCalocal streams donrCOt apply to atomic primitives or reversible integer mappings. These arenrCOt aesthetic problems; theyrCOre mathematical and architectural ones.

    If you want to talk Cantor pairing or signed bijections, great.
    If you want to talk atomic semantics or memory ordering, also great.
    But the critique needs to match the domain.

    And typedefrCOing unsigned long long into oblivion?
    ThatrCOs the kind of thing that gets codebases rCo not people rCo fired.

    Show me some of your old code.
    Thank God the Wayback Machine still has some of mine:

    https://web.archive.org/web/20060214112345/http://appcore.home.comcast.net/appcore/src/cpu/i686/ac_i686_gcc_asm.html

    ThreadrCalocal streams? Interesting idea in the abstract. Writing into a perrCathread buffer is fine. but it has nothing to do with atomic RMW instructions or Cantor mappings. I created a little program to help me
    port some of my algorithms to AppleSoft BASIC of all things. Shit man,
    look up the thread Macro Issue by me over on comp.lang.c++
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to sci.logic,sci.math on Wed Jun 17 23:54:56 2026
    From Newsgroup: sci.logic

    On 06/17/2026 08:48 PM, Chris M. Thomasson wrote:
    On 6/17/2026 7:47 AM, Ross Finlayson wrote:
    [...]

    RossrCa I appreciate the enthusiasm, but IrCOve actually written and shipped some of my lockrCafree algorithms in real assembly on x86, SPARC, and PPC. The rest lived in research branches or internal tooling, but the point stands: the code I posted reflects hardware constraints, not stylistic preferences.

    Your suggestions... typedefs (ull?, puke), operator overloads,
    threadrCalocal streams donrCOt apply to atomic primitives or reversible integer mappings. These arenrCOt aesthetic problems; theyrCOre mathematical and architectural ones.

    If you want to talk Cantor pairing or signed bijections, great.
    If you want to talk atomic semantics or memory ordering, also great.
    But the critique needs to match the domain.

    And typedefrCOing unsigned long long into oblivion?
    ThatrCOs the kind of thing that gets codebases rCo not people rCo fired.

    Show me some of your old code.
    Thank God the Wayback Machine still has some of mine:

    https://web.archive.org/web/20060214112345/http://appcore.home.comcast.net/appcore/src/cpu/i686/ac_i686_gcc_asm.html


    ThreadrCalocal streams? Interesting idea in the abstract. Writing into a perrCathread buffer is fine. but it has nothing to do with atomic RMW instructions or Cantor mappings. I created a little program to help me
    port some of my algorithms to AppleSoft BASIC of all things. Shit man,
    look up the thread Macro Issue by me over on comp.lang.c++

    Hm. Most of the code I've written was for work, I don't keep any copies
    of work code, since, it's intellectual property of others.

    Unless they've re-written it since Windows 7, I suppose some few lines
    of code I wrote run every time Windows boots. There's tiff2pdf.c,
    that was a long time ago, it's installed in millions of machines,
    and does work all the time.

    I really don't care that much about typedef'ing a usual construct
    into a briefer mnemonic. As far as I know "ull" isn't a reserved
    word or relevant to integer constants, it's not "ULL". Point being,
    I don't really much care, then the point was more about using
    incompatible integer conversions, and not just "arbitrary-precision",
    plain old "fixed precision".


    Heh, the tiff2pdf.c has been shelved and un-shelved a bunch of times
    in the libtiff, like a couple years ago the maintainer was like
    "I'm shelving this, build it yourself", then was like, "sorry, it's
    back", point being it's a primitive sort of beginner's code I wrote
    about 25 years ago, that you can find on the Internet. On comp.lang.java.programmer the other day, I wrote up how I write simple
    adapters for web-services, I've implemented hundreds of modules in Java,
    mostly to do one thing well and cut a hard dependency.


    The re-routine idea for co-operative multi-threading instead of
    co-routines is a great sort of idea, you can read about that on
    comp.lang.c++.


    Then, about the mnemonics of assembler instructions, the idea is
    to be making a "templating and typing assembler" as a pre-processor,
    so that among various sorts of syntaxes and instruction codes,
    to just have a common subset of those, since all sorts of machine
    architectures are so much alike.

    I lived in the enterprise distributed space for at least a decade,
    so, I've read quite a few million lines of code, and usually I've read
    all the source code of the entire stack. Then, I've written some
    millions of lines of code, and not counting "generated code", since
    writing some generators and resulting arbitrarily many lines of code.


    I'm familiar with the language standards. In fact,
    I ever prefer "strict" quite usually.



    I haven't been involved in making decisions to fire people for their
    code quality, though one time my job was to make the firing machine go
    faster. I didn't really appreciate that, since then when my next job was
    to fix a bug in the arbitration system, I found a bunch of their bugs,
    and fixed them, then they were like, you know, embarrassed.
    I did what they said, problem is they didn't know I'd do what I should.
    I automatically detect obvious bugs.

    I'm a full-stack enterprise dev, all-phases analysis, design, and implementation, thanks. Familiar with "500 page specs" a bit more
    than "the 30,000 foot view". So, I know C/C++, and Java, and Perl and
    Python and JavaScript or Typescript and a bit of Ruby or Go and of
    course shell scripts and all their build systems and most of the little
    dotfile syntaxes, and of course "SQL", or how Oracle does it and a bit
    of Postgres and MS for particulars, or for things like "the data
    ware-house".


    About encoding two integers in one integer, there are any number of ways
    to do it, for example where they're on the same order and where they're
    not on the same order, where one's best case is the other's worst case,
    and vice versa. Sort of like big-end and little-end vis-a-vis 2-tuples.

    I know binary.


    On my video essays under "Logos 2000" there are some "Logos 2000:
    software ..." bits, or "o.s. walkthrough" or something, since I study
    computer science also, and even a bit of computer engineering.





    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to sci.logic,sci.math on Thu Jun 18 00:21:18 2026
    From Newsgroup: sci.logic

    On 06/17/2026 11:54 PM, Ross Finlayson wrote:
    On 06/17/2026 08:48 PM, Chris M. Thomasson wrote:
    On 6/17/2026 7:47 AM, Ross Finlayson wrote:
    [...]

    RossrCa I appreciate the enthusiasm, but IrCOve actually written and shipped >> some of my lockrCafree algorithms in real assembly on x86, SPARC, and PPC. >> The rest lived in research branches or internal tooling, but the point
    stands: the code I posted reflects hardware constraints, not stylistic
    preferences.

    Your suggestions... typedefs (ull?, puke), operator overloads,
    threadrCalocal streams donrCOt apply to atomic primitives or reversible
    integer mappings. These arenrCOt aesthetic problems; theyrCOre mathematical >> and architectural ones.

    If you want to talk Cantor pairing or signed bijections, great.
    If you want to talk atomic semantics or memory ordering, also great.
    But the critique needs to match the domain.

    And typedefrCOing unsigned long long into oblivion?
    ThatrCOs the kind of thing that gets codebases rCo not people rCo fired.

    Show me some of your old code.
    Thank God the Wayback Machine still has some of mine:

    https://web.archive.org/web/20060214112345/http://appcore.home.comcast.net/appcore/src/cpu/i686/ac_i686_gcc_asm.html



    ThreadrCalocal streams? Interesting idea in the abstract. Writing into a
    perrCathread buffer is fine. but it has nothing to do with atomic RMW
    instructions or Cantor mappings. I created a little program to help me
    port some of my algorithms to AppleSoft BASIC of all things. Shit man,
    look up the thread Macro Issue by me over on comp.lang.c++

    Hm. Most of the code I've written was for work, I don't keep any copies
    of work code, since, it's intellectual property of others.

    Unless they've re-written it since Windows 7, I suppose some few lines
    of code I wrote run every time Windows boots. There's tiff2pdf.c,
    that was a long time ago, it's installed in millions of machines,
    and does work all the time.

    I really don't care that much about typedef'ing a usual construct
    into a briefer mnemonic. As far as I know "ull" isn't a reserved
    word or relevant to integer constants, it's not "ULL". Point being,
    I don't really much care, then the point was more about using
    incompatible integer conversions, and not just "arbitrary-precision",
    plain old "fixed precision".


    Heh, the tiff2pdf.c has been shelved and un-shelved a bunch of times
    in the libtiff, like a couple years ago the maintainer was like
    "I'm shelving this, build it yourself", then was like, "sorry, it's
    back", point being it's a primitive sort of beginner's code I wrote
    about 25 years ago, that you can find on the Internet. On comp.lang.java.programmer the other day, I wrote up how I write simple adapters for web-services, I've implemented hundreds of modules in Java, mostly to do one thing well and cut a hard dependency.


    The re-routine idea for co-operative multi-threading instead of
    co-routines is a great sort of idea, you can read about that on comp.lang.c++.


    Then, about the mnemonics of assembler instructions, the idea is
    to be making a "templating and typing assembler" as a pre-processor,
    so that among various sorts of syntaxes and instruction codes,
    to just have a common subset of those, since all sorts of machine architectures are so much alike.

    I lived in the enterprise distributed space for at least a decade,
    so, I've read quite a few million lines of code, and usually I've read
    all the source code of the entire stack. Then, I've written some
    millions of lines of code, and not counting "generated code", since
    writing some generators and resulting arbitrarily many lines of code.


    I'm familiar with the language standards. In fact,
    I ever prefer "strict" quite usually.



    I haven't been involved in making decisions to fire people for their
    code quality, though one time my job was to make the firing machine go faster. I didn't really appreciate that, since then when my next job was
    to fix a bug in the arbitration system, I found a bunch of their bugs,
    and fixed them, then they were like, you know, embarrassed.
    I did what they said, problem is they didn't know I'd do what I should.
    I automatically detect obvious bugs.

    I'm a full-stack enterprise dev, all-phases analysis, design, and implementation, thanks. Familiar with "500 page specs" a bit more
    than "the 30,000 foot view". So, I know C/C++, and Java, and Perl and
    Python and JavaScript or Typescript and a bit of Ruby or Go and of
    course shell scripts and all their build systems and most of the little dotfile syntaxes, and of course "SQL", or how Oracle does it and a bit
    of Postgres and MS for particulars, or for things like "the data
    ware-house".


    About encoding two integers in one integer, there are any number of ways
    to do it, for example where they're on the same order and where they're
    not on the same order, where one's best case is the other's worst case,
    and vice versa. Sort of like big-end and little-end vis-a-vis 2-tuples.

    I know binary.


    On my video essays under "Logos 2000" there are some "Logos 2000:
    software ..." bits, or "o.s. walkthrough" or something, since I study computer science also, and even a bit of computer engineering.






    I.e., when I say "full-stack", I mean "the entire full-stack".


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to sci.logic,sci.math on Thu Jun 18 04:50:27 2026
    From Newsgroup: sci.logic

    On 6/18/2026 12:21 AM, Ross Finlayson wrote:
    [...]
    I.e., when I say "full-stack", I mean "the entire full-stack".



    Oh nice. copyright 2003? Right? But why the typedef to ull? Strange to
    me. Anyway, yup. Got your chops. Also, your comment about C/C++ was odd
    to me. They are completely different langs. Fwiw, one thing. I was
    involved with creating the EventCount way back. Every used them before?
    Fwiw, read all of:

    https://gist.github.com/mratsim/04a29bdd98d6295acda4d0677c4d0041

    Its rather obscure. But shit happens. Sorry.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to sci.logic,sci.math on Thu Jun 18 04:57:36 2026
    From Newsgroup: sci.logic

    On 6/18/2026 4:50 AM, Chris M. Thomasson wrote:
    On 6/18/2026 12:21 AM, Ross Finlayson wrote:
    [...]
    I.e., when I say "full-stack", I mean "the entire full-stack".



    Oh nice. copyright 2003? Right? But why the typedef to ull? Strange to
    me. Anyway, yup. Got your chops. Also, your comment about C/C++ was odd
    to me. They are completely different langs. Fwiw, one thing. I was
    involved with creating the EventCount way back. Every used them before? Fwiw, read all of:

    https://gist.github.com/mratsim/04a29bdd98d6295acda4d0677c4d0041

    Its rather obscure. But shit happens. Sorry.

    Also, I had a personal resource issue with a patent, got abandoned shit happens. But its referenced a lot out there. nvidia is one.

    This still pisses me off:

    https://patents.google.com/patent/US20070067770A1
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to sci.logic,sci.math on Thu Jun 18 05:06:24 2026
    From Newsgroup: sci.logic

    On 6/18/2026 4:50 AM, Chris M. Thomasson wrote:
    On 6/18/2026 12:21 AM, Ross Finlayson wrote:
    [...]
    I.e., when I say "full-stack", I mean "the entire full-stack".



    Oh nice. copyright 2003? Right? But why the typedef to ull? Strange to
    me. Anyway, yup. Got your chops. Also, your comment about C/C++ was odd
    to me. They are completely different langs. Fwiw, one thing. I was
    involved with creating the EventCount way back. Every used them before? Fwiw, read all of:

    https://gist.github.com/mratsim/04a29bdd98d6295acda4d0677c4d0041

    Its rather obscure. But shit happens. Sorry.

    At least they had to cite me:



    Cited By (17)
    Publication number Priority date Publication date Assignee Title
    US20090019079A1 * 2007-07-11 2009-01-15 Mats Stefan Persson Method,
    system and computer-readable media for managing software object handles
    in a dual threaded environment
    US20090193279A1 * 2008-01-30 2009-07-30 Sandbridge Technologies, Inc.
    Method for enabling multi-processor synchronization
    US20100100889A1 * 2008-10-16 2010-04-22 International Business Machines
    Corporation Accelerating mutual exclusion locking function and condition signaling while maintaining priority wait queues
    US20130097116A1 * 2011-10-17 2013-04-18 Research In Motion Limited
    Synchronization method and associated apparatus
    US20130298133A1 * 2012-05-02 2013-11-07 Stephen Jones Technique for
    computational nested parallelism
    US8615771B2 2011-06-20 2013-12-24 International Business Machines
    Corporation Effective management of blocked-tasks in preemptible
    read-copy update
    US9110680B1 * 2013-03-14 2015-08-18 Amazon Technologies, Inc. Avoiding
    or deferring data copies
    US9317290B2 2007-05-04 2016-04-19 Nvidia Corporation Expressing parallel
    execution relationships in a sequential programming language
    US20170187640A1 * 2015-12-26 2017-06-29 Intel Corporation Application-level network queueing
    US9847950B1 * 2017-03-16 2017-12-19 Flexera Software Llc Messaging
    system thread pool
    US20180239652A1 * 2017-02-22 2018-08-23 Red Hat Israel, Ltd. Lightweight
    thread synchronization using shared memory state
    US10372517B2 2017-07-21 2019-08-06 TmaxData Co., Ltd. Message scheduling
    method
    US20190294440A1 * 2016-11-24 2019-09-26 Silcroad Soft, Inc Computer
    program, method, and device for distributing resources of computing device US20190391857A1 * 2018-06-21 2019-12-26 International Business Machines
    Corporation Consolidating Read-Copy Update Flavors Having Different Notions Of What Constitutes A Quiescent State
    US20200233704A1 * 2019-01-18 2020-07-23 EMC IP Holding Company LLC
    Multi-core processor in storage system executing dedicated polling
    thread for increased core availability
    US20240095061A1 * 2022-09-19 2024-03-21 GM Global Technology Operations
    LLC Vehicle-onboard computing architecture for sensor alignment US12153962B2 2020-04-15 2024-11-26 Intel Corporation Storage
    transactions with predictable latency
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to sci.logic,sci.math on Thu Jun 18 05:18:59 2026
    From Newsgroup: sci.logic

    On 6/18/2026 12:21 AM, Ross Finlayson wrote:
    [...]

    Nice. Fwiw, Sun gave me a T2000 SunFire server for my vZoom project in
    their Coolthreads contest:

    https://web.archive.org/web/20070620081114/https://coolthreads.dev.java.net/

    Can you get to that damn old link?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to sci.logic,sci.math on Thu Jun 18 05:34:07 2026
    From Newsgroup: sci.logic

    On 6/18/2026 4:50 AM, Chris M. Thomasson wrote:
    On 6/18/2026 12:21 AM, Ross Finlayson wrote:
    [...]
    I.e., when I say "full-stack", I mean "the entire full-stack".



    Oh nice. copyright 2003? Right? But why the typedef to ull? Strange to
    me. Anyway, yup. Got your chops. Also, your comment about C/C++ was odd
    to me. They are completely different langs. Fwiw, one thing. I was
    involved with creating the EventCount way back. Every used them before? Fwiw, read all of:

    https://gist.github.com/mratsim/04a29bdd98d6295acda4d0677c4d0041

    Its rather obscure. But shit happens. Sorry.


    Oh, I also made the cover of the 2025 AMS Calendar. February. Can you
    get to this link?

    https://www.facebook.com/share/p/1H7qf8KuJR/

    If not tell me.
    --- Synchronet 3.22a-Linux NewsLink 1.2