. service tells you which device it couldn't stat
[minix3.git] / lib / ack / libm2 / ucheck.c
blob411a7ce338cf2dca9f306b5312e1db1dc3a9711f
1 /*
2 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 * Module: CARDINAL operations with overflow checking
7 * Author: Ceriel J.H. Jacobs
8 * Version: $Header$
9 */
11 #ifndef EM_WSIZE
12 #define EM_WSIZE _EM_WSIZE
13 #endif
14 #ifndef EM_LSIZE
15 #define EM_LSIZE _EM_LSIZE
16 #endif
18 #include <m2_traps.h>
20 #define MAXCARD ((unsigned)-1)
21 #if EM_WSIZE < EM_LSIZE
22 #define MAXLONGCARD ((unsigned long) -1L)
23 #endif
25 adduchk(a,b)
26 unsigned a,b;
28 if (MAXCARD - a < b) TRP(M2_UOVFL);
31 #if EM_WSIZE < EM_LSIZE
32 addulchk(a,b)
33 unsigned long a,b;
35 if (MAXLONGCARD - a < b) TRP(M2_UOVFL);
37 #endif
39 muluchk(a,b)
40 unsigned a,b;
42 if (a != 0 && MAXCARD/a < b) TRP(M2_UOVFL);
45 #if EM_WSIZE < EM_LSIZE
46 mululchk(a,b)
47 unsigned long a,b;
49 if (a != 0 && MAXLONGCARD/a < b) TRP(M2_UOVFL);
51 #endif
53 subuchk(a,b)
54 unsigned a,b;
56 if (b < a) TRP(M2_UUVFL);
59 #if EM_WSIZE < EM_LSIZE
60 subulchk(a,b)
61 unsigned long a,b;
63 if (b < a) TRP(M2_UUVFL);
65 #endif