Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers LCC > ffs function
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 10 Topic 1013 of 1062
Post > Topic >>

ffs function

by jacob navia <jacob@[EMAIL PROTECTED] > Jan 7, 2008 at 12:47 AM

The Find First Set function (ffs) finds the lowest bit set in an
integer.

I wanted to add this to the library in lcc-win but before doing it I
would like your opinion as to *where* should I declare them?

First, this function is POSIX and the include file is called

"strings.h"

I do not know why. There you will find bzero() and other functions
that have absolutely nothing to do with any strings. The only
string functions there are strcasecmp (that is equivalent to
stricmp in lcc-win) and strncasecmp (equivalent to strnicmp).

Question:

Should I add a "utils.h" header?
Or follow POSIX?

I have a founction for counting bits in an integer and I
have added it in bitstring.h but that is a header concerned
with the bit string implementation... Not really the subject
of those functions.

Since I am revising this, I added the function

fls (Find Last Set) that will find the higher order
bit in an integer. Strange, this function is NOT in POSIX. Maybe
anyone here knows why?

Below is the do***entation for both functions
--------------------------------------------------------------------
Function: _ffs _fls

Synopsis

#include <utils.h>                           // ???????????????????
int _stdcall _ffs(int n);
int _stdcall _fls(int n);

Description
The fsf() function returns the index of the first bit different from 
zero in the given integer argument. The first bit (the least 
significant) is numbered 1.

The fls() function returns the index of the first most significant bit 
set.. Bit indexes start at 1.

Returns
The value of the  index or zero if and only if all bits are zero


;

-- 
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 




 10 Posts in Topic:
ffs function
jacob navia <jacob@[EM  2008-01-07 00:47:11 
Re: ffs function
Cesar Rabak <csrabak@[  2008-01-06 22:41:57 
Re: ffs function
Chris Torek <nospam@[E  2008-01-07 00:55:38 
Re: ffs function
jacob navia <jacob@[EM  2008-01-07 08:46:00 
Re: ffs function
Randy Howard <randyhow  2008-01-07 00:58:30 
Re: ffs function
Thad Smith <ThadSmith@  2008-01-06 20:37:31 
Re: ffs function
Keith Thompson <kst-u@  2008-01-06 19:59:55 
Re: ffs function
jacob navia <jacob@[EM  2008-01-07 08:40:15 
Re: ffs function
"Antoine Leca"   2008-01-08 17:50:28 
Re: ffs function
CBFalconer <cbfalconer  2008-01-07 03:00:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 14:23:47 CDT 2008.