From: Borut R. <bor...@si...> - 2007-05-08 16:37:11
|
Maarten Brock wrote: > Borut, > > I think you forgot the minus: > > (u8)((2*11059200) / (u16)(32*12*19200)) = > (u8)(22118400 / 32768) = (u8)675 = 163 > > Anyway, it uses 16 bit arithmatic for computing 32*12*19200. > > But without the L the test will have different outcomes on different > architectures. The host will fail the test because an int is at least > 32 bit there. > Maarten and Erik, thank you to help me in arithmetics. I used the same logic as Erik, but somehow couldn't get the same result :-[ The assert for the version without L could be #ifdef-ed depending of the architecture: ASSERT(T1==0xfd); for 16 bit int architecture and ASSERT(T1==0xa3); for 32 bit int architectures. Borut > Maarten > > > Maarten Brock wrote: > > >> Just as an additional info: I tried it with 16 bit watcom compiler > and I > > >> got the expected result 263 (0xfd) with 19200L. > > > > > > Sure, but what does it give without the L? Is it still > > > 0xFD? > > > > Yes, my report was incomplete: without L the result is 163. > > > > If we can trust the watcom C, the longlit.c regtest test is wrong: there > > should be a L after 19200. > > > > Maybe we could add an other test without the L and change the assertion > > value. The problem here is that I don't know how the watcom C calculated > > 163... > > > > Borut > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ------------------------------------------------------------------------ > > _______________________________________________ > sdcc-devel mailing list > sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-devel > |