static void do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len) { size_t i, j; char *s1, *s2; align1 &= 63; if (align1 + len >= page_size) return; align2 &= 63; if (align2 + len >= page_size) return; s1 = (char *) (buf2 + align1); s2 = (char *) (buf2 + align2); for (i = 0, j = 1; i < len; i++, j += 23) s1[i] = j; json_element_object_begin (json_ctx); json_attr_uint (json_ctx, "length", (double) len); json_attr_uint (json_ctx, "align1", (double) align1); json_attr_uint (json_ctx, "align2", (double) align2); json_array_begin (json_ctx, "timings"); FOR_EACH_IMPL (impl, 0) do_one_test (json_ctx, impl, s2, s1, len); json_array_end (json_ctx); json_element_object_end (json_ctx); }
static void do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len, int max_char, int exp_result) { size_t i; CHAR *s1, *s2; if (len == 0) return; align1 &= 63; if (align1 + (len + 1) * CHARBYTES >= page_size) return; align2 &= 63; if (align2 + (len + 1) * CHARBYTES >= page_size) return; /* Put them close to the end of page. */ i = align1 + CHARBYTES * (len + 2); s1 = (CHAR *) (buf1 + ((page_size - i) / 16 * 16) + align1); i = align2 + CHARBYTES * (len + 2); s2 = (CHAR *) (buf2 + ((page_size - i) / 16 * 16) + align2); for (i = 0; i < len; i++) s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % max_char; s1[len] = s2[len] = 0; s1[len + 1] = 23; s2[len + 1] = 24 + exp_result; s2[len - 1] -= exp_result; json_element_object_begin (json_ctx); json_attr_uint (json_ctx, "length", (double) len); json_attr_uint (json_ctx, "align1", (double) align1); json_attr_uint (json_ctx, "align2", (double) align2); json_array_begin (json_ctx, "timings"); FOR_EACH_IMPL (impl, 0) do_one_test (json_ctx, impl, s1, s2, exp_result); json_array_end (json_ctx); json_element_object_end (json_ctx); }
static void do_test (json_ctx_t *json_ctx, size_t len) { json_element_object_begin (json_ctx); json_attr_uint (json_ctx, "length", (double) len); json_array_begin (json_ctx, "timings"); FOR_EACH_IMPL (impl, 0) do_one_test (json_ctx, impl, (char *) buf2, (char *) buf1, len); json_array_end (json_ctx); json_element_object_end (json_ctx); }