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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7e15102eb14c0020 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.78.170 with SMTP id c10mr3050270pax.22.1349030218803; Sun, 30 Sep 2012 11:36:58 -0700 (PDT) Received: by 10.68.244.73 with SMTP id xe9mr3513159pbc.10.1349030218786; Sun, 30 Sep 2012 11:36:58 -0700 (PDT) Path: g9ni8152pbh.1!nntp.google.com!kq19no5806045pbb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 30 Sep 2012 11:36:58 -0700 (PDT) In-Reply-To: <38594cbf-b52d-4002-8db9-410f55126a09@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: <50673111$0$9505$9b4e6d93@newsspool1.arcor-online.net> <38594cbf-b52d-4002-8db9-410f55126a09@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3710c656-615f-42d3-9ac5-01a75e02647f@googlegroups.com> Subject: Re: highest bit, statically determined From: Shark8 Injection-Date: Sun, 30 Sep 2012 18:36:58 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-09-30T11:36:58-07:00 List-Id: On Sunday, September 30, 2012 9:39:41 AM UTC-6, Anatoly Chernyshev wrote: > > with ada.numerics.elementary_functions; > use ada.numerics.elementary_functions; > Highest_Bit_In_Octet:=natural(float'truncation(log(float(N),2.0))); > > I didn't check it for speed though. Pros that it doesn't depend on the size. Nice! Sometimes we get a little too caught-up in the problem-minutia we forget what the problem's really about. -- That, and some of these attributes aren't used enough to put them in the forefront of your mind when you hit a problem that can use them nicely.