comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Efficient Bit Vector Manipulation.
Date: Fri, 15 May 2015 09:58:11 -0700
Date: 2015-05-15T09:58:11-07:00	[thread overview]
Message-ID: <mj58h1$fc7$1@dont-email.me> (raw)
In-Reply-To: <62605fe5-6ecf-4750-b13c-24bce65e3439@googlegroups.com>

On 05/15/2015 05:07 AM, Vincent wrote:
> 
> I need to extract in a very efficient way, information from the bit sequence
> that represents a 32 bits Positive number, named I > 0.

Given your need to extract sequences of bits as integers, I'd say using an
Unsigned_* type from Interfaces would probably be best. This also has the
advantage of being endian independent.

Finding the most-significant 1 bit can be done with a binary search. Shifting
and masking out the B and E values is then fairly simple.

-- 
Jeff Carter
"C++ is like jamming a helicopter inside a Miata
and expecting some sort of improvement."
Drew Olbrich
51


  parent reply	other threads:[~2015-05-15 16:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 12:07 Efficient Bit Vector Manipulation Vincent
2015-05-15 12:48 ` Colin Paul de Gloucester
2015-05-16 17:12   ` Dennis Lee Bieber
2015-05-15 16:26 ` Niklas Holsti
2015-05-16 11:58   ` vincent.diemunsch
2015-05-15 16:58 ` Jeffrey R. Carter [this message]
2015-05-16 12:06   ` vincent.diemunsch
2015-05-17 13:55 ` robin.vowels
2015-05-18  7:53 ` Stefan.Lucks
2015-05-18 11:43   ` vincent.diemunsch
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox