Move the "- 1" into the RQB_FFS(mask) macro itself so that

implementations can provide a base zero ffs function if they wish.
This changes
  #define RQB_FFS(mask) (ffs64(mask))
  foo = RQB_FFS(mask) - 1;
to
  #define RQB_FFS(mask) (ffs64(mask) - 1)
  foo = RQB_FFS(mask);
On some platforms we can get the "- 1" for free, eg: those that use the
C code for ffs64().

Reviewed by:	jake (in principle)
This commit is contained in:
peter 2002-06-20 06:21:20 +00:00
parent f49002f4f6
commit 4830c34648
7 changed files with 7 additions and 8 deletions

View File

@ -36,7 +36,7 @@
#define RQB_BIT(pri) (1UL << ((pri) & (RQB_BPW - 1)))
#define RQB_WORD(pri) ((pri) >> RQB_L2BPW)
#define RQB_FFS(word) (ffs64(word))
#define RQB_FFS(word) (ffs64(word) - 1)
/*
* Type of run queue status word.

View File

@ -36,7 +36,7 @@
#define RQB_BIT(pri) (1 << ((pri) & (RQB_BPW - 1)))
#define RQB_WORD(pri) ((pri) >> RQB_L2BPW)
#define RQB_FFS(word) (ffs(word))
#define RQB_FFS(word) (ffs(word) - 1)
/*
* Type of run queue status word.

View File

@ -36,7 +36,7 @@
#define RQB_BIT(pri) (1 << ((pri) & (RQB_BPW - 1)))
#define RQB_WORD(pri) ((pri) >> RQB_L2BPW)
#define RQB_FFS(word) (ffs(word))
#define RQB_FFS(word) (ffs(word) - 1)
/*
* Type of run queue status word.

View File

@ -36,7 +36,7 @@
#define RQB_BIT(pri) (1UL << ((pri) & (RQB_BPW - 1)))
#define RQB_WORD(pri) ((pri) >> RQB_L2BPW)
#define RQB_FFS(word) (ffs64(word))
#define RQB_FFS(word) (ffs64(word) - 1)
/*
* Type of run queue status word.

View File

@ -129,8 +129,7 @@ runq_findbit(struct runq *rq)
rqb = &rq->rq_status;
for (i = 0; i < RQB_LEN; i++)
if (rqb->rqb_bits[i]) {
pri = (RQB_FFS(rqb->rqb_bits[i]) - 1) +
(i << RQB_L2BPW);
pri = RQB_FFS(rqb->rqb_bits[i]) + (i << RQB_L2BPW);
CTR3(KTR_RUNQ, "runq_findbit: bits=%#x i=%d pri=%d",
rqb->rqb_bits[i], i, pri);
return (pri);

View File

@ -36,7 +36,7 @@
#define RQB_BIT(pri) (1 << ((pri) & (RQB_BPW - 1)))
#define RQB_WORD(pri) ((pri) >> RQB_L2BPW)
#define RQB_FFS(word) (ffs(word))
#define RQB_FFS(word) (ffs(word) - 1)
/*
* Type of run queue status word.

View File

@ -36,7 +36,7 @@
#define RQB_BIT(pri) (1UL << ((pri) & (RQB_BPW - 1)))
#define RQB_WORD(pri) ((pri) >> RQB_L2BPW)
#define RQB_FFS(word) (ffs64(word))
#define RQB_FFS(word) (ffs64(word) - 1)
/*
* Type of run queue status word.