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-Thread: 103376,1514d4f994aed7aa X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!t8g2000prg.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: generic function and overloading Date: Thu, 18 Oct 2007 15:30:41 -0700 Organization: http://groups.google.com Message-ID: <1192746641.719517.25740@t8g2000prg.googlegroups.com> References: <1192688972.967825.31130@t8g2000prg.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1192746642 5018 127.0.0.1 (18 Oct 2007 22:30:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 18 Oct 2007 22:30:42 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: t8g2000prg.googlegroups.com; posting-host=66.126.103.122; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:2488 Date: 2007-10-18T15:30:41-07:00 List-Id: On Oct 18, 11:58 am, "Dr. Adrian Wrigley" wrote: > On Thu, 18 Oct 2007 00:28:38 -0700, eliben wrote: > > Hello, > > > I have a few "hardware" types, for example uint16 and uint32. And I > > want to write a functions that will set or clear bits of such types. > > For example: > > > function Bit_Set(word: uint16; bitn: natural) return uint16; > > > function Bit_Set(word: uint16; bitn: natural) return uint16 is > > mask: uint16 := 2**bitn; > > begin > > return word or mask; > > end Bit_Set; > > Have you checked that packed arrays of booleans aren't > suitable? usually you need type like this for interfacing > with other languages (eg C) - but then you use the types > in the appropriate Interfaces packages. And you might > use such a type when writing directly to a hardware > register on a particular peripheral or bus. Maybe that's the reason the original poster referred to them as "hardware" types????? -- Adam