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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8200c5d9633351c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!indigo.octanews.net!news-out.octanews.net!teal.octanews.net!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 30 Jun 2005 14:11:28 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1119966822.201891.303810@g49g2000cwa.googlegroups.com> <1119991404.697144.17980@g14g2000cwa.googlegroups.com> Subject: Re: How to byte swap an IEEE Float? Date: Thu, 30 Jun 2005 14:14:35 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 Message-ID: <18mdnTAI9YB93lnfRVn-3g@megapath.net> NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-wapg2qdHypmBzz4H/muZfjZqgQF+bOiEocQ9p1xduWEWXnPdv1x7oiL1zIOk+F8N2ToxLaWAuMnaQ6e!TRZKdtBM7T0P0Tk4+YXBGT4dturXA4LnAOk/XONS02GbTq4eNJITdiNwZtkKLGTIVte4FpT18l7P X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:11775 Date: 2005-06-30T14:14:35-05:00 List-Id: "Bj�rn" wrote in message news:1119991404.697144.17980@g14g2000cwa.googlegroups.com... ... > All the data in the file are of 32 bits float so that should be ok. > The target for the values is at the moment x86 (although I do expect it > to work on PowerPC as well so I check System.Default_Bit_Order before > doing any byte swapping). My dirty workaround for the moment was to > read the data as a string. I was merly wondering which is the > normal/"best" way to deal with this, since I expect it to be a > fairly common task. A packed byte array does however seem like a much > better idea than handling it as a string. I'd suggest using an array of stream elements for that (presuming that they're the right size, they would be on almost all machines). That's especially useful if you're reading the type as a stream in the first place, because it would let you skip a copy. If you absolutely have to have portability to any possible machine, then you'd need to use your own type. But such a machine (such as the 36 bit Unisys U2200) would probably have problems with 32-bit float values anyway. Randy.