http://www.xibak.com/rjbc_C-yuyan_02054161441
Check for arithemtic overflow

《CSAPP》 proves the Correctness of the code below
/* Determine whether arguments can be added without overflow */ 
int uadd_ok(unsigned int x, unsigned int y) 
{ 
return !(x+y < x); 
}

/* Determine whether argumnts can be substracted without overflow */ 
int usub_ok(unsigned int x, unsigned int y) 
{ 
return !y || !uadd_ok(x, -y); 
}

/* Determine whether arguments can be multiplied without overflow */ 
int umul_ok(unsigned int x, unsigned int y) 
{ 
unsigned int p = x * y; 
return !x || p/x==y; 
}