diff options
author | Norbert Preining <norbert@preining.info> | 2020-10-12 03:04:00 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-10-12 03:04:00 +0000 |
commit | 0ce40abb18ec02ec6fd6bcc5f21612c88daa7578 (patch) | |
tree | 416289fe1448873fd8ca33051f50ad85bffa8aaa /support/dktools/dk4maaui.c | |
parent | fdb18507cd80dc17f5a5256153d34668b4f4e61c (diff) |
CTAN sync 202010120303
Diffstat (limited to 'support/dktools/dk4maaui.c')
-rw-r--r-- | support/dktools/dk4maaui.c | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/support/dktools/dk4maaui.c b/support/dktools/dk4maaui.c deleted file mode 100644 index 4dd4cc1f88..0000000000 --- a/support/dktools/dk4maaui.c +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright (C) 2015-2020, Dirk Krause -SPDX-License-Identifier: BSD-3-Clause -*/ - -/* - WARNING: This file was generated by the dkct program (see - http://dktools.sourceforge.net/ for details). - Changes you make here will be lost if dkct is run again! - You should modify the original source and run dkct on it. - Original source: dk4maaui.ctr -*/ - -/** @file dk4maaui.c The dk4maaui module. -*/ - - -#line 123 "dk4maaui.ctr" - -#include "dk4conf.h" -#include "dk4types.h" -#include "dk4error.h" -#include "dk4numco.h" -#include "dk4maaui.h" - - -unsigned -dk4ma_uint_add(unsigned a, unsigned b, dk4_er_t *erp) -{ - if ((UINT_MAX - a) < b) { - dk4error_set_simple_error_code(erp, DK4_E_MATH_OVERFLOW); - } - return (unsigned)(a + b); -} - - - -unsigned -dk4ma_uint_sub(unsigned a, unsigned b, dk4_er_t *erp) -{ - if (b > a) { - dk4error_set_simple_error_code(erp, DK4_E_MATH_OVERFLOW); - } - return (unsigned)(a - b); -} - - - -unsigned -dk4ma_uint_mul(unsigned a, unsigned b, dk4_er_t *erp) -{ - if (0U < a) { - if ((UINT_MAX / a) < b) { - dk4error_set_simple_error_code(erp, DK4_E_MATH_OVERFLOW); - } - } - return (unsigned)(a * b); -} - - - -unsigned -dk4ma_uint_div(unsigned a, unsigned b, dk4_er_t *erp) -{ - if (0U < b) { - return (unsigned)(a / b); - } else { - dk4error_set_simple_error_code(erp, DK4_E_MATH_DIVZERO); - return (unsigned)(UINT_MAX); - } -} - - - -unsigned -dk4ma_uint_from(dk4_um_t u, dk4_er_t *erp) -{ - if ((dk4_um_t)(UINT_MAX) < u) { - dk4error_set_simple_error_code(erp, DK4_E_MATH_OVERFLOW); - } - return ((unsigned)u); -} - - - -unsigned -dk4ma_uint_from_double(double d, dk4_er_t *erp) -{ - unsigned back = 0U; - if ((double)(UINT_MAX) < d) { - back = UINT_MAX; - dk4error_set_simple_error_code(erp, DK4_E_MATH_OVERFLOW); - } - else { - if (0.0 > d) { - dk4error_set_simple_error_code(erp,DK4_E_MATH_OVERFLOW); - } - else { - back = (unsigned)d; - } - } - return back; -} - - |