Skip to content

Commit

Permalink
fix inlining of bloom check
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancdotorg committed Aug 1, 2015
1 parent 9d9bd0a commit 517269b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
25 changes: 0 additions & 25 deletions bloom.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,6 @@ void bloom_set_hash160(unsigned char *bloom, uint32_t *h) {
t = BH19(h); BLOOM_SET_BIT(t);
}

inline unsigned int bloom_chk_hash160(unsigned char *bloom, uint32_t *h) {
unsigned int t;
t = BH00(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH01(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH02(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH03(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH04(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH05(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH06(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH07(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH08(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH09(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH10(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH11(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH12(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH13(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH14(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH15(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH16(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH17(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH18(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH19(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
return 1;
}

int _bloom_mmap(unsigned char **bloom, unsigned char *filename) {
int ret, fd, i;
struct stat sb;
Expand Down
25 changes: 24 additions & 1 deletion bloom.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,30 @@
#define BH19(N) (N[4]<<24|N[0]>> 8)

void bloom_set_hash160(unsigned char *, uint32_t *);
inline unsigned int bloom_chk_hash160(unsigned char *, uint32_t *);
inline unsigned int bloom_chk_hash160(unsigned char *bloom, uint32_t *h) {
unsigned int t;
t = BH00(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH01(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH02(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH03(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH04(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH05(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH06(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH07(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH08(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH09(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH10(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH11(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH12(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH13(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH14(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH15(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH16(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH17(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH18(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH19(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
return 1;
}

unsigned char * bloom_open(unsigned char *);

Expand Down

0 comments on commit 517269b

Please sign in to comment.