Vereinfachung für folgenden Code gesucht



  • Hallo, ich habe folgendes Stück Code (Sprache C++):

    uint64 a, b;
    uint128 d;
    //...
    d |= a;
    uint64 result = d/b;
    d = (d%a) << 64;
    

    Das Problem dabei ist, dass ich keinen typ "uint128" habe. Also habe ich versucht, das irgendwie mit uint64 auszudrücken:

    uint64 a, b;
    uint64 d_low, d_high;
    //...
    d_low = a;
    uint64 result = d_high/a;
    d_high = l_low % a;
    

    Aber so funktionierts leider nicht.
    Wie mache ich das richtig?


Anmelden zum Antworten