Re: [CHALLENGE] finding rightmost zero bit
- From: Brooks Moses <bmoses-nospam@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 29 Aug 2005 14:03:42 -0700
Brooks Moses wrote:
if (.not. btest(n, 0))
pos = 0
elseif (.not. btest(n, 1))
pos = 1
elseif (.not. btest(n, 2))
pos = 2
elseif (.not. btest(n, 3))
pos = 3
elseif (.not. btest(n, 4))
pos = 4
elseif (.not. btest(n, 5))
pos = 5
elseif (.not. btest(n, 6))
pos = 6
elseif (.not. btest(n, 7))
pos = 7
Correction: I'd misread the original program; all of the pos= values in this block need to be incremented by one. Note that, in this version -- unlike the original bart1 -- the incrementing can be done at programming time rather than at runtime, thereby illustrating some of the utility of loop-unrolling. :)
- Brooks
-- The "bmoses-nospam" address is valid; no unmunging needed. .
- References:
- [CHALLENGE] finding rightmost zero bit
- From: Bart Vandewoestyne
- Re: [CHALLENGE] finding rightmost zero bit
- From: Michel OLAGNON
- Re: [CHALLENGE] finding rightmost zero bit
- From: Brooks Moses
- [CHALLENGE] finding rightmost zero bit
- Prev by Date: Re: [CHALLENGE] finding rightmost zero bit
- Next by Date: Re: NLEQ1 and open source Fortran
- Previous by thread: Re: [CHALLENGE] finding rightmost zero bit
- Next by thread: Re: [CHALLENGE] finding rightmost zero bit
- Index(es):
Relevant Pages
|
|