This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is it possible to have a 64bit Integer addition in C?

Is it possible to have a 64bit or 96 Integer addition in C?

Parents
  • "i hope you can show me a little example"

    struct U64 {
        unsigned long msl;
        unsigned long lsl;
    };
    
    struct U64 U64_sum(struct U64 augend, struct U64 addend)
    {
        struct U64 sum;
    
        sum.msl = augend.msl + addend.msl;
        sum.lsl = augend.lsl + addend.lsl;
    
        if (sum.lsl < augend.lsl)   /* Carry? */
            ++sum.msl;
    
        return sum;
    }

Reply
  • "i hope you can show me a little example"

    struct U64 {
        unsigned long msl;
        unsigned long lsl;
    };
    
    struct U64 U64_sum(struct U64 augend, struct U64 addend)
    {
        struct U64 sum;
    
        sum.msl = augend.msl + addend.msl;
        sum.lsl = augend.lsl + addend.lsl;
    
        if (sum.lsl < augend.lsl)   /* Carry? */
            ++sum.msl;
    
        return sum;
    }

Children
No data