<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Problem with CodeWarrior/Eclipce version 11.0 doing long multiplications. in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849589#M14918</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a problem doing a simple long multiplication.&lt;/P&gt;&lt;P&gt;lValue = (long)(1000 * 3850); Return in lValue 0xFFFFBF10. Wrong should be 0x003ABF10.&lt;/P&gt;&lt;P&gt;lValue = 3850000; Return correct lValue 0x003ABF10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this a serious compiler error? Or what do I do wrong?&lt;/P&gt;&lt;P&gt;Attached is a little project named Long_Mul and 2 pdf files that show the source code made as Tiny and Minimal Startup code. MCU used is a MC9SO8QD4 with 4K flash and 255 bytes RAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely Yours&lt;/P&gt;&lt;P&gt;Per Højfeldt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Oct 2018 21:34:37 GMT</pubDate>
    <dc:creator>perhojfeldt</dc:creator>
    <dc:date>2018-10-29T21:34:37Z</dc:date>
    <item>
      <title>Problem with CodeWarrior/Eclipce version 11.0 doing long multiplications.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849589#M14918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a problem doing a simple long multiplication.&lt;/P&gt;&lt;P&gt;lValue = (long)(1000 * 3850); Return in lValue 0xFFFFBF10. Wrong should be 0x003ABF10.&lt;/P&gt;&lt;P&gt;lValue = 3850000; Return correct lValue 0x003ABF10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this a serious compiler error? Or what do I do wrong?&lt;/P&gt;&lt;P&gt;Attached is a little project named Long_Mul and 2 pdf files that show the source code made as Tiny and Minimal Startup code. MCU used is a MC9SO8QD4 with 4K flash and 255 bytes RAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely Yours&lt;/P&gt;&lt;P&gt;Per Højfeldt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2018 21:34:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849589#M14918</guid>
      <dc:creator>perhojfeldt</dc:creator>
      <dc:date>2018-10-29T21:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CodeWarrior/Eclipce version 11.0 doing long multiplications.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849590#M14919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Forgot to say that on the multiplication the compiler gives a warning. See attached pdf files in folder Long_Mul.zip&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2018 21:39:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849590#M14919</guid>
      <dc:creator>perhojfeldt</dc:creator>
      <dc:date>2018-10-29T21:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CodeWarrior/Eclipce version 11.0 doing long multiplications.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849591#M14920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Per,&lt;/P&gt;&lt;P&gt;The compiler is doing everything fine and to the standard: keep in mind that on the HCS08 an integer is 16bits.&lt;/P&gt;&lt;P&gt;Your multiplication (1000*3850) is performed with int, so gives 0xBF10. This is signed and gets sign extended with your cast to 32bit, so it gives 0xFFFFBF10.&lt;/P&gt;&lt;P&gt;If you want to do this multiplication on 32bit, you have have to use for example (1000L*3850).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 06:40:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849591#M14920</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2018-10-30T06:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CodeWarrior/Eclipce version 11.0 doing long multiplications.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849592#M14921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Erich.&lt;/P&gt;&lt;P&gt;Forgot that. Going from 32 bit MCU to 8 bit MCU can be tough. Haha.&lt;/P&gt;&lt;P&gt;Thanks for reminding me.&lt;/P&gt;&lt;P&gt;Per.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 16:33:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-CodeWarrior-Eclipce-version-11-0-doing-long/m-p/849592#M14921</guid>
      <dc:creator>perhojfeldt</dc:creator>
      <dc:date>2018-10-30T16:33:55Z</dc:date>
    </item>
  </channel>
</rss>

