Deleted Added
full compact
bitmap.c (296221) bitmap.c (299587)
1#define JEMALLOC_BITMAP_C_
2#include "jemalloc/internal/jemalloc_internal.h"
3
4/******************************************************************************/
5
6#ifdef USE_TREE
7
8void

--- 60 unchanged lines hidden (view full) ---

69 }
70}
71
72#else /* USE_TREE */
73
74void
75bitmap_info_init(bitmap_info_t *binfo, size_t nbits)
76{
1#define JEMALLOC_BITMAP_C_
2#include "jemalloc/internal/jemalloc_internal.h"
3
4/******************************************************************************/
5
6#ifdef USE_TREE
7
8void

--- 60 unchanged lines hidden (view full) ---

69 }
70}
71
72#else /* USE_TREE */
73
74void
75bitmap_info_init(bitmap_info_t *binfo, size_t nbits)
76{
77 size_t i;
78
79 assert(nbits > 0);
80 assert(nbits <= (ZU(1) << LG_BITMAP_MAXBITS));
81
77
78 assert(nbits > 0);
79 assert(nbits <= (ZU(1) << LG_BITMAP_MAXBITS));
80
82 i = nbits >> LG_BITMAP_GROUP_NBITS;
83 if (nbits % BITMAP_GROUP_NBITS != 0)
84 i++;
85 binfo->ngroups = i;
81 binfo->ngroups = BITMAP_BITS2GROUPS(nbits);
86 binfo->nbits = nbits;
87}
88
89static size_t
90bitmap_info_ngroups(const bitmap_info_t *binfo)
91{
92
93 return (binfo->ngroups);
94}
95
96void
97bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo)
98{
99 size_t extra;
100
101 memset(bitmap, 0xffU, bitmap_size(binfo));
82 binfo->nbits = nbits;
83}
84
85static size_t
86bitmap_info_ngroups(const bitmap_info_t *binfo)
87{
88
89 return (binfo->ngroups);
90}
91
92void
93bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo)
94{
95 size_t extra;
96
97 memset(bitmap, 0xffU, bitmap_size(binfo));
102 extra = (binfo->nbits % (binfo->ngroups * BITMAP_GROUP_NBITS));
98 extra = (BITMAP_GROUP_NBITS - (binfo->nbits & BITMAP_GROUP_NBITS_MASK))
99 & BITMAP_GROUP_NBITS_MASK;
103 if (extra != 0)
100 if (extra != 0)
104 bitmap[binfo->ngroups - 1] >>= (BITMAP_GROUP_NBITS - extra);
101 bitmap[binfo->ngroups - 1] >>= extra;
105}
106
107#endif /* USE_TREE */
108
109size_t
110bitmap_size(const bitmap_info_t *binfo)
111{
112
113 return (bitmap_info_ngroups(binfo) << LG_SIZEOF_BITMAP);
114}
102}
103
104#endif /* USE_TREE */
105
106size_t
107bitmap_size(const bitmap_info_t *binfo)
108{
109
110 return (bitmap_info_ngroups(binfo) << LG_SIZEOF_BITMAP);
111}