2012-11-27 15:23:21 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
2013-03-20 16:51:12 +00:00
|
|
|
#include <inttypes.h>
|
2012-11-27 15:23:21 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <assert.h>
|
2013-03-22 19:03:46 +00:00
|
|
|
#include <sys/types.h>
|
2012-11-27 15:23:21 +00:00
|
|
|
|
|
|
|
#include <tokudb_math.h>
|
|
|
|
using namespace tokudb;
|
|
|
|
|
|
|
|
static void test(int length_bits) {
|
|
|
|
int64_t max = (1ULL << (length_bits-1)) - 1;
|
|
|
|
for (int64_t x = -max-1; x <= max; x++) {
|
|
|
|
for (int64_t y = -max-1; y <= max; y++) {
|
|
|
|
bool over;
|
2012-12-10 19:37:47 +00:00
|
|
|
int64_t n = int_add(x, y, length_bits, &over);
|
2013-03-20 16:51:12 +00:00
|
|
|
printf("%"PRId64" %"PRId64" %"PRId64" %u\n", x, y, n, over);
|
2012-11-27 15:23:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
if (argc > 1) {
|
|
|
|
for (int i = 1; i < argc; i++) {
|
|
|
|
test(atoi(argv[i]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|