From 12b1040aaa839bb671030622740fa3ff43a2badb Mon Sep 17 00:00:00 2001 From: dimxy Date: Mon, 6 May 2019 15:21:21 +0500 Subject: [PATCH] changed total price index calc to big num --- src/cc/prices.cpp | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index cefc8c4e0..b1947a9b5 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -850,9 +850,13 @@ int64_t prices_syntheticprice(std::vector vec, int32_t height, int32_t { int32_t i, value, errcode, depth, retval = -1; uint16_t opcode; - int64_t *pricedata, pricestack[4], price, den, a, b, c; + int64_t *pricedata, pricestack[4], a, b, c; - mpz_t mpzA, mpzB, mpzC, mpzResult; + mpz_t mpzTotalPrice, mpzPriceValue, mpzDen, mpzA, mpzB, mpzC, mpzResult; + + mpz_init(mpzTotalPrice); + mpz_init(mpzPriceValue); + mpz_init(mpzDen); mpz_init(mpzA); mpz_init(mpzB); @@ -860,7 +864,7 @@ int64_t prices_syntheticprice(std::vector vec, int32_t height, int32_t mpz_init(mpzResult); pricedata = (int64_t *)calloc(sizeof(*pricedata) * 3, 1 + PRICES_DAYWINDOW * 2 + PRICES_SMOOTHWIDTH); - price = den = depth = errcode = 0; + depth = errcode = 0; for (i = 0; i < vec.size(); i++) { @@ -869,7 +873,7 @@ int64_t prices_syntheticprice(std::vector vec, int32_t height, int32_t mpz_set_ui(mpzResult, 0); // clear result to test overflow (see below) - std::cerr << "prices_syntheticprice" << " i=" << i << " price=" << price << " value=" << value << " depth=" << depth << " opcode&KOMODO_PRICEMASK=" << (opcode & KOMODO_PRICEMASK) <