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,8c82f96c3f1dff70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-14 06:34:23 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsswitch.lcs.mit.edu!sunqbc.risq.qc.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!feed2.news.rcn.net!rcn!chnws02.mediaone.net!chnws06.ne.mediaone.net!24.128.8.70!typhoon.ne.mediaone.net.POSTED!not-for-mail From: "Jeff Creem" Newsgroups: comp.lang.ada References: <3BC8D083.E6503BC3@pacbell.net> Subject: Re: Working with Scaled Integers X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Message-ID: Date: Sun, 14 Oct 2001 13:33:22 GMT NNTP-Posting-Host: 24.61.92.65 X-Complaints-To: abuse@mediaone.net X-Trace: typhoon.ne.mediaone.net 1003066402 24.61.92.65 (Sun, 14 Oct 2001 09:33:22 EDT) NNTP-Posting-Date: Sun, 14 Oct 2001 09:33:22 EDT Organization: Road Runner Xref: archiver1.google.com comp.lang.ada:14479 Date: 2001-10-14T13:33:22+00:00 List-Id: This is a bit heavy but I have always done this sort of thing (1553 scaled integers) by making the type that is part of the 1553 message a private type and then having fixed point (or other appropriate type) visible in the spec with conversions defined between the private and the non-private type. I've done this for several (some of them probably bad) reasons including: 1) Compilers are not required to support fixed point types with 'smalls of anything other than an inverse power of two. By making my actual message type private and then declaring a fixed point type that has the same valid range but better a finer 'small I can basically work around this (in most cases) 2) The only compiler I've seen so far that does biased fixed point types is GNAT. I like it but I've never been able to use a compiler that supports it (e.g. type M_Type is range delta 0.5 range 1.0 .. 1.5; for M_Type'small use 0.5; for M_Type'size use 1; ) -- Note, I did not just try to compile the above...Probably full of errors. There are times when you get a message spec that requires types the above so the private/public approach can be used to have the public type not have a 1 bit size and yet still enforce range checks. 3) Occasional bugs in fixed point types in some (now) very old Ada 83 compilers). Now, you mention that your specs are machine generated so I am not clear what we have to work with and what LSBs you are trying to set. Perhaps you can post a few line snippet and we can help. "Andrew" wrote in message news:tshodl6t9u8ga3@corp.supernews.com... > We are tied to using existing types because our package specs are generated > by tools. > > -------------------------------------------------------------- > Andrew > > > > "R. Tim Coslet" wrote in message > news:3BC8D083.E6503BC3@pacbell.net... > > Instead of "scaled integers" look at Ada's Fixed Point real types. > > > > For "BCD" types use Ada's Decimal types. > > > > Andrew wrote: > > > > > Developing/maintaining Ada code that processes 1553 bus data. I have a > basic > > > understanding of working with scaled integers. But I'd like to learn > more. > > > Specifically, working with semi-circles, how to specify data resolution > > > (LSB), BCD etc. My understanding in this area is somewhat weak and I > need > > > to correct it. > > > > > > thanks; > > > > > > -------------------------------------------------------------- > > > Andrew > > >