/[dotgnu-pnet]/pnet/engine/cvm_arith.c
ViewVC logotype

Diff of /pnet/engine/cvm_arith.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by tum, Thu Jun 17 17:38:24 2004 UTC revision 1.17 by ktreichel, Sat Oct 15 15:13:47 2005 UTC
# Line 23  Line 23 
23  /*  /*
24   * Integer add with overflow detection.   * Integer add with overflow detection.
25   */   */
26  static IL_INLINE int IAddOvf(ILInt32 *result, ILInt32 a, ILInt32 b)  static IL_INLINE int IAddOvf(volatile ILInt32 *result, ILInt32 a, ILInt32 b)
27  {  {
28          if(a >= 0 && b >= 0)          if(a >= 0 && b >= 0)
29          {          {
# Line 43  static IL_INLINE int IAddOvf(ILInt32 *re Line 43  static IL_INLINE int IAddOvf(ILInt32 *re
43  /*  /*
44   * Unsigned integer add with overflow detection.   * Unsigned integer add with overflow detection.
45   */   */
46  static IL_INLINE int IUAddOvf(ILUInt32 *result, ILUInt32 a, ILUInt32 b)  static IL_INLINE int IUAddOvf(volatile ILUInt32 *result, ILUInt32 a, ILUInt32 b)
47  {  {
48          return ((*result = a + b) >= a);          return ((*result = a + b) >= a);
49  }  }
# Line 51  static IL_INLINE int IUAddOvf(ILUInt32 * Line 51  static IL_INLINE int IUAddOvf(ILUInt32 *
51  /*  /*
52   * Integer subtract with overflow detection.   * Integer subtract with overflow detection.
53   */   */
54  static IL_INLINE int ISubOvf(ILInt32 *result, ILInt32 a, ILInt32 b)  static IL_INLINE int ISubOvf(volatile ILInt32 *result, ILInt32 a, ILInt32 b)
55  {  {
56          if(a >= 0 && b >= 0)          if(a >= 0 && b >= 0)
57          {          {
# Line 76  static IL_INLINE int ISubOvf(ILInt32 *re Line 76  static IL_INLINE int ISubOvf(ILInt32 *re
76  /*  /*
77   * Unsigned integer subtract with overflow detection.   * Unsigned integer subtract with overflow detection.
78   */   */
79  static IL_INLINE int IUSubOvf(ILUInt32 *result, ILUInt32 a, ILUInt32 b)  static IL_INLINE int IUSubOvf(volatile ILUInt32 *result, ILUInt32 a, ILUInt32 b)
80  {  {
81          return ((*result = a - b) <= a);          return ((*result = a - b) <= a);
82  }  }
# Line 84  static IL_INLINE int IUSubOvf(ILUInt32 * Line 84  static IL_INLINE int IUSubOvf(ILUInt32 *
84  /*  /*
85   * Integer multiply with overflow detection.   * Integer multiply with overflow detection.
86   */   */
87  static IL_INLINE int IMulOvf(ILInt32 *result, ILInt32 a, ILInt32 b)  static IL_INLINE int IMulOvf(volatile ILInt32 *result, ILInt32 a, ILInt32 b)
88  {  {
89          ILInt64 temp = ((ILInt64)a) * ((ILInt64)b);          ILInt64 temp = ((ILInt64)a) * ((ILInt64)b);
90          if(temp >= (ILInt64)IL_MIN_INT32 && temp <= (ILInt64)IL_MAX_INT32)          if(temp >= (ILInt64)IL_MIN_INT32 && temp <= (ILInt64)IL_MAX_INT32)
# Line 101  static IL_INLINE int IMulOvf(ILInt32 *re Line 101  static IL_INLINE int IMulOvf(ILInt32 *re
101  /*  /*
102   * Unsigned integer multiply with overflow detection.   * Unsigned integer multiply with overflow detection.
103   */   */
104  static IL_INLINE int IUMulOvf(ILUInt32 *result, ILUInt32 a, ILUInt32 b)  static IL_INLINE int IUMulOvf(volatile ILUInt32 *result, ILUInt32 a, ILUInt32 b)
105  {  {
106          ILUInt64 temp = ((ILUInt64)a) * ((ILUInt64)b);          ILUInt64 temp = ((ILUInt64)a) * ((ILUInt64)b);
107          if(temp <= (ILUInt64)IL_MAX_UINT32)          if(temp <= (ILUInt64)IL_MAX_UINT32)

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26