static uint64_t iterations_num = 1000000;
static char *input_file = NULL;
+static _Bool exit_after_collision = 0;
+
static sn_hashtable_t *hashtable;
static double possible_cuts (int inputs_num) /* {{{ */
printf ("sn-count-cuts [options] <file0> <file1>\n"
"\n"
"Options:\n"
+ " -1 Exit after the first collision has been detected.\n"
" -c Number of cuts to perform.\n"
" -n Maximum number of cuts to perform.\n"
" -h Display this help and exit.\n"
{
int option;
- while ((option = getopt (argc, argv, "c:n:h")) != -1)
+ while ((option = getopt (argc, argv, "1c:n:h")) != -1)
{
switch (option)
{
+ case '1':
+ exit_after_collision = 1;
+ break;
+
case 'c':
{
int tmp = atoi (optarg);
{
create_random_cut (n);
+ if (exit_after_collision)
+ if (sn_hashtable_get_collisions (hashtable) > 0)
+ break;
+
if ((i < 100)
|| ((i < 1000) && (((i + 1) % 10) == 0))
|| ((i < 10000) && (((i + 1) % 100) == 0))