From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e0423f8984d47f76 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-08 20:21:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.stueberl.de!newspeer1-gui.server.ntli.net!ntli.net!newsfep4-glfd.server.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Problems converting Float to Integer efficiently References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Thu, 09 Oct 2003 04:21:14 +0100 NNTP-Posting-Host: 81.100.88.147 X-Complaints-To: abuse@ntlworld.com X-Trace: newsfep4-glfd.server.ntli.net 1065669674 81.100.88.147 (Thu, 09 Oct 2003 04:21:14 BST) NNTP-Posting-Date: Thu, 09 Oct 2003 04:21:14 BST Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:513 Date: 2003-10-09T04:21:14+01:00 List-Id: Jeff C, wrote: ... > begin > Asm ("cvttss2si %1, %0",inputs => float'asm_input("m", y), > Outputs => integer'asm_output("=r",temp)); > return temp; > end truncate; ... This looks like the kind of thing I was wanting the compiler to produce. I'm not a whizz at Intel Assember (nor package Machine_Code), so it might have taken a long time to for me to figure out exactly what I needed. It's a bit disappointing that the compiler does not produce code like this for some "obvious" source code. I dislike Ada's default of rounding to nearest, and it seems that a series of Float=>Integer attributes might help the compiler. I have Athlons and GNAT 3.15, so I may have to experiment with this approach. But it is now past my bedtime... Thanks for a speedy response on this problem! -- Adrian Wrigley, Cambridge, England.