]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/d/dmd/checkedint.h
1f6545b6c62ffb9539a70f78203704e434df5647
[thirdparty/gcc.git] / gcc / d / dmd / checkedint.h
1
2 /* Compiler implementation of the D programming language
3 * Copyright (C) 2003-2018 by The D Language Foundation, All Rights Reserved
4 * written by Walter Bright
5 * http://www.digitalmars.com
6 * Distributed under the Boost Software License, Version 1.0.
7 * http://www.boost.org/LICENSE_1_0.txt
8 * https://github.com/D-Programming-Language/dmd/blob/master/src/checkedint.h
9 */
10
11 #pragma once
12
13 #ifndef __STDC_LIMIT_MACROS
14 #define __STDC_LIMIT_MACROS 1
15 #endif
16 #include <stdint.h>
17
18
19 int adds(int x, int y, bool& overflow);
20 int64_t adds(int64_t x, int64_t y, bool& overflow);
21 unsigned addu(unsigned x, unsigned y, bool& overflow);
22 uint64_t addu(uint64_t x, uint64_t y, bool& overflow);
23
24 int subs(int x, int y, bool& overflow);
25 int64_t subs(int64_t x, int64_t y, bool& overflow);
26 unsigned subu(unsigned x, unsigned y, bool& overflow);
27 uint64_t subu(uint64_t x, uint64_t y, bool& overflow);
28
29 int negs(int x, bool& overflow);
30 int64_t negs(int64_t x, bool& overflow);
31
32 int muls(int x, int y, bool& overflow);
33 int64_t muls(int64_t x, int64_t y, bool& overflow);
34 unsigned mulu(unsigned x, unsigned y, bool& overflow);
35 uint64_t mulu(uint64_t x, uint64_t y, bool& overflow);