From 52fbbbcb6b906a6acd00ece3dfeed0a480d28751 Mon Sep 17 00:00:00 2001 From: Jennifer Liu Date: Fri, 29 Jun 2018 16:17:20 -0700 Subject: [PATCH] Explicitly cast double to unsigned --- lib/dictBuilder/cover.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dictBuilder/cover.c b/lib/dictBuilder/cover.c index 997036ec..53f3d79a 100644 --- a/lib/dictBuilder/cover.c +++ b/lib/dictBuilder/cover.c @@ -543,7 +543,8 @@ static int COVER_ctx_init(COVER_ctx_t *ctx, const void *samplesBuffer, const unsigned first = 0; const size_t totalSamplesSize = COVER_sum(samplesSizes, first, nbSamples); /* Split samples into testing and training sets */ - const unsigned nbTrainSamples = nbSamples * splitPoint; + double tmp = (double)nbSamples * splitPoint; + const unsigned nbTrainSamples = (unsigned)tmp; const unsigned nbTestSamples = nbSamples - nbTrainSamples; const size_t trainingSamplesSize = COVER_sum(samplesSizes, first, nbTrainSamples); const size_t testSamplesSize = COVER_sum(samplesSizes, nbTrainSamples, nbSamples);