1 /*
2 Copyright (C) 2015-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5 
6 /*
7 	WARNING: This file was generated by the dkct program (see
8 	http://dktools.sourceforge.net/ for details).
9 	Changes you make here will be lost if dkct is run again!
10 	You should modify the original source and run dkct on it.
11 	Original source: dk4maasz.ctr
12 */
13 
14 #ifndef DK4MAASZ_H_INCLUDED
15 /** Avoid multiple inclusions. */
16 #define DK4MAASZ_H_INCLUDED 1
17 
18 
19 /**	@file
20 	Arithmetic operations on size_t.
21 
22 	CRT on Windows: Optional.
23 */
24 
25 #ifndef DK4CONF_H_INCLUDED
26 #if DK4_BUILDING_DKTOOLS4
27 #include "dk4conf.h"
28 #else
29 #include <dktools-4/dk4conf.h>
30 #endif
31 #endif
32 
33 #ifndef DK4TYPES_H_INCLUDED
34 #if DK4_BUILDING_DKTOOLS4
35 #include <libdk4base/dk4types.h>
36 #else
37 #include <dktools-4/dk4types.h>
38 #endif
39 #endif
40 
41 #ifndef DK4ERROR_H_INCLUDED
42 #if DK4_BUILDING_DKTOOLS4
43 #include <libdk4base/dk4error.h>
44 #else
45 #include <dktools-4/dk4error.h>
46 #endif
47 #endif
48 
49 
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /**	Addition of size_t values.
56 	@param	a	Left operand.
57 	@param	b	Right operand.
58 	@param	erp	Error report, may be NULL.
59 	@return	Result.
60 */
61 size_t
62 dk4ma_size_t_add(size_t a, size_t b, dk4_er_t *erp);
63 
64 /**	Difference of size_t values.
65 	@param	a	Left operand.
66 	@param	b	Right operand.
67 	@param	erp	Error report, may be NULL.
68 	@return	Result.
69 */
70 size_t
71 dk4ma_size_t_sub(size_t a, size_t b, dk4_er_t *erp);
72 
73 /**	Multiplication of size_t values.
74 	@param	a	Left operand.
75 	@param	b	Right operand.
76 	@param	erp	Error report, may be NULL.
77 	@return	Result.
78 */
79 size_t
80 dk4ma_size_t_mul(size_t a, size_t b, dk4_er_t *erp);
81 
82 /**	Convert dk4_um_t value to size_t.
83 	@param	u	Value to convert.
84 	@param	erp	Error report, may be NULL.
85 	@return	Conversion result.
86 
87 	Error codes: DK4_E_MATH_OVERFLOW.
88 */
89 size_t
90 dk4ma_size_t_from(dk4_um_t u, dk4_er_t *erp);
91 
92 /**	Convert double to signed char.
93 	@param	d	Value to convert.
94 	@param	erp	Error report, may be NULL.
95 	@return	Conversion result.
96 
97 	Error codes: DK4_E_OVERFLOW.
98 */
99 size_t
100 dk4ma_size_t_from_double(double d, dk4_er_t *erp);
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 
107 #endif
108