Skip to content

Commit 1ffd1ba

Browse files
committed
Replaces integerlength(n) implementation with call to fls(n) and makes it static
1 parent 0a6f8ac commit 1ffd1ba

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

inc/gcfinaldefs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define GCFINALDEFS_H 1
33
#include "lispemul.h" /* for LispPTR, DLword */
44
void printarrayblock(LispPTR base);
5-
int integerlength(unsigned int n);
65
LispPTR findptrsbuffer(LispPTR ptr);
76
LispPTR releasingvmempage(LispPTR ptr);
87
LispPTR checkarrayblock(LispPTR base, LispPTR free, LispPTR onfreelist);

src/gcfinal.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
/*************************************************************************/
4444

4545
#include <stdio.h> // for printf
46+
#include <strings.h> // for fls
4647
#include "address.h" // for HILOC
4748
#include "adr68k.h" // for NativeAligned4FromLAddr, LAddrFromNative
4849
#include "array.h" // for arrayblock, ARRAYBLOCKTRAILERCELLS, MAXBUCK...
@@ -123,24 +124,10 @@ struct buf {
123124
#endif /* BIGVM */
124125
#endif /* BYTESWAP */
125126

126-
/************* The following procedure is common !! **************************/
127-
128-
int integerlength(unsigned int n) {
129-
int cnt;
130-
if (n <= 2)
131-
return (n);
132-
else {
133-
cnt = 1;
134-
do {
135-
cnt++;
136-
n = (n >> 1);
137-
} while (n != 1);
138-
return (cnt);
139-
}
127+
static int integerlength(unsigned int n) {
128+
return (fls(n));
140129
}
141130

142-
/************* The above procedure is common !! **************************/
143-
144131
/************************************************************************/
145132
/* */
146133
/* f i n d p t r s b u f f e r */

0 commit comments

Comments
 (0)