src/arith2.c
/************************************************************************/
/*									*/
/*			N _ O P _ i p l u s 2				*/
/*									*/
/*	Implements the IPLUS2 opcode--add the two arguments, which	*/
/*	must be SMALLP or FIXP						*/
/*									*/
/************************************************************************/
N _ O P _ i p l u s 2

Implements the IPLUS2 opcode--add the two arguments, which
must be SMALLP or FIXP
N _ O P _ i p l u s 2 Implements the IPLUS2 opcode -- add the two arguments which must be SMALLP or FIXP
LispPTR N_OP_iplus2(int tosm1, int tos) {
  int arg1, arg2;
  int result;
  N_IGETNUMBER(tos, arg1, doufn);
  N_IGETNUMBER(tosm1, arg2, doufn);
#ifdef USE_OVERFLOW_BUILTINS
  if (__builtin_sadd_overflow(arg1, arg2, &result)) {
    ERROR_EXIT(tos);
  }
  N_ARITH_SWITCH(result);
#else
  result = arg1 + arg2;
  if (((arg1 >= 0) == (arg2 >= 0)) && ((result >= 0) != (arg1 >= 0))) { ERROR_EXIT(tos); }
  N_ARITH_SWITCH(result);
#endif
doufn:
  ERROR_EXIT(tos);
}
LispPTR N_OP_iplus2 ( int tosm1 , int tos ) { int arg1 , arg2 ; int result ; N_IGETNUMBER ( tos , arg1 , doufn ) ; N_IGETNUMBER ( tosm1 , arg2 , doufn ) ; #ifdef USE_OVERFLOW_BUILTINS if ( __builtin_sadd_overflow ( arg1 , arg2 , & result ) ) { ERROR_EXIT ( tos ) ; } N_ARITH_SWITCH ( result ) ; #else result = arg1 + arg2 ; if ( ( ( arg1 >= 0 ) == ( arg2 >= 0 ) ) && ( ( result >= 0 ) != ( arg1 >= 0 ) ) ) { ERROR_EXIT ( tos ) ; } N_ARITH_SWITCH ( result ) ; #endif doufn : ERROR_EXIT ( tos ) ; }
N _ O P _ i p l u s 2
N _ O P _ i p l u s 2
/* UB: signed integer overflow: 2147483647 + 2147483647 cannot be represented in type 'int' */