Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Interger over/under flow in C?

Name: VIPPER 2012-05-01 13:18

Is there a way to implement a portable way of detecting over and underflows in C?

Another thing, my asm code that handles this for now doesnt work either. I cant figure out why not.

asm ("overflow: "
     "xorl %eax, %eax \n"
     "jno O_Ret \n"
     "incl %eax \n"
     "O_Ret: ret\n");

nig_t fuck () {
  nig_t ass = tits + dick;
  if (overflow)
    return piss;
  if (underflow)
    return shit;
  return ass;
}

Now if i could figure out a way for this to work it would only work temporary, as i will need a portable way in the future anyway.

Any help would be appreciated.

Name: Anonymous 2012-05-04 8:33

>>62
Bitwise operations are NOT defined for things that aren't represented by a binary vector. It's very simple, you can't define bitwise operations in ternary because it simply doesn't make sense to do so, and even more so for BCD. Every bitwise operation is undefined for non-binary processors. That accounts for your | & ^ and ~ operators. >> and << are bitshift operators that could be defined, but that would change their function to digit-shifting. In the exact same way that conventional programming languages don't execute on qubits, a large portion of C is undefined on anything not binary.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List