1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-15 15:57:13 +00:00
Interlisp.maiko/inc/arith2.h
Nick Briggs a093d80fa5
Add include guards to all the include files in inc/ which were missing them. (#189)
As a prerequisite for cleaning up some other include issues, all the
include files in inc/ should have an include guard.  All the xxxdefs.h
were created with them, but most older files were not.
2021-01-07 03:06:42 +00:00

141 lines
3.2 KiB
C

#ifndef ARITH2_H
#define ARITH2_H 1
/* $Id: arith2.h,v 1.2 1999/01/03 02:05:52 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* Take care of results for inlined arithmetic cases. */
/* xxx_RESULT does overflow checking and boxing. */
/* */
/* */
/************************************************************************/
#ifdef ARITHINLINE
#ifdef GCC386
/* Inline defines for arith on GCC386 machines */
extern inline const int plus32 (int arg1, int arg2)
{
asm(" addl %2,%0 \n\
jo plus_err": "=r" (arg2): "0" (arg2), "r" (arg1));
return arg2;
}
#define PLUS_RESULT \
INLINE_ARITH_SWITCH(result,"plus_ret"); \
asm("plus_err:"); \
INLINE_ERROR_EXIT(tos,"plus_ret")
extern inline const int iplus32 (int arg1, int arg2)
{
asm(" addl %2,%0 \n\
jo iplus_err": "=r" (arg2): "0" (arg2), "r" (arg1));
return arg2;
}
#define IPLUS_RESULT \
INLINE_ARITH_SWITCH(result,"iplus_ret"); \
asm("iplus_err:"); \
INLINE_ERROR_EXIT(tos,"iplus_ret")
extern inline const int sub32 (int arg1, int arg2)
{
asm("subl %2,%0 \n\
jo diff_err": "=r" (arg1): "0" (arg1), "r" (arg2));
return arg1;
}
#define DIFF_RESULT \
INLINE_ARITH_SWITCH(result,"diff_ret"); \
asm("diff_err:"); \
INLINE_ERROR_EXIT(tos,"diff_ret")
extern inline const int isub32 (int arg1, int arg2)
{
asm(" subl %2,%0 \n\
jo idiff_err": "=r" (arg1): "0" (arg1), "r" (arg2));
return arg1;
}
#define IDIFF_RESULT \
INLINE_ARITH_SWITCH(result,"idiff_ret"); \
asm("idiff_err:"); \
INLINE_ERROR_EXIT(tos,"idiff_ret")
extern inline const int iplus32n(int arg1, int arg2)
{
asm("addl %2,%0 \n\
jo iplusn_err": "=r" (arg2): "0" (arg2), "r" (arg1));
return arg2;
}
#define IPLUSN_RESULT \
INLINE_ARITH_SWITCH(result,"iplusn_ret"); \
asm("iplusn_err:"); \
INLINE_ERROR_EXIT(tos,"iplusn_ret")
extern inline const int sub32n (int arg1, int arg2)
{
asm(" subl %2,%0 \n\
jo idiffn_err": "=r" (arg1): "0" (arg1), "r" (arg2));
return arg1;
}
#define IDIFFN_RESULT \
INLINE_ARITH_SWITCH(result,"idiffn_ret"); \
asm("idiffn_err:"); \
INLINE_ERROR_EXIT(tos,"idiffn_ret")
#else /* Any other ARITHINLINE case */
#define PLUS_RESULT \
N_ARITH_SWITCH(result); \
doufn2: plus_err_label(); \
ERROR_EXIT(tos);
#define IPLUS_RESULT \
N_ARITH_SWITCH(result); \
dummy: iplus_err_label();
#define DIFF_RESULT \
N_ARITH_SWITCH(result); \
doufn2: diff_err_label(); \
ERROR_EXIT(tos);
#define IDIFF_RESULT \
N_ARITH_SWITCH(result); \
dummy: idiff_err_label();
#define IPLUSN_RESULT \
N_ARITH_SWITCH(result); \
dummy: iplusn_err_label();
#define IDIFFN_RESULT \
N_ARITH_SWITCH(result); \
dummy: idiffn_err_label();
#endif /* GCC386 */
#endif /* ARITHINLINE */
#endif /* ARITH2_H */