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: dk4maamu.ctr 12 */ 13 14 #ifndef DK4MAAMU_H_INCLUDED 15 /** Avoid multiple inclusions. */ 16 #define DK4MAAMU_H_INCLUDED 1 17 18 19 /** @file 20 Arithmetic operations on uintmax_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 #if DK4_HAVE_INTMAX_T 56 57 /** Addition. 58 @param a Left operand. 59 @param b Right operand. 60 @param erp Error report, may be NULL. 61 @return Result on success, least significant result bits 62 on overflow (see ec component of erp). 63 64 Error codes: DK4_E_OVERFLOW. 65 */ 66 uintmax_t 67 dk4ma_uintmax_t_add(uintmax_t a, uintmax_t b, dk4_er_t *erp); 68 69 /** Subtraction. 70 @param a Left operand. 71 @param b Right operand. 72 @param erp Error report, may be NULL. 73 @return Result on success, least significant result bits 74 on overflow (see ec component of erp). 75 76 Error codes: DK4_E_OVERFLOW. 77 */ 78 uintmax_t 79 dk4ma_uintmax_t_sub(uintmax_t a, uintmax_t b, dk4_er_t *erp); 80 81 /** Multiplication. 82 @param a Left factor. 83 @param b right factor. 84 @param erp Error report, may be NULL. 85 @return Result on success, least significant 86 bits on overflow (see ec component of erp). 87 88 Error codes: DK4_E_OVERFLOW. 89 */ 90 uintmax_t 91 dk4ma_uintmax_t_mul(uintmax_t a, uintmax_t b, dk4_er_t *erp); 92 93 /** Division. 94 @param a Counter (left operand). 95 @param b Denominator (right operand). 96 @param erp Error report, may be NULL. 97 @return Division result on success, 98 UINTMAX_MAX on division by zero 99 (see the ec component of erp). 100 101 Error codes: DK4_E_DIVZERO. 102 */ 103 uintmax_t 104 dk4ma_uintmax_t_div(uintmax_t a, uintmax_t b, dk4_er_t *erp); 105 106 #endif 107 108 #ifdef __cplusplus 109 } 110 #endif 111 112 113 114 #endif 115