45#define stmt x = 1, x = 1
52#define stmt y = safe::add(j, x)
55#define stmt y = safe::mult(j, x)
57#define stmt y = safe::mult(j, x)
60#define stmt y = safe::minus(x)
68volatile int s0 = 100,
x = 200;
70int main(
int argc,
char **argv)
79 if (0 == strcmp(argv[1],
"sub"))
81 printf(
"test failed, result %x\n",
85 else if (0 == strcmp(argv[1],
"add"))
87 printf(
"test failed, result %x\n",
91 else if (0 == strcmp(argv[1],
"mult"))
93 printf(
"test failed, result %x\n",
97 else if (0 == strcmp(argv[1],
"div"))
99 printf(
"test failed, result %x\n",
103 else if (0 == strcmp(argv[1],
"minus"))
105 printf(
"test failed, result %x\n",
109 else if (0 == strcmp(argv[1],
"throw"))
111 safe::ov(
"throw overflow exception");
112 printf(
"test failed\n");
117 printf(
"unknown test: %s\n", argv[1]);
123 for (i =
outer; i > 0; i--)
124 for (j = 0; j <
inner; j++)
static int32_t mult(int32_t x, int32_t y, const char *msg)
static int32_t add(int32_t x, int32_t y, const char *msg)
static int32_t div(int32_t x, int32_t y, const char *msg)
static int32_t sub(int32_t x, int32_t y, const char *msg)
static int32_t minus(int32_t x, const char *msg)
Overflow-checked integer arithmetic for monomial exponents and degree sums.