From: SourceForge.net <no...@so...> - 2003-06-29 08:10:17
|
Bugs item #762602, was opened at 2003-06-29 01:10 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=762602&group_id=599 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: General cast bug Initial Comment: When the following code is compiled with memory model large and stack auto, it creates a lot of register variables. However, one casting produces the following code: ; genCast mov ar3, r2 mov ar4, r3 <---This should have been done first. Using the peep-hole optimizer, I was able to fix it; I put in six entries to reverse the order of the move if the compiler did it in the wrong order and that fixed the code. ro...@hi... Errant function: #define uint unsigned int #define uchar unsigned char #define ulong unsigned long ulong msTimer, SecTimer; bit UpdateTimersInitialized; #include "C:...\F310.h" // sfr definitions void UpdateTimers() { static xdata uint LastTimeValue, msTimer2; auto uchar a,b,c; auto uint TimeValue; auto uint Increment; // Used in case values are converted to long before subtraction static xdata ulong MSTotalizer, SecTotalizer; if (!UpdateTimersInitialized) { UpdateTimersInitialized=1; MSTotalizer=0; SecTotalizer=0; LastTimeValue=0; msTimer2=0; } do { b=TH0; a=TL0; c=TH0; } while (b!=c); TimeValue=((uint) b<<8)+a; // TimeValue=LastTimeValue+3; Increment=TimeValue-LastTimeValue; // <---Line that gives the error MSTotalizer=Increment+MSTotalizer; LastTimeValue=TimeValue; while (MSTotalizer> 58) { // Handle milliseconds msTimer2=msTimer2+133; // Fudge factor giving slightly slower clock because 117 doesn't come out even. MSTotalizer-=58; if (msTimer2>256) { ++msTimer; ++SecTotalizer; msTimer2-=256; } } while (SecTotalizer>1000) { ++SecTimer; SecTotalizer-=1000; } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=762602&group_id=599 |