High Order Bit 
Author Message
 High Order Bit

This is only marginally topical, but it seems I remember discussions in CLC
(a year ago or more) about determining the high-order ("most
significant")
bit of an integer; Kaz had some really {*filter*} code samples.  My news service
archive stinketh; I've been frustrated in my efforts to resurrect the
discussion.  Does anyone have suggestions?  Be gentle; I know Richard
Heathfield.  (Well, at least I feel like I know him.)

Bob

 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://www.*-*-*.com/ ,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts



Wed, 10 Sep 2003 02:26:34 GMT  
 High Order Bit

Quote:

> This is only marginally topical, but it seems I remember discussions in CLC
> (a year ago or more) about determining the high-order ("most
> significant")
> bit of an integer; Kaz had some really {*filter*} code samples.  My news service
> archive stinketh; I've been frustrated in my efforts to resurrect the
> discussion.  Does anyone have suggestions?  Be gentle; I know Richard
> Heathfield.  (Well, at least I feel like I know him.)

Here are some routines to find the high order bit:
ftp://cap.connx.com/pub/bitcount/LOG2.C

Maybe there are some better ways, but these are fun to play with anyway.
--
C-FAQ: http://www.*-*-*.com/ ~scs/C-faq/top.html
 "The C-FAQ Book" ISBN 0-201-84519-9
C.A.P. FAQ: ftp://cap.connx.com/pub/Chess%20Analysis%20Project%20FAQ.htm



Wed, 10 Sep 2003 03:15:53 GMT  
 High Order Bit

Quote:

> This is only marginally topical, but it seems I remember discussions in CLC
> (a year ago or more) about determining the high-order ("most
> significant")
> bit of an integer; Kaz had some really {*filter*} code samples.

That seems easy enough.

int highest_bit_of_int_is_set(int i)
{
  return i < 0;

Quote:
}

:-)

Quote:
> I know Richard Heathfield.  (Well, at least I feel like I know him.)

I know what you mean. YKYBHTL when you've never met half your best
friends.

--
Richard Heathfield
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.*-*-*.com/ ~scs/C-faq/top.html
K&R answers, C books, etc: http://www.*-*-*.com/



Wed, 10 Sep 2003 04:17:36 GMT  
 High Order Bit

Quote:


> > This is only marginally topical, but it seems I remember discussions in CLC
> > (a year ago or more) about determining the high-order ("most
> > significant")
> > bit of an integer; Kaz had some really {*filter*} code samples.

> That seems easy enough.

> int highest_bit_of_int_is_set(int i)
> {
>   return i < 0;
> }

> :-)

Well Richard,

tell me, wasn't he rather asking for the number of the bit
starting from the least significant bit, that has only zero
bits following up to the most significant bit of say an int?
I'm asking just to clearify my understanding of msb-calculation.

--

"LISP  is worth learning for  the profound enlightenment  experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days."   -- Eric S. Raymond



Fri, 12 Sep 2003 06:21:12 GMT  
 High Order Bit

Quote:



> > > This is only marginally topical, but it seems I remember discussions in CLC
> > > (a year ago or more) about determining the high-order ("most
> > > significant")
> > > bit of an integer; Kaz had some really {*filter*} code samples.

> > That seems easy enough.

> > int highest_bit_of_int_is_set(int i)
> > {
> >   return i < 0;
> > }

> > :-)

> Well Richard,

> tell me, wasn't he rather asking for the number of the bit
> starting from the least significant bit, that has only zero
> bits following up to the most significant bit of say an int?

If he was, it was not apparent from his question, which asked about
determining the high-order ("most significant") bit of an integer.

--
Richard Heathfield
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.*-*-*.com/ ~scs/C-faq/top.html
K&R answers, C books, etc: http://www.*-*-*.com/



Fri, 12 Sep 2003 15:55:27 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Newbie Question about high-order bit

2. High-order bit etc

3. Q: how to check the high order bit?

4. High order/low order problem

5. Writting low-order or high-order bytes

6. byte order and bit order

7. Separate low and high order ints

8. ** Getting the High Order Byte **

9. Warning: CFile::GetStatus() returns m_attribute without high-order flags

10. High-order word...

11. Higher Order Functions?

12. CFile::GetStatus returns without high order flags

 

 
Powered by phpBB® Forum Software