{
int size, offset = 0;
bool pushResult = FALSE;
+ int rSize;
D(emitcode(";", "genPlus "););
aopOp (IC_RESULT(ic),ic,TRUE, FALSE);
size = getDataSize(IC_LEFT(ic));
-
+ rSize = getDataSize(IC_RESULT(ic));
+
/* If the pushed data is bigger than the result,
* simply discard unused bytes. Icky, but works.
*
* Should we throw a warning here? We're losing data...
*/
- while (size > getDataSize(IC_RESULT(ic)))
+ while (size > rSize)
{
- emitcode(";", "discarding unused result byte.");
+ D(emitcode(";", "discarding unused result byte."););
emitcode("pop", "acc");
size--;
offset--;
}
+ if (size < rSize)
+ {
+ emitcode("clr", "a");
+ /* Conversly, we haven't pushed enough here.
+ * just zero-pad, and all is well.
+ */
+ while (size < rSize)
+ {
+ emitcode("push", "acc");
+ size++;
+ offset++;
+ }
+ }
while(size--)
{
static void genMinus (iCode *ic)
{
int size, offset = 0;
+ int rSize;
unsigned long lit = 0L;
bool pushResult = FALSE;
aopOp (IC_RESULT(ic),ic,TRUE, FALSE);
size = getDataSize(IC_LEFT(ic));
+ rSize = getDataSize(IC_RESULT(ic));
/* If the pushed data is bigger than the result,
* simply discard unused bytes. Icky, but works.
size--;
offset--;
}
+ if (size < rSize)
+ {
+ emitcode("clr", "a");
+ /* Conversly, we haven't pushed enough here.
+ * just zero-pad, and all is well.
+ */
+ while (size < rSize)
+ {
+ emitcode("push", "acc");
+ size++;
+ offset++;
+ }
+ }
while(size--)
{