Re: Re: [Linux-decnet-user] librms + vax floating point
Brought to you by:
chrissie_c,
ph3-der-loewe
|
From: <ada...@br...> - 2005-08-11 07:12:37
|
wow, thanks larry
in the meantime, i found the following function in the gcc sources (thats
not something i ever thought i'd say), i have no idea if it works and it
looks like i will have to hack it around and havnt tried ti yet....it looks
a bit crazy so it might just work, but i'll wait to se what you have....i'd
definitely say it would be a useful part of librms.
:o)
cheers
Adam
static void
decode_vax_f (const struct real_format *fmt ATTRIBUTE_UNUSED,
REAL_VALUE_TYPE *r, const long *buf)
{
unsigned long image = buf[0] & 0xffffffff;
int exp = (image >> 7) & 0xff;
memset (r, 0, sizeof (*r));
if (exp != 0)
{
r->cl = rvc_normal;
r->sign = (image >> 15) & 1;
SET_REAL_EXP (r, exp - 128);
image = ((image & 0x7f) << 16) | ((image >> 16) & 0xffff);
r->sig[SIGSZ-1] = (image << (HOST_BITS_PER_LONG - 24)) | SIG_MSB;
}
}
Larry Baker <lar...@st...> on 11/08/2005 08:01:59
To: Adam R Pigg/Spent Fuel/Sellafield/BNFL@BNFL
cc: Baker Larry <ba...@us...>
Fax to:
Subject: Re: [Linux-decnet-user] librms + vax floating point
Adam,
I have a C library to read/write all VAX data formats. I'll send it
to you when I get to work tomorrow. If you recommend, I'll send it
to be a part of the linux-decnet distribution.
On Aug 10, 2005, at 6:39 AM, ada...@br... wrote:
>
> Hi
>
> im successfully using librms to open and read a binary file on a vax
> system.
>
> using '#pragma pack (1)' i was able to get my struct to be the same
> size as
> the record length of the file, and can read most of the data
> successfully,
> including strings and ints. But floats are a problem, they are totally
> wrong. I figure vax maybe stores floats in a different format from
> my i386
> pc, and have found various references to things like
>
> vax 'D-Float' format
> and
> TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT (but i think that is for cros
> compiling).
>
> Does anyone know how to manipuilate/read floats from a vax binary
> file?
>
> Cheers
>
> Adam
>
>
>
> The information contained in this email may be commercially
> sensitive and/or legally privileged. It is intended solely for the
> person(s) to whom it is addressed. If you are not a named
> recipient, you are on notice of its status. Please notify the
> sender immediately by reply e-mail and then delete this message
> from your system. You must not disclose it to any other person,
> copy or distribute it or use it for any purpose.
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams *
> Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/
> bsce5sf
> _______________________________________________
> Linux-decnet-user mailing list
> Lin...@li...
> https://lists.sourceforge.net/lists/listinfo/linux-decnet-user
>
>
Larry Baker
US Geological Survey
650-329-5608
ba...@us...
Larry Baker
lar...@st...
<Attachment C.htm has been removed from this reply>
The information contained in this email may be commercially sensitive and/or legally privileged. It is intended solely for the person(s) to whom it is addressed. If you are not a named recipient, you are on notice of its status. Please notify the sender immediately by reply e-mail and then delete this message from your system. You must not disclose it to any other person, copy or distribute it or use it for any purpose.
|