From 45f85cd29d341aa3323a1595a1074e0e410dc150 Mon Sep 17 00:00:00 2001 From: chad Date: Fri, 15 Feb 2013 03:58:08 +0000 Subject: [PATCH] Now the final word is 0 instead of 00ff if input is smaller than memsize. git-svn-id: http://www.cdkersey.com/harp/harptool@126 0246edb2-e076-4747-b392-db732a341fa2 --- util/bin2mif.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/bin2mif.cpp b/util/bin2mif.cpp index 7b67aacb..9884daf8 100644 --- a/util/bin2mif.cpp +++ b/util/bin2mif.cpp @@ -46,9 +46,10 @@ int main(int argc, char** argv) { out << setw(4) << setfill('0') << hex << j << " : "; for (unsigned i = 0; i < word; ++i) { - if (!in.eof()) bytes.push(in.get()); - else bytes.push(0); + bytes.push(in.get()); + if (in.eof()) { bytes.pop(); while(i++ < word) bytes.push(0); } } + for (unsigned i = 0; i < word; ++i) { out << hex << setw(2) << setfill('0') << unsigned(bytes.top()); bytes.pop();