projects
/
SXSI
/
libbp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6d6af09
)
Put bp_darray_rank in header so that it has a chance to be inlined.
author
Kim Nguyễn
<kn@lri.fr>
Thu, 1 Mar 2012 13:21:41 +0000
(14:21 +0100)
committer
Kim Nguyễn
<kn@lri.fr>
Thu, 1 Mar 2012 13:21:41 +0000
(14:21 +0100)
bp-darray.c
patch
|
blob
|
history
bp-darray.h
patch
|
blob
|
history
diff --git
a/bp-darray.c
b/bp-darray.c
index
a4aec4b
..
800ebb1
100644
(file)
--- a/
bp-darray.c
+++ b/
bp-darray.c
@@
-1,7
+1,6
@@
#include <stdio.h>
\r
#include <stdlib.h>
\r
#include "bp-darray.h"
\r
#include <stdio.h>
\r
#include <stdlib.h>
\r
#include "bp-darray.h"
\r
-#include "bp-utils.h"
\r
\r
#define PBS (sizeof(pb)*8)
\r
#define D (1<<logD)
\r
\r
#define PBS (sizeof(pb)*8)
\r
#define D (1<<logD)
\r
@@
-278,31
+277,6
@@
static int darray_rank0(darray *da, int i)
return r;
\r
}
\r
\r
return r;
\r
}
\r
\r
-int bp_darray_rank(darray *da, int i)
\r
-{
\r
- int r,j,i_rr, i_rrr;
\r
- pb *p;
\r
- i_rr = i >> logRR;
\r
- i_rrr = i >> logRRR;
\r
- r = da->rl[i>>logR] + da->rm[i_rr];
\r
-
\r
- j = (i_rrr) & (RR/RRR-1);
\r
- while (j > 0) {
\r
- r += da->rs[((i_rr)<<(logRR-logRRR))+j-1];
\r
- j--;
\r
- }
\r
-
\r
- p = da->buf + ((i_rrr)<<(logRRR-logD));
\r
- j = i & (RRR-1);
\r
- while (j >= D) {
\r
- r += popcount(*p++);
\r
- j -= D;
\r
- }
\r
- r += popcount(*p >> (D-1-j));
\r
-
\r
- return r;
\r
-}
\r
-
\r
int bp_darray_select_bsearch(darray *da, int i, pb (*getpat)(pb *))
\r
{
\r
int j;
\r
int bp_darray_select_bsearch(darray *da, int i, pb (*getpat)(pb *))
\r
{
\r
int j;
\r
diff --git
a/bp-darray.h
b/bp-darray.h
index
23d44a4
..
4224dba
100644
(file)
--- a/
bp-darray.h
+++ b/
bp-darray.h
@@
-4,6
+4,7
@@
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
extern "C" {
#endif
+#include "bp-utils.h"
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned char byte;
typedef unsigned short word;
@@
-36,7
+37,31
@@
darray * bp_darray_construct(int n, pb *buf,int opt);
void bp_darray_free(darray *da);
int bp_darray_select(darray *da, int i,int f);
void bp_darray_free(darray *da);
int bp_darray_select(darray *da, int i,int f);
-int bp_darray_rank(darray *da, int i);
+static int bp_darray_rank(darray *da, int i)
+{
+ int r,j,i_rr, i_rrr;
+ pb *p;
+ i_rr = i >> logRR;
+ i_rrr = i >> logRRR;
+ r = da->rl[i>>logR] + da->rm[i_rr];
+
+ j = (i_rrr) & (RR/RRR-1);
+ while (j > 0) {
+ r += da->rs[((i_rr)<<(logRR-logRRR))+j-1];
+ j--;
+ }
+
+ p = da->buf + ((i_rrr)<<(logRRR-logD));
+ j = i & (RRR-1);
+ while (j >= D) {
+ r += popcount(*p++);
+ j -= D;
+ }
+ r += popcount(*p >> (D-1-j));
+
+ return r;
+}
+
darray * bp_darray_pat_construct(int n, pb *buf, int k, pb pat, int opt);
int bp_darray_pat_select(darray *da, int i, pb (*getpat)(pb *));
int bp_darray_pat_rank(darray *da, int i, pb (*getpat)(pb *));
darray * bp_darray_pat_construct(int n, pb *buf, int k, pb pat, int opt);
int bp_darray_pat_select(darray *da, int i, pb (*getpat)(pb *));
int bp_darray_pat_rank(darray *da, int i, pb (*getpat)(pb *));