Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

563580 views
1
#include "typedef.h"
2
#include "tools.h"
3
4
/**************************************************************************\
5
@---------------------------------------------------------------------------
6
@---------------------------------------------------------------------------
7
@ FILE: ovfl_mul.c
8
@---------------------------------------------------------------------------
9
@---------------------------------------------------------------------------
10
@
11
\**************************************************************************/
12
13
/*
14
@-------------------------------------------------------------------------
15
@ int ovfl_mul( a, b);
16
@ int a,b;
17
@
18
@ The routine should catch an integer-overflow.
19
@ Slow. Unluckily "c" does not provide machine-independent access to the
20
@ integer hardware overflow-routines.
21
@ if there is no overflow the function returns the product a*b,
22
@ otherwise the program exits.
23
@
24
@-------------------------------------------------------------------------
25
*/
26
int ovfl_mul( a, b)
27
int a, b;
28
{
29
register int result;
30
31
result = a * b;
32
if ( result / a != b ) {
33
fprintf(stderr,"ovfl_mul: Error: Integer overflow during multiplication\n");
34
fprintf(stderr,"left operand: 0x%08x, right operand: 0x%08x, result: 0x%08x\n", a, b, result );
35
exit(3);
36
}
37
return result;
38
}
39
40
/*{{{}}}*/
41
42