summaryrefslogtreecommitdiff
path: root/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-21 15:55:03 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-21 15:55:03 -0400
commit000bfe1cece3ecbfee8f07a46d1f0b000dbbc983 (patch)
tree6d2c666097900fff421da6a57b41f0a7c43a39b7 /amount.cc
parent225acd14e57a0a476ce022a7c5703a8f1cee34ef (diff)
downloadfork-ledger-000bfe1cece3ecbfee8f07a46d1f0b000dbbc983.tar.gz
fork-ledger-000bfe1cece3ecbfee8f07a46d1f0b000dbbc983.tar.bz2
fork-ledger-000bfe1cece3ecbfee8f07a46d1f0b000dbbc983.zip
only compute the cost when it differs from the amount
Diffstat (limited to 'amount.cc')
-rw-r--r--amount.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/amount.cc b/amount.cc
index 43a36322..f1ab9c6c 100644
--- a/amount.cc
+++ b/amount.cc
@@ -890,8 +890,8 @@ void amount_t::write_quantity(std::ostream& out) const
out.write(&byte, sizeof(byte));
std::size_t size;
- mpz_export(buf, &size, 1, sizeof(int), 0, 0, MPZ(quantity));
- unsigned short len = size * sizeof(int);
+ mpz_export(buf, &size, 1, sizeof(short), 0, 0, MPZ(quantity));
+ unsigned short len = size * sizeof(short);
out.write((char *)&len, sizeof(len));
if (len) {
@@ -930,7 +930,7 @@ void amount_t::read_quantity(std::istream& in)
unsigned short len;
in.read((char *)&len, sizeof(len));
in.read(buf, len);
- mpz_import(MPZ(quantity), len / sizeof(int), 1, sizeof(int), 0, 0, buf);
+ mpz_import(MPZ(quantity), len / sizeof(short), 1, sizeof(short), 0, 0, buf);
char negative;
in.read(&negative, sizeof(negative));