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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Creating several types from a base type and conversion Date: Sat, 18 Jan 2020 19:32:47 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <4b0649b3-aed2-44fd-822f-d6665b9352dd@googlegroups.com> <0001HW.23D35416021671CF70000511B2EF@news.individual.net> <0001HW.23D383F80221AAB870000511B2EF@news.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 18 Jan 2020 18:32:48 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="9b70512078c977b5438be1f9a698e867"; logging-data="5229"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18BR7zHVBqzFyFwRzAnZWg4TIuFTkAKm1w=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 Cancel-Lock: sha1:ZqpLR5BQ3QvGKc0RzXsL0a8YxvQ= In-Reply-To: <0001HW.23D383F80221AAB870000511B2EF@news.individual.net> Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:57879 Date: 2020-01-18T19:32:47+01:00 List-Id: On 1/18/20 7:20 PM, Bill Findlay wrote: > > Or, using GNAT, e.g.: > > type word is mod 2**30; > > subtype word_shift_length is Natural range 0..30; > > function shift_word_left (W : word; amount : word_shift_length) > return KDF9.word; > > function shift_word_right (W : word; amount : word_shift_length) > return KDF9.word; > > function rotate_word_left (W : word; amount : word_shift_length) > return KDF9.word; > > function rotate_word_right (W : word; amount : word_shift_length) > return KDF9.word; > > All done. I don't know what KDF9.Word is, but surely you have to implement these. Or are you saying GNAT magically implements them? -- Jeff Carter "He didn't get that nose from playing ping-pong." Never Give a Sucker an Even Break 110