Don't convert uint64_t to double Older MSVC versions don't support conversion from uint64_t to double.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/35fa7f17 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/35fa7f17 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/35fa7f17 Branch: refs/heads/msvc6 Commit: 35fa7f179e1bd5b3a2222b529ad84cb980a892dc Parents: c9e057c Author: Nick Wellnhofer <[email protected]> Authored: Sun Nov 4 17:09:50 2012 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Sun Nov 4 17:20:39 2012 +0100 ---------------------------------------------------------------------- core/Lucy/Test/Search/TestSortSpec.c | 8 ++++---- core/Lucy/Test/TestUtils.c | 4 ++-- core/Lucy/Test/Util/TestMemory.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/35fa7f17/core/Lucy/Test/Search/TestSortSpec.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c index 2d0fe28..99703fa 100644 --- a/core/Lucy/Test/Search/TestSortSpec.c +++ b/core/Lucy/Test/Search/TestSortSpec.c @@ -287,14 +287,14 @@ S_random_int64() { static Obj* S_random_float32() { - uint64_t num = TestUtils_random_u64(); - return (Obj*)Float32_new((double)num * (10.0 / U64_MAX)); + int64_t num = (int64_t)TestUtils_random_u64(); + return (Obj*)Float32_new((double)num * (10.0 / I64_MAX)); } static Obj* S_random_float64() { - uint64_t num = TestUtils_random_u64(); - return (Obj*)Float64_new((double)num * (10.0 / U64_MAX)); + int64_t num = (int64_t)TestUtils_random_u64(); + return (Obj*)Float64_new((double)num * (10.0 / I64_MAX)); } static VArray* http://git-wip-us.apache.org/repos/asf/lucy/blob/35fa7f17/core/Lucy/Test/TestUtils.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c index 1c467cc..1df0c4c 100644 --- a/core/Lucy/Test/TestUtils.c +++ b/core/Lucy/Test/TestUtils.c @@ -71,8 +71,8 @@ double* TestUtils_random_f64s(double *buf, size_t count) { double *f64s = buf ? buf : (double*)CALLOCATE(count, sizeof(double)); for (size_t i = 0; i < count; i++) { - uint64_t num = TestUtils_random_u64(); - f64s[i] = (double)num / U64_MAX; + int64_t num = (int64_t)TestUtils_random_u64(); + f64s[i] = (double)num / I64_MAX; } return f64s; } http://git-wip-us.apache.org/repos/asf/lucy/blob/35fa7f17/core/Lucy/Test/Util/TestMemory.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Util/TestMemory.c b/core/Lucy/Test/Util/TestMemory.c index 6aa0b0a..2707cd3 100644 --- a/core/Lucy/Test/Util/TestMemory.c +++ b/core/Lucy/Test/Util/TestMemory.c @@ -27,13 +27,13 @@ static void test_oversize__growth_rate(TestBatch *batch) { - bool_t success = true; - uint64_t size = 0; - double growth_count = 0; - double average_growth_rate = 0.0; + bool_t success = true; + int64_t size = 0; + double growth_count = 0; + double average_growth_rate = 0.0; while (size < SIZE_MAX) { - uint64_t next_size = Memory_oversize((size_t)size + 1, sizeof(void*)); + int64_t next_size = Memory_oversize((size_t)size + 1, sizeof(void*)); if (next_size < size) { success = false; FAIL(batch, "Asked for %" I64P ", got smaller amount %" I64P,
