Detecting arithmetic overflow in C with NASM
This snippet is about detecting whether the carry flag is set or cleared. I work on Mac OSX, so my snippet supports Mac only. First, we need a routine that does the job: func.s: global _read_carry_flag _read_carry_flag: mov al, 0 jnc end mov al, 1 end: ret (Try nasm2 -f macho64 func.s for compiling into … Read more