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!news2.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!news.highwinds-media.com!newspeer1-win.ntli.net!newsfe6-win.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: generic function and overloading User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) Message-Id: Newsgroups: comp.lang.ada References: <1192688972.967825.31130@t8g2000prg.googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Thu, 18 Oct 2007 18:58:06 GMT NNTP-Posting-Host: 82.21.99.109 X-Complaints-To: http://netreport.virginmedia.com X-Trace: newsfe6-win.ntli.net 1192733886 82.21.99.109 (Thu, 18 Oct 2007 19:58:06 BST) NNTP-Posting-Date: Thu, 18 Oct 2007 19:58:06 BST Organization: NTL Xref: g2news2.google.com comp.lang.ada:2485 Date: 2007-10-18T18:58:06+00:00 List-Id: 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. But overall its very rare that you need to write the code you're asking for! -- Adrian